can you give all route file? because the error is self explanatory but i cant figure out what you are trying to do
Apr 3, 2020
4
Level 1
Route pattern "/vendor/{id}/{{id}}" cannot reference variable name "id" more than once.
I created a route resource with dynamic URL but edit, show and update return error:- Route pattern "/vendor/{id}/{{id}}" cannot reference variable name "id" more than once.
Route::resources([
'{id}' => 'Manage\Vendor\PaymentController'
]);
Please provide a solution of this. Thanks in adwance.
Level 23
Level 1
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Auth::routes(['verify' => true]);
Route::get('/home', 'HomeController@index')->name('home');
Route::redirect('/home', '/');
Route::get('/icons', function () {
return view('icons');
});
/*Route::get('/cart', function () {
return view('cart');
});
Route::get('/cart-new', function () {
return view('cart-new');
});
Route::get('/checkout', function () {
return view('checkout');
});*/
Route::get('category/{slug}', 'CategoryController@slug')->where('slug', '.*');
Route::resources([
'category' => 'CategoryController',
'product' => 'ProductController',
'cart' => 'CartController'
]);
Route::resource('checkout', 'CheckoutController')->middleware('verified');
//Route::redirect('/store', '/category');
//Route::get('store/{slug}', 'StoreController@index')->where('slug', '.*');
// Login with Google // Google Auto Signup
Route::get('/auth/google', 'Auth\GoogleController@redirectToGoogle');
Route::get('/auth/google/callback', 'Auth\GoogleController@handleGoogleCallback');
// Login with Facebook // Facebook Auto Signup
Route::get('/auth/facebook', 'Auth\FacebookController@redirectToFacebook');
Route::get('/auth/facebook/callback', 'Auth\FacebookController@handleFacebookCallback');
// Login with Twitter // Twitter Auto Signup
Route::get('/auth/twitter', 'Auth\TwitterController@redirectToTwitter');
Route::get('/auth/twitter/callback', 'Auth\TwitterController@handleTwitterCallback');
// Privacy Policy Link
Route::get('/privacy', function() {
return view('privacy');
});
// Dashboard for Administrator
Route::group(['middleware' => ['administrator','verified'], 'prefix' => 'admin', 'as' => 'admin.'], function ()
{
Route::get('my-orders/by/{type}/{val}', 'Manage\Administrator\OrderController@by');
Route::get('my-orders/{id}/by/{type}/{val}', 'Manage\Administrator\OrderController@byfix');
Route::resources([
'dashboard' => 'Manage\Administrator\IndexController',
'users' => 'Manage\Administrator\UserController',
//'product-listing' => 'Manage\Administrator\ProductListController',
'product-category' => 'Manage\Administrator\ProductCategoryController',
'product-charges' => 'Manage\Administrator\ChargesController',
'product' => 'Manage\Administrator\ManageProductController',
'my-orders' => 'Manage\Administrator\OrderController',
]);
});
// Dashboard for Vendor
Route::group(['middleware' => ['vendor', 'verified'], 'prefix' => 'vendor', 'as' => 'vendor.'], function ()
{
Route::get('my-orders/by/{type}/{val}', 'Manage\Vendor\OrderController@by');
Route::get('my-orders/{id}/by/{type}/{val}', 'Manage\Vendor\OrderController@byfix');
Route::resources([
'dashboard' => 'Manage\Customer\IndexController',
'profile' => 'ProfileController',
'address' => 'Manage\Customer\AddressController',
'seller-info' => 'Manage\Vendor\SellerController',
'products' => 'Manage\Vendor\ProductController',
'setting' => 'Manage\Vendor\SettingController',
'my-orders' => 'Manage\Vendor\OrderController',
'wishlist' => 'WishlistController',
'orders' => 'OrderController',
'{id}' => 'Manage\Vendor\PaymentController'
]);
Route::resource('charges', 'ChargesController');
Route::get('{type}/{id}', 'AddressController');
Route::get('terms/{type}/{id}', 'TermController');
});
// Dashboard for Customers
Route::group(['middleware' => ['customer', 'verified'], 'prefix' => 'customer', 'as' => 'customer.', 'verify' => true], function ()
{
Route::resources([
'dashboard' => 'Manage\Customer\IndexController',
'profile' => 'ProfileController',
'address' => 'Manage\Customer\AddressController',
'to/seller' => 'Manage\Customer\SellerController',
'wishlist' => 'WishlistController',
'orders' => 'OrderController',
]);
Route::get('{type}/{id}', 'AddressController');
Route::get('terms/{type}/{id}', 'TermController');
});
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
$exitCode = Artisan::call('route:clear');
$exitCode = Artisan::call('config:clear');
$exitCode = Artisan::call('view:clear');
return 'all cache clear';
});
Line no 108 Thanks for you reply.
I want to visit the wallet and transaction page via the route
Level 122
name your resource something other than id, eg payments
Level 1
Thanks for the solution. it works fine. I want to try something different but it was not possible. Thanks for your valuable time.
Please or to participate in this conversation.