[Vuejs]-Returning null when getting the values of the paramater of create method in laravel

0👍

You’re trying to save variable in $this->student_id and use it later in another method. This is not how this works. The thing is these methods are used in different HTTP requests, so variable will not be kept.

You should pass this variable with from the reservation.form view to the store() method.

You can use Request object for that. In a view:

<input name="studentId" type="hidden">{{ $studentId }}</input>

And in controller:

$studentId = $request->get('studentId');

Or you can pass it as second parameter if you want to use it in a store() method.

 public function store(Request $request, $studentId)
 {
     echo $studentId;

Leave a comment