Advertisement
LTroya

Create and edit with one form layout

Mar 25th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. // form.blade.php
  2. {{ csrf_field() }}
  3. <input type="hidden" name="id" value="{{ $league->id ?? null }}">
  4. <!-- Name -->
  5. <div class="form-group">
  6.     <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name <span
  7.                 class="required">*</span>
  8.     </label>
  9.     <div class="col-md-6 col-sm-6 col-xs-12">
  10.         <input type="text" id="name" name="name" class="form-control col-md-7 col-xs-12"
  11.                value="{{old('name', $league->name ?? null)}}">
  12.     </div>
  13. </div>
  14.  
  15.  
  16. // create.blade.php
  17. <form id="new-leagues-form" data-parsley-validate class="form-horizontal form-label-left" action="{{ route('leagues.store') }}" method="POST">
  18.      @include('leagues/form')
  19. </form>
  20.  
  21. // edit.blade.php
  22. <form class="form-horizontal form-label-left" action="{{ route('leagues.update', ['id' => $league->id]) }}" method="POST">
  23.        {{ method_field('PUT') }}
  24.        @include('leagues/form', ['league' => $league])
  25. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement