Advertisement
viktorasssit

Untitled

Feb 17th, 2020
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. Noriu edit formoje isvesti duomenis, kad galima butu editingi userio data
  2. Mano forma:
  3. @foreach ($users as $user)
  4. {{ Form::model($user, array('route' => array('user.edit', $user->id)))}}
  5. {{ Form::label('first_name', 'First Name', ['class' => '']) }}
  6. {{ Form::text('first_name') }}
  7. {{ Form::label('last_name', 'Last Name', ['class' => '']) }}
  8. {{ Form::text('last_name') }}
  9. {{ Form::label('partner', 'What are you?', ['class' => '']) }}
  10. {{ Form::select('size', ['L' => 'Large', 'S' => 'Small'], null, ['placeholder' => 'Pick a partner...'])}}
  11. {{ Form::label('email', 'Email', ['class' => '']) }}
  12. {{ Form::text('email') }}
  13. {{ Form::label('paypal_email', 'Paypal email', ['class' => '']) }}
  14. {{ Form::text('paypal_email') }}
  15. {{ Form::label('referal_id', 'Referral ID', ['class' => '']) }}
  16. {{ Form::text('referal_id') }}
  17. {!! csrf_field() !!}
  18. {!! Form::close() !!}
  19. @if($errors->any())
  20. @foreach($errors->all() as $error)
  21. <div class="alert alert-danger">
  22. <strong>Error!</strong> {{$error}}
  23. </div>
  24. @endforeach
  25. @endif
  26. @endforeach
  27.  
  28. Gaunu:
  29.  
  30. Undefined variable: users
  31.  
  32. Routes: Route::post('/account', 'UserController@edit')->name('user.edit');
  33.  
  34. UserController@edit:
  35. public function edit($id)
  36. {
  37. return view('account.index', ['user' => User::findOrFail($id)]);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement