Hi,
I am new to Laravel and have a issue passing valu from a view to a controller and I get Missing required parameters for [Route: / xxxxx error.
Bellow is my code. Why am I getting this error?
View:
<a href="{{ route('/first_letter', ['f_letter'=>'A']) }}">A</a>
Route:
Route::get('/first_letter/{$f_letter}','ProductController@first_letter')->name('/first_letter');
Controller:
public function index() {
$products=DB::table('products')
->join('families','products.id_family','=','families.id')
->select('products.name')
->where('products.name','like',$this->letter.'%')
->get();
return view('product.index', compact('products'));
When defining a parameter in route you don't need to define the $.
Fix -> Route::get('/first_letter/{f_letter}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community