I'm trying to find a way to pass an object from a view to a controller in Laravel 5.2.
The view contains a Form and the $user
object is accessible in the view.
I would like to know some way to access the $user
object in the controller that is called when the form submit is done.
The view from where $user
is accessible:
credential.blade.php:
<div id="container" align="center">
{{ Form::open(array('action' => 'UsersController@setCredentials', 'method' => 'POST' )) }}
{{ Form::close() }}
</div>
routes.php
Route::post('/credential', 'UsersController@setCredentials');
The driver where I would like to be able to access the $ user object.
UsersController.php
public function setCredentials() {
$this->user= $user;
}