I think this is the last problem of my project. I have 2 parameters in 1 route {locale}/projects/{id}/billings
, the problem is i passed 2 parameter values in view but it still prompts an error with missing required parameters. Here's my code
web.php
Route::group(['prefix' => '{locale}', 'where' => ['locale' => '[a-zA-Z]{2}'], 'middleware' => 'setlocale'], function () {
Route::get('/', function () {
return view('welcome');
})->name('main');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
//Customers
Route::get('/customers', 'CustomerController@showcust')->name('customers');
Route::post('/sendcust', 'CustomerController@sendcust')->name('sendcust');
//Items
Route::get('/items', 'ItemController@showitems')->name('items');
Route::post('/senditem', 'ItemController@senditem')->name('senditem');
//Projects
Route::get('/projects', 'ProjectController@showprojects')->name('projects');
Route::post('/sendproj', 'ProjectController@sendproj')->name('sendproj');
//ProjectBillings
Route::get('/projects/{id}/billings', 'ProjectController@showbilling')->name('showbilling');
Route::post('/sendbilling', 'ProjectController@addbilling')->name('sendbilling');
//Invoices
Route::get('/invoices', 'InvoiceController@showinvoice')->name('invoices');
Route::post('/sendinvoitem', 'InvoiceController@sendinvoitem')->name('sendinvoitem');
Route::get('/invoices/{id}/details', 'InvoiceController@showdetails');
Route::post('/updateitem','InvoiceController@updatedetail')->name('updateitem');
Route::get('invoices/{id}/generate', 'InvoiceController@generate');
Route::post('/updatestatus', 'InvoiceController@changestatus')->name('updatestatus');
});
projects.blade.php
<a href="{{route('showbilling', ['locale' => app()->getLocale(), 'id' => $cat->id])}}" class="btn btn-default btn-xs waves-effect waves-float waves-green"> {{__('Add Billing')}} </a>
ProjectController.php
public function showbilling($locale, $id){
$billings = Project::find($id);
//return $billings;
return view('admin.addbillings', compact('billings'));
}
UPDATE
You are passing the parameters incorrectly to the route, The error you are getting is generated at the Router method not at the controller, setting up the router method correctly, it should fix your issue.
Route::prefix('{locale}')->middleware('setlocale')->group(function(){
Route::get('/projects/{id}/billings', 'ProjectController@showbilling')->name('showbilling');
})->where('locale' => '[a-zA-Z]{2}');
Resultant URI /{locale}/project/{id}/billings
I think you should use this URL:/{locale}/showbilling (Eg:"as/showbilling") instead now you use. The {locale} is efficient in router group. So, I guess you forget this one.