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;
- [Vuejs]-UserStore (Vuex) in vue and Laravel 5.4
- [Vuejs]-Chart.js not rendering properly until window resize or toggling line in legend
Source:stackexchange.com