我有一个令人困惑的问题。我认为代码是正确的。 当我尝试访问浏览器重定向到404错误页面时获取路由,这意味着找不到路由。一旦我移动到上面或下面的路线,再试一次就行了。
但是现在我有两条路线,如果我将其中一条路线移到另一条路线上面,反之亦然,只有其中一条路线可以工作。
我需要解释和解决方案..
这是routes.php文件:
<?php
/*
|--------------------------------------------------------------------------
| Application Information AR
|--------------------------------------------------------------------------
*/
View::share('application_name_ar', config('systemconfig.application_name_ar'));
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', [function () {
return redirect()->route('en.welcome');
},
]);
/*
|--------------------------------------------------------------------------
| Dashboard Routes
|--------------------------------------------------------------------------
*/
Route::group(['middleware' => 'guest'], function () {
Route::get('dashboard/login', ['as' => 'dashboard.login', function () {
return view('dashboard.login');
}]);
});
Route::group(['middleware' => 'admin'], function () {
Route::get('dashboard/manage', ['as' => 'dashboard.manage.index', function () {
return view('dashboard.manage.index');
},
]);
//Request management
Route::controller('dashboard/manage', 'System\RequestManageController', [
'postUpdateRequestStatus' => 'dashboard.manage.requests.status.update',
'getRequest' => 'dashboard.manage.requests.show',
'getPendingRequests' => 'dashboard.manage.requests.pending',
'getApprovedRequests' => 'dashboard.manage.requests.approved',
'getRejectedRequests' => 'dashboard.manage.requests.rejected',
]);
//Search management
Route::controller('dashboard/manage', 'System\SearchController', [
'postSearchInUsers' => 'dashboard.manage.search.in.users',
'postSearchInRequests' => 'dashboard.manage.search.in.requests',
'getReindexAll' => 'dashboard.manage.search.reindex',
'getSearch' => 'dashboard.manage.search',
]);
Route::get('dashboard', ['as' => 'dashboard.start', function () {
return view('dashboard.start');
},
]);
});
/*
|--------------------------------------------------------------------------
| Arabic Site Routes
|--------------------------------------------------------------------------
*/
Route::get('ar', ['as' => 'ar.welcome', function () {
return view('ar.welcome');
},
]);
/*
|--------------------------------------------------------------------------
| English Site Routes
|--------------------------------------------------------------------------
*/
Route::get('en', ['as' => 'en.welcome', function () {
return view('en.welcome');
},
]);
/*
|
| Homes Routes
|
*/
Route::get('en/home', ['as' => 'en.home', function () {
return view('en.home.index');
},
]);
Route::get('en/home/patents-registration', ['as' => 'en.home.patents', function () {
return view('en.home.patent');
},
]);
Route::get('en/home/industrial-registration', ['as' => 'en.home.industrial-registration', function () {
return view('en.home.industrial-registration');
},
]);
Route::get('en/home/computer-software-registration', ['as' => 'en.home.computersoftware-registration', function () {
return view('en.home.computersoftware-registration');
},
]);
// just for users
Route::group(['middleware' => 'signedin'], function () {
// just for users completed profile
Route::group(['middleware' => 'informationcompleted'], function () {
//******************************\\
//******************************\\
// Payment routes
//******************************\\
//******************************\\
Route::get('en/home/{regRequest}/checkout', ['as' => 'en.home.checkout', 'uses' => 'PaymentController@checkout']);
Route::get('en/home/registration/done', ['uses' => 'PaymentController@paypalDone']);
Route::get('en/home/registration/failed', [function () {
return "It has failed";
},
]);
Route::post('en/home/checkout/pay/credit-card', ['as' => 'en.home.pay.credit.card', 'uses' => 'PaymentController@storeCreditCard']);
Route::post('en/home/checkout/pay/paypal', ['as' => 'en.home.pay.paypal', 'uses' => 'PaymentController@storePaypal']);
Route::post('en/home/patents/store-request', ['as' => 'en.home.patents.request.store', 'uses' => 'RegisterRequestsController@storePatent']);
Route::get('en/home/patents-registration/download-application', ['as' => 'en.home.patents.app.pdf', function () {
$pathToFile = storage_path('app/system/docs/patent_app.pdf');
$name = "Patents Application.pdf";
return response()->download($pathToFile, $name);
},
]);
Route::post('en/home/industrial-registration/store-request', ['as' => 'en.home.industrial.request.store', 'uses' => 'RegisterRequestsController@storeIndustrial']);
Route::get('en/home/industrial-registration/download-application', ['as' => 'en.home.industrial.app.pdf', function () {
$pathToFile = storage_path('app/system/docs/model_app.pdf');
$name = "Industrial Application.pdf";
return response()->download($pathToFile, $name);
},
]);
Route::post('en/home/computer-software-registration/store-request', ['as' => 'en.home.cs.request.store', 'uses' => 'RegisterRequestsController@storeCS']);
Route::get('en/home/computer-software-registration/download-application', ['as' => 'en.home.cs.app.pdf', function () {
$pathToFile = storage_path('app/system/docs/cs_app.pdf');
$name = "Software Patent Application.pdf";
return response()->download($pathToFile, $name);
},
]);
});
// end just for users completed profile
// messages routes
Route::get('en/my-account/messages/download-attachment-file', ['as' => 'en.home.messages.download', 'uses' => 'MessagesController@downloadAttachmentFile']);
Route::post('en/my-account/messages/markasread/{id}', ['as' => 'en.home.messages.markasread', 'uses' => 'MessagesController@markAsRead']);
Route::post('en/my-account/messages/markasunread/{id}', ['as' => 'en.home.messages.markasunread', 'uses' => 'MessagesController@markAsUnread']);
Route::resource('en/my-account/messages', 'MessagesController');
/*
|
| Account Routes
|
*/
Route::get('en/my-account/{code}/request', ['as' => 'en.account.request.show', function ($code) {
if (xProject\RegistrationRequest::where('code', $code)->first() == null) {
Session::flash('error', 'Request code is not correct.');
return Redirect::back();
}
$request = xProject\RegistrationRequest::where('code', $code)->first();
// show messages
try {
$thread = Cmgmyr\Messenger\Models\Thread::findOrFail($request->thread_id);
} catch (ModelNotFoundException $e) {
Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
return redirect('messages');
}
// show current user in list if not a current participant
$users = Cartalyst\Sentinel\Users\EloquentUser::whereNotIn('id', $thread->participantsUserIds())->get();
$userId = Sentinel::getUser();
$thread->markAsRead($userId);
return view('en.account.request-show', ['request' => $request, 'thread' => $thread, 'users' => $users]);
}]);
Route::get('en/my-account/request/{code}/cancel', ['as' => 'en.account.request.cancel', function ($code) {
if (xProject\RegistrationRequest::where('code', $code)->first() == null) {
Session::flash('error', 'Request code is not correct.');
return Redirect::back();
}
$regRequest = xProject\RegistrationRequest::where('code', $code)->first();
if ($regRequest->is_paid) {
Session::flash('error', 'You can\'t cancel this request.');
return Redirect::back();
} else {
xProject\RegistrationRequest::where('code', $code)->delete();
Session::flash('success', 'Your Request has been Canceled.');
return redirect()->route('en.account');
}
},
]);
Route::get('en/my-account/requests', ['as' => 'en.account.requests', function () {
$requests_approved = xProject\RegistrationRequest::where('is_approved', 1)->get();
$requests_pending = xProject\RegistrationRequest::where('is_approved', null)->where('is_paid', 1)->get();
$requests_rejected = xProject\RegistrationRequest::where('is_approved', 0)->get();
$requests_not_paid = xProject\RegistrationRequest::where('is_paid', 0)->get();
return view('en.account.requests', ['requests_approved' => $requests_approved, 'requests_pending' => $requests_pending, 'requests_rejected' => $requests_rejected, 'requests_not_paid' => $requests_not_paid]);
},
]);
Route::get('en/my-account/profile', ['as' => 'en.account.profile', function () {
return view('en.account.profile');
},
]);
Route::get('en/my-account', ['as' => 'en.account', function () {
return view('en.account.index');
},
]);
Route::controller('en/my-account', 'MyAccountController', ['postUpdateInformation' => 'en.account.updateinformation', 'postUpdatePassword' => 'en.account.updatepassword', 'postUpdatePP' => 'en.account.updatepp', 'postUpdateIdProof' => 'en.account.updateid']);
});
// end just for users
/*
|
| Auth Routes
|
*/
Route::get('en/faq', ['as' => 'en.faq', function () {
return view('en.faq');
},
]);
Route::get('en/contact-us', ['as' => 'en.contact-us', function () {
return view('en.contact-us');
},
]);
Route::post('en/contact-us/post', ['as' => 'en.contact-us.post', 'uses' => 'MessagesController@contactMessageStore']);
Route::get('en/about-us', ['as' => 'en.about-us', function () {
return view('en.about-us');
},
]);
Route::get('en/logout', ['as' => 'get.logout', function () {
Sentinel::logout(null, true);
return Redirect::route('en.welcome');
},
]);
Route::group(['middleware' => 'guest'], function () {
Route::get('en/signup', ['as' => 'en.signup', function () {
return view('en.signup');
},
]);
Route::get('en/verify', ['as' => 'en.verification', function () {
return view('en.verification');
},
]);
Route::get('en/login', ['as' => 'en.login', function () {
return view('en.login');
},
]);
Route::get('en/ResetPassword', ['as' => 'en.resetpassword', function () {
return view('en.resetpassword');
},
]);
Route::controller('auth', 'Auth\AuthController', ['postSignup' => 'post.signup', 'postLogin' => 'post.login', 'postVerification' => 'post.verification', 'postResend' => 'post.resend', 'postResetpassword' => 'post.resetpassword']);
});