Reputation: 5
I want to call only the Data with one user ID only: and i get the below error:
Missing required parameters for [Route: VLead] [URI: VLead/{id}]. (View: C:\wamp64\www\S2\resources\views\admin\sidebar\sidebar.blade.php) (View: C:\wamp64\www\S2\resources\views\admin\sidebar\sidebar.blade.php)
Route::get('/VLead/{id}', 'ClientController@index_lead')->name('VLead')->middleware('user');
Controller
public function index_lead($id)
{
$clients = DB::table('clients')->where('Stage','<>',"Active" )
->orderBy('id', 'Aesc')
->get();
return view('admin.VLead',compact('clients'));
}
<script language="javascript" type="text/javascript">
var scrt_var = {{ Sentinel::getuser()->id}};
</script>
<li><a class="" href="{{route('VLead')}} "onclick="location.href=this.href+'/'+scrt_var;return false;" >Leads</a></li>
Upvotes: 1
Views: 3611
Reputation: 1346
You need to change {{route('VLead')}}
to {{route('VLead', Sentinel::getuser()->id)}}
or make the id
parameter optional by changing Route::get('/VLead/{id}'
to Route::get('/VLead/{id?}'
Upvotes: 1
Reputation: 163898
You're getting the error because you do not pass required parameter. Do something like this:
{{ route('VLead', ['id' => $userId]) }}
Upvotes: 0