laravel NotFoundHttpException in AbstractRouteCollection and Application.php - laravel

laravel : 7.28.0
"php": "^7.2.5"
When I enter any link it gives the following errors:
Symfony\Component\HttpKernel\Exception\NotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:1064
and
Symfony\Component\HttpKernel\Exception\NotFoundHttpException in /home/mick/vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:43
route files
api.php -> Empty
web.php
Route::get('/', 'HomeController#index')->name('home');
Route::get('/clear', 'HomeController#clearCache')->name('clear_cache');
Route::get('/installations', 'InstallationController#installations')->name('installations');
Route::get('/installations/step/2', 'InstallationController#installationsTwo')->name('installations_step_two');
Route::post('/installations/step/2', 'InstallationController#installationPost');
Route::get('/installations/step/final', 'InstallationController#installationFinal')->name('installation_final');
/**
* Authentication
*/
Route::get('/login', 'AuthController#login')->name('login')->middleware('guest');
Route::post('/login', 'AuthController#loginPost');
Route::any('/logout', 'AuthController#logoutPost')->name('logout');
Route::get('/register', 'AuthController#register')->name('register')->middleware('guest');
Route::post('/register', 'AuthController#registerPost');
Route::get('/forgot-password', 'AuthController#forgotPassword')->name('forgot_password');
Route::post('/forgot-password', 'AuthController#sendResetToken');
Route::get('/forgot-password/reset/{token}', 'AuthController#passwordResetForm')->name('reset_password_link');
Route::post('/forgot-password/reset/{token}', 'AuthController#passwordReset');
Route::get('/profile/{id}', 'UserController#profile')->name('profile');
Route::get('/review/{id}', 'UserController#review')->name('review');
Route::get('/courses', 'HomeController#courses')->name('courses');
Route::get('/featured-courses', 'HomeController#courses')->name('featured_courses');
Route::get('/popular-courses', 'HomeController#courses')->name('popular_courses');
Route::get('/courses/{slug?}', 'CourseController#view')->name('course');
Route::get('/courses/{slug}/lecture/{lecture_id}', 'CourseController#lectureView')->name('single_lecture');
Route::get('/courses/{slug}/assignment/{assignment_id}', 'CourseController#assignmentView')->name('single_assignment');
Route::get('/courses/{slug}/quiz/{quiz_id}', 'QuizController#quizView')->name('single_quiz');
Route::get('/topics', 'CategoriesController#home')->name('categories');
Route::get('/topics/{category_slug}', 'CategoriesController#show')->name('category_view');
//Get Topics Dropdown for course creation category select
Route::post('/get-topic-options', 'CategoriesController#getTopicOptions')->name('get_topic_options');
Route::post('/courses/free-enroll', 'CourseController#freeEnroll')->name('free_enroll');
//Attachment Download
Route::get('/attachment-download/{hash}', 'CourseController#attachmentDownload')->name('attachment_download');
Route::get('/payment-thank-you/{transaction_id?}', 'PaymentController#thankYou')->name('payment_thank_you_page');
Route::group(['prefix' => 'login'], function () {
//Social login route
Route::get('/facebook', 'AuthController#redirectFacebook')->name('facebook_redirect');
Route::get('/facebook/callback', 'AuthController#callbackFacebook')->name('facebook_callback');
Route::get('/google', 'AuthController#redirectGoogle')->name('google_redirect');
Route::get('/google/callback', 'AuthController#callbackGoogle')->name('google_callback');
Route::get('/twitter', 'AuthController#redirectTwitter')->name('twitter_redirect');
Route::get('/twitter/callback', 'AuthController#callbackTwitter')->name('twitter_callback');
Route::get('/linkedin', 'AuthController#redirectLinkedIn')->name('linkedin_redirect');
Route::get('/linkedin/callback', 'AuthController#callbackLinkedIn')->name('linkin_callback');
});
Route::group(['middleware' => ['auth']], function () {
Route::post('/courses/{slug}/assignment/{assignment_id}', 'CourseController#assignmentSubmitting');
Route::get('/content_complete/{content_id}', 'CourseController#contentComplete')->name('content_complete');
Route::post('/courses-complete/{course_id}', 'CourseController#complete')->name('course_complete');
Route::group(['prefix' => 'checkout'], function () {
Route::get('/', 'CartController#checkout')->name('checkout');
Route::post('/bank-transfer', 'GatewayController#bankPost')->name('bank_transfer_submit');
Route::post('/paypal', 'GatewayController#paypalRedirect')->name('paypal_redirect');
Route::post('/offline', 'GatewayController#payOffline')->name('pay_offline');
});
Route::post('/save-review/{course_id?}', 'CourseController#writeReview')->name('save_review');
Route::post('/update-wishlist', 'UserController#updateWishlist')->name('update_wish_list');
Route::post('/discussion/ask-question', 'DiscussionController#askQuestion')->name('ask_question');
Route::post('/discussion/reply/{id}', 'DiscussionController#replyPost')->name('discussion_reply_student');
Route::post('/quiz-start', 'QuizController#start')->name('start_quiz');
Route::get('/quiz/{id}', 'QuizController#quizAttempting')->name('quiz_attempt_url');
Route::post('/quiz/{id}', 'QuizController#answerSubmit');
//Route::get('quiz/answer/submit', 'QuizController#answerSubmit')->name('quiz_answer_submit');
});
/**
* Add and remove to Cart
*/
Route::post('/add-to-cart', 'CartController#addToCart')->name('add_to_cart');
Route::post('/remove-cart', 'CartController#removeCart')->name('remove_cart');
/**
* Payment Gateway Silent Notification
* CSRF verification skipped
*/
Route::group(['prefix' => 'gateway-ipn'], function () {
Route::post('/stripe', 'GatewayController#stripeCharge')->name('stripe_charge');
Route::any('/paypal/{transaction_id?}', 'IPNController#paypalNotify')->name('paypal_notify');
});
Route::group(['prefix' => 'dashboard', 'middleware' => ['auth']], function () {
Route::get('/', 'DashboardController#index')->name('dashboard');
/**
* Only instructor has access in this group
*/
Route::group(['middleware' => ['instructor'], ['admin']], function () {
Route::post('/update-section/{id}', 'CourseController#updateSection')->name('update_section');
Route::post('/delete-section', 'CourseController#deleteSection')->name('delete_section');
Route::group(['prefix' => 'courses'], function () {
Route::get('/new', 'CourseController#create')->name('create_course');
Route::post('/new', 'CourseController#store');
Route::get('/p/{course_id}/information', 'CourseController#information')->name('edit_course_information');
Route::post('/p/{course_id}/information', 'CourseController#informationPost');
Route::group(['prefix' => '{course_id}/curriculum'], function () {
Route::get('/', 'CourseController#curriculum')->name('edit_course_curriculum');
Route::get('/new-section', 'CourseController#newSection')->name('new_section');
Route::post('/new-section', 'CourseController#newSectionPost');
Route::post('/new-lecture', 'CourseController#newLecture')->name('new_lecture');
Route::post('/update-lecture/{id}', 'CourseController#updateLecture')->name('update_lecture');
Route::post('/new-assignment', 'CurriculumController#newAssignment')->name('new_assignment');
Route::post('/update-assignment/{id}', 'CurriculumController#updateAssignment')->name('update_assignment');
Route::group(['prefix' => 'quiz'], function () {
Route::post('/create', 'QuizController#newQuiz')->name('new_quiz');
Route::post('/update/{id}', 'QuizController#updateQuiz')->name('update_quiz');
Route::post('/{quiz_id}/create-question', 'QuizController#createQuestion')->name('create_question');
});
});
Route::post('/quiz/edit-question', 'QuizController#editQuestion')->name('edit_question_form');
Route::post('/quiz/update-question', 'QuizController#updateQuestion')->name('edit_question');
Route::post('/load-quiz-questions', 'QuizController#loadQuestions')->name('load_questions');
Route::post('/sort-questions', 'QuizController#sortQuestions')->name('sort_questions');
Route::post('/delete-question', 'QuizController#deleteQuestion')->name('delete_question');
Route::post('/delete-option', 'QuizController#deleteOption')->name('option_delete');
Route::post('/edit-item', 'CourseController#editItem')->name('edit_item_form');
Route::post('/delete-item', 'CourseController#deleteItem')->name('delete_item');
Route::post('/curriculum_sort', 'CurriculumController#sort')->name('curriculum_sort');
Route::post('/delete-attachment', 'CurriculumController#deleteAttachment')->name('delete_attachment_item');
Route::post('/load-section-items', 'CourseController#loadContents')->name('load_contents');
Route::get('/p/{id}/pricing', 'CourseController#pricing')->name('edit_course_pricing');
Route::post('/p/{id}/pricing', 'CourseController#pricingSet');
Route::get('/p/{id}/drip', 'CourseController#drip')->name('edit_course_drip');
Route::post('/p/{id}/drip', 'CourseController#dripPost');
Route::get('/p/{id}/publish', 'CourseController#publish')->name('publish_course');
Route::post('/p/{id}/publish', 'CourseController#publishPost');
});
Route::get('/my-courses', 'CourseController#myCourses')->name('my_courses');
Route::get('/my-courses-reviews', 'CourseController#myCoursesReviews')->name('my_courses_reviews');
Route::group(['prefix' => 'courses-has-quiz'], function () {
Route::get('/', 'QuizController#quizCourses')->name('courses_has_quiz');
Route::get('/quizzes/{id}', 'QuizController#quizzes')->name('courses_quizzes');
Route::get('/attempts/{quiz_id}', 'QuizController#attempts')->name('quiz_attempts');
Route::get('/attempt/{attempt_id}', 'QuizController#attemptDetail')->name('attempt_detail');
Route::post('/attempt/{attempt_id}', 'QuizController#attemptReview');
});
Route::group(['prefix' => 'assignments'], function () {
Route::get('/', 'AssignmentController#index')->name('courses_has_assignments');
Route::get('/course/{course_id}', 'AssignmentController#assignmentsByCourse')->name('courses_assignments');
Route::get('/submissions/{assignment_id}', 'AssignmentController#submissions')->name('assignment_submissions');
Route::get('/submission/{submission_id}', 'AssignmentController#submission')->name('assignment_submission');
Route::post('/submission/{submission_id}', 'AssignmentController#evaluation');
});
Route::group(['prefix' => 'earning'], function () {
Route::get('/', 'EarningController#earning')->name('earning');
Route::get('/report', 'EarningController#earningReport')->name('earning_report');
});
Route::group(['prefix' => 'withdraw'], function () {
Route::get('/', 'EarningController#withdraw')->name('withdraw');
Route::post('/', 'EarningController#withdrawPost');
Route::get('/preference', 'EarningController#withdrawPreference')->name('withdraw_preference');
Route::post('/preference', 'EarningController#withdrawPreferencePost');
});
Route::group(['prefix' => 'discussions'], function () {
Route::get('/', 'DiscussionController#index')->name('instructor_discussions');
Route::get('/reply/{id}', 'DiscussionController#reply')->name('discussion_reply');
Route::post('/reply/{id}', 'DiscussionController#replyPost');
});
});
Route::group(['prefix' => 'media'], function () {
Route::post('/upload', 'MediaController#store')->name('post_media_upload');
Route::get('/load_filemanager', 'MediaController#loadFileManager')->name('load_filemanager');
Route::post('/delete', 'MediaController#delete')->name('delete_media');
});
Route::group(['prefix' => 'settings'], function () {
Route::get('/', 'DashboardController#profileSettings')->name('profile_settings');
Route::post('/', 'DashboardController#profileSettingsPost');
Route::get('/reset-password', 'DashboardController#resetPassword')->name('profile_reset_password');
Route::post('/reset-password', 'DashboardController#resetPasswordPost');
});
Route::get('/enrolled-courses', 'DashboardController#enrolledCourses')->name('enrolled_courses');
Route::get('/reviews-i-wrote', 'DashboardController#myReviews')->name('reviews_i_wrote');
Route::get('/wishlist', 'DashboardController#wishlist')->name('wishlist');
Route::get('/my-quiz-attempts', 'QuizController#myQuizAttempts')->name('my_quiz_attempts');
Route::group(['prefix' => 'purchases'], function () {
Route::get('/', 'DashboardController#purchaseHistory')->name('purchase_history');
Route::get('/view/{id}', 'DashboardController#purchaseView')->name('purchase_view');
});
});
This problem occurs while I am not taking the route cache
But when I take the route cache it does not work at all the site or any path And then it gives the following error: for home path
Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: HEAD.
Is there any solution or procedure that I can follow to solve this problem?

Related

Invalid route action when everything seems fine

My web.php is the one posted below. The problem with it is this part:
Route::group(['prefix' => 'agb-page'], function () {
Route::get('/view', ViewAgbPage::class)->name('agb_page_view');
Route::get('/add', AddAgbPage::class)->name('agb_page_add');
Route::get('/edit/{id}', EditAgbPage::class)->name('agb_page_edit');
});
For some reason it throws and error:
[2022-11-21 18:29:23] local.ERROR: Invalid route action: [App\Http\Livewire\Backend\Pages\Agb\ViewAgbPage]. {"exception":"[object] (UnexpectedValueException(code: 0): Invalid route action: [App\Http\Livewire\Backend\Pages\Agb\ViewAgbPage]. at /var/www/wdctue8/htdocs/active-security-Website/active-security/vendor/laravel/framework/src/Illuminate/Routing/RouteAction.php:92)
[stacktrace]
If I comment out this part, everything works fine. Don't understand what is the problem with it.
<?php
use App\Http\Controllers\UserLogoutController;
use App\Http\Livewire\Backend\Dashboard;
use App\Http\Livewire\Backend\Pages\Agb\AddAgbPage;
use App\Http\Livewire\Backend\Pages\Agb\EditAgbPage;
use App\Http\Livewire\Backend\Pages\Agb\ViewAgbPage;
use App\Http\Livewire\Backend\Pages\AllBanners\AddAllBanners;
use App\Http\Livewire\Backend\Pages\AllBanners\EditAllBanners;
use App\Http\Livewire\Backend\Pages\AllBanners\ViewAllBanners;
use App\Http\Livewire\Backend\Pages\Banner\AddHomeBanner;
use App\Http\Livewire\Backend\Pages\Banner\EditHomeBanner;
use App\Http\Livewire\Backend\Pages\Banner\HomeBanner;
use App\Http\Livewire\Backend\Pages\Company\AddSectionOne;
use App\Http\Livewire\Backend\Pages\Company\AddSectionTwo;
use App\Http\Livewire\Backend\Pages\Company\EditSectionOne;
use App\Http\Livewire\Backend\Pages\Company\EditSectionTwo;
use App\Http\Livewire\Backend\Pages\Company\ViewSectionOne;
use App\Http\Livewire\Backend\Pages\Company\ViewSectionTwo;
use App\Http\Livewire\Backend\Pages\Contacts\AddContactSection;
use App\Http\Livewire\Backend\Pages\Contacts\EditContactSection;
use App\Http\Livewire\Backend\Pages\Contacts\ViewContacts;
use App\Http\Livewire\Backend\Pages\Contacts\ViewContactSection;
use App\Http\Livewire\Backend\Pages\Footer\AddFooterAddress;
use App\Http\Livewire\Backend\Pages\Footer\EditFooterAddress;
use App\Http\Livewire\Backend\Pages\Footer\FooterAddress;
use App\Http\Livewire\Backend\Pages\Footer\Logos\EditFooterLogo;
use App\Http\Livewire\Backend\Pages\Footer\Logos\ViewFooterLogo;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\AddPrivacySettings;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\EditPrivacySettings;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\Tabs\AddPrivacySettingsTab;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\Tabs\EditPrivacySettingsTab;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\Tabs\ViewPrivacySettingsTab;
use App\Http\Livewire\Backend\Pages\Footer\Privacy\ViewPrivacySettings;
use App\Http\Livewire\Backend\Pages\Footer\Social\AddSocialCategory;
use App\Http\Livewire\Backend\Pages\Footer\Social\AddSocialMedia;
use App\Http\Livewire\Backend\Pages\Footer\Social\EditSocialCategory;
use App\Http\Livewire\Backend\Pages\Footer\Social\EditSocialMedia;
use App\Http\Livewire\Backend\Pages\Footer\Social\ViewSocialCategory;
use App\Http\Livewire\Backend\Pages\Footer\Social\ViewSocialMedia;
use App\Http\Livewire\Backend\Pages\Home\Clients\AddHomeClients;
use App\Http\Livewire\Backend\Pages\Home\Clients\EditHomeClients;
use App\Http\Livewire\Backend\Pages\Home\Clients\ViewHomeClients;
use App\Http\Livewire\Backend\Pages\Home\Sections\AddHomeSection1;
use App\Http\Livewire\Backend\Pages\Home\Sections\AddHomeSection2;
use App\Http\Livewire\Backend\Pages\Home\Sections\AddHomeSection5;
use App\Http\Livewire\Backend\Pages\Home\Sections\EditHomeSection1;
use App\Http\Livewire\Backend\Pages\Home\Sections\EditHomeSection2;
use App\Http\Livewire\Backend\Pages\Home\Sections\EditHomeSection5;
use App\Http\Livewire\Backend\Pages\Home\Sections\ViewHomeSection1;
use App\Http\Livewire\Backend\Pages\Home\Sections\ViewHomeSection2;
use App\Http\Livewire\Backend\Pages\Home\Sections\ViewHomeSection5;
use App\Http\Livewire\Backend\Pages\Home\Slider\AddHomeSliders;
use App\Http\Livewire\Backend\Pages\Home\Slider\EditHomeSliders;
use App\Http\Livewire\Backend\Pages\Home\Slider\ViewHomeSliders;
use App\Http\Livewire\Backend\Pages\Job\AddJobSection;
use App\Http\Livewire\Backend\Pages\Job\EditJobSection;
use App\Http\Livewire\Backend\Pages\Job\ViewJobSection;
use App\Http\Livewire\Backend\Pages\Privacy\AddFooterPrivacy;
use App\Http\Livewire\Backend\Pages\Privacy\EditFooterPrivacy;
use App\Http\Livewire\Backend\Pages\Privacy\ViewFooterPrivacy;
use App\Http\Livewire\Backend\Pages\Services\AddServices;
use App\Http\Livewire\Backend\Pages\Services\Banner\EditBanners;
use App\Http\Livewire\Backend\Pages\Services\Banner\ViewBanners;
use App\Http\Livewire\Backend\Pages\Services\EditServices;
use App\Http\Livewire\Backend\Pages\Services\Section\AddLastSection;
use App\Http\Livewire\Backend\Pages\Services\Section\EditLastSection;
use App\Http\Livewire\Backend\Pages\Services\Section\ViewLastSection;
use App\Http\Livewire\Backend\Pages\Services\ViewServices;
use App\Http\Livewire\Frontend\Agb;
use App\Http\Livewire\Frontend\BaustellenbewacHung;
use App\Http\Livewire\Frontend\Centerbewachung;
use App\Http\Livewire\Frontend\Contact;
use App\Http\Livewire\Frontend\Datenschutz;
use App\Http\Livewire\Frontend\Empfangsdienst;
use App\Http\Livewire\Frontend\HomePage;
use App\Http\Livewire\Frontend\Impressum;
use App\Http\Livewire\Frontend\Jobs;
use App\Http\Livewire\Frontend\Kaufhausdetektive;
use App\Http\Livewire\Frontend\ObjektUndWerkschutz;
use App\Http\Livewire\Frontend\OpeningAndClosingService;
use App\Http\Livewire\Frontend\RevierFahrten;
use App\Http\Livewire\Frontend\ShopGuard;
use App\Http\Livewire\Frontend\Unternehmen;
use App\Http\Livewire\Frontend\VeranstaltungsSchutz;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
*/
// Route::get('/', function () {
// return view('welcome');
// });
//================ start Frontend routes ================
// homepage
Route::get('Userlogout', [UserLogoutController::class, 'user_logout'])->name('user.logout');
Route::get('/', HomePage::class)->name('homePage');
// ObjektPage
Route::get('/objekt-und-werkschutz', ObjektUndWerkschutz::class)->name('ObjektPage');
// Centerbewachung
Route::get('/centerbewachung', Centerbewachung::class)->name('CenterbewachungPage');
// Kaufhausdetektive
Route::get('/kaufhausdetektive', Kaufhausdetektive::class)->name('KaufhausdetektivePage');
// BaustellenbewacHung
Route::get('/baustellenbewachung', BaustellenbewacHung::class)->name('baustellenbewachungPage');
// OpeningAndClosingService
Route::get('/opening-and-closing-service', OpeningAndClosingService::class)->name('openingAndclosingPage');
// RevierFahrten
Route::get('/revierfahrten', RevierFahrten::class)->name('revierfahrtenPage');
// Empfangsdienst
Route::get('/empfangsdienst', Empfangsdienst::class)->name('empfangsdienst');
// ShopGuard
Route::get('/shop-guard', ShopGuard::class)->name('ShopGuardPage');
// VeranstaltungsSchutz
Route::get('/veranstaltungsschutz', VeranstaltungsSchutz::class)->name('VeranstaltungsSchutzPage');
// Unternehmen
Route::get('/unternehmen', Unternehmen::class)->name('UnternehmenPage');
// Jobs
Route::get('/jobs', Jobs::class)->name('JobsPage');
// Contact
Route::get('/Kontakt', Contact::class)->name('ContactPage');
// Impressum
Route::get('/impressum', Impressum::class)->name('ImpressumPage');
// Datenschutz
Route::get('/datenschutz', Datenschutz::class)->name('DatenschutzPage');
// Agb
Route::get('/agb', Agb::class)->name('AgbPage');
//================ end Frontend routes ================
//================ start Admin routes ================
Route::middleware([
'auth:sanctum',
config('jetstream.auth_session'),
'verified'
])->group(function () {
// Route::get('/dashboard', function () {
// return view('dashboard');
// })->name('dashboard');
Route::group(['middleware' => ['adminlogin']], function () {
Route::get('/dashboard', Dashboard::class)->name('dashboard');
// Manage home page
Route::group(['prefix' => 'mange-banner'], function () {
Route::get('/view-banner', HomeBanner::class)->name('viewHomebanner');
Route::get('/add-banner', AddHomeBanner::class)->name('addHomebanner');
Route::get('/edit-banner/{id}', EditHomeBanner::class)->name('editHomebanner');
});
// Manage other pages banner
Route::group(['prefix' => 'mange-All-banner'], function () {
Route::get('/view', ViewAllBanners::class)->name('view_all_banner');
Route::get('/add', AddAllBanners::class)->name('add_all_banners');
Route::get('/edit/{id}', EditAllBanners::class)->name('edit_all_banner');
});
//============== home page Section1 ==============
Route::group(['prefix' => 'manage-home'], function () {
// Home Section1
Route::get('/view-section/one', ViewHomeSection1::class)->name('manageHomeSection1');
Route::get('/add-section/one', AddHomeSection1::class)->name('addHomesection1');
Route::get('/edit-section/one/{id}', EditHomeSection1::class)->name('editHomesection1');
// Home Section2
Route::get('/view-section/two', ViewHomeSection2::class)->name('viewHomeSection2');
Route::get('/add-section/two', AddHomeSection2::class)->name('add_HomeSection2');
Route::get('/edit-section/two/{id}', EditHomeSection2::class)->name('edit_HomeSection2');
// View Home Clients
Route::get('/view-client/logo', ViewHomeClients::class)->name('viewHomeclients');
Route::get('/add-client/logo', AddHomeClients::class)->name('addHomeclients');
Route::get('/edit-client/logo/{id}', EditHomeClients::class)->name('editHomeclients');
// View Home Sliders
Route::get('/view-home/slider', ViewHomeSliders::class)->name('viewHomesliders');
Route::get('/add-home/slider', AddHomeSliders::class)->name('addHomesliders');
Route::get('/edit-home/slider/{id}', EditHomeSliders::class)->name('editHomesliders');
// ViewHomeSection5
Route::get('/view-home/section/five', ViewHomeSection5::class)->name('ViewHomeSection5');
Route::get('/add-home/section/five', AddHomeSection5::class)->name('Add_Home_Section5');
Route::get('/edit-home/section/five/{id}', EditHomeSection5::class)->name('edit_Home_Section5');
});
Route::group(['prefix' => 'manage-footer'], function () {
// FooterAddress
Route::get('/contact-view', FooterAddress::class)->name('footer_address');
Route::get('/contact-add', AddFooterAddress::class)->name('Add_footer_address');
Route::get('/contact-edit/{id}', EditFooterAddress::class)->name('edit_footer_address');
Route::group(['prefix' => 'social'], function () {
// ViewSocialMedia
Route::get('/view', ViewSocialMedia::class)->name('view_social_media');
Route::get('/add', AddSocialMedia::class)->name('add_social_media');
Route::get('/edit/{id}', EditSocialMedia::class)->name('edit_social_media');
Route::get('/view-category', ViewSocialCategory::class)->name('view_socialMediaCat');
Route::get('/add-category', AddSocialCategory::class)->name('Add_socialMediaCat');
Route::get('/edit-category/{id}', EditSocialCategory::class)->name('edit_socialMediaCat');
});
// ViewFooterLogo
Route::group(['prefix' => 'logos'], function () {
Route::get('/view', ViewFooterLogo::class)->name('view_footer_logos');
Route::get('/edit/{id}', EditFooterLogo::class)->name('edit_footer_logos');
});
//
Route::group(['prefix' => 'privacy'], function () {
Route::get('/view', ViewPrivacySettings::class)->name('view_privacy_settings');
Route::get('/add', AddPrivacySettings::class)->name('add_privacy_settings');
Route::get('/edit/{id}', EditPrivacySettings::class)->name('edit_privacy_settings');
});
Route::get('/view-tab', ViewPrivacySettingsTab::class)->name('view_privacy_Tabs');
Route::get('/add-tab', AddPrivacySettingsTab::class)->name('add_privacy_Tabs');
Route::get('/edit-tab/{id}', EditPrivacySettingsTab::class)->name('edit_privacy_Tabs');
Route::get('/page-view', ViewFooterPrivacy::class)->name('footer_Privacy_pageView');
Route::get('/page-add', AddFooterPrivacy::class)->name('addfooter_Privacytext');
Route::get('/page-edit/{id}', EditFooterPrivacy::class)->name('editfooter_Privacytext');
});
Route::group(['prefix' => 'agb-page'], function () {
Route::get('/view', ViewAgbPage::class)->name('agb_page_view');
Route::get('/add', AddAgbPage::class)->name('agb_page_add');
Route::get('/edit/{id}', EditAgbPage::class)->name('agb_page_edit');
});
Route::group(['prefix' => 'services'], function () {
Route::get('/view', ViewServices::class)->name('view_services');
Route::get('/add', AddServices::class)->name('add_services');
Route::get('/edit/{id}', EditServices::class)->name('edit_services');
Route::group(['prefix' => 'banner'], function () {
Route::get('/view', ViewBanners::class)->name('view_services_banner');
Route::get('/edit/{id}', EditBanners::class)->name('edit_services_banner');
});
Route::group(['prefix' => 'section'], function () {
Route::get('/view', ViewLastSection::class)->name('view_last_section');
Route::get('/add', AddLastSection::class)->name('add_last_footer_section');
Route::get('/edit/{id}', EditLastSection::class)->name('edit_last_section');
});
});
// home section end
Route::group(['prefix' => 'Company'], function () {
Route::get('/sections/view', ViewSectionOne::class)->name('view_company_sections');
Route::get('/sections/add', AddSectionOne::class)->name('add_company_section1');
Route::get('/sections/edit/{id}', EditSectionOne::class)->name('edit_company_section1');
// ViewSectionTwo
Route::get('/section2/view', ViewSectionTwo::class)->name('viewCompanySections2');
Route::get('/section2/add', AddSectionTwo::class)->name('addCompanySections2');
Route::get('/section2/edit/{id}', EditSectionTwo::class)->name('editCompanySections2');
});
Route::group(['prefix' => 'job-section'], function () {
Route::get('/view', ViewJobSection::class)->name('view_job_section');
Route::get('/edit/{id}', EditJobSection::class)->name('edit_job_section');
Route::get('/add', AddJobSection::class)->name('add_last_section');
});
Route::group(['prefix' => 'Contacts'], function () {
Route::get('/view', ViewContacts::class)->name('view_Contacts');
Route::get('/view-section', ViewContactSection::class)->name('Manage_Contacts_section');
Route::get('/add-section', AddContactSection::class)->name('Add_Contacts_section');
Route::get('/edit-section/{id}', EditContactSection::class)->name('edit_Contacts_section');
});
// middle ware end
});
// middle ware end
// Manage home page
});
//================ end admin routes ================

Laravel build multi-lang route system

im using Laravel 5, and i have this route:
Route::group(['prefix' => '{lang}/', 'middleware' => 'SetLanguage'], function($lang){
//element Show
Route::get('/'.trans('routes.element-container').'/{slugName}', 'ElementController#showByName');
});
My middleware is this:
public function handle($request, Closure $next)
{
if (in_array($request->lang, config('app.all_langs'))){
//exit("SETTING ON ".$request->lang);
App::setLocale($request->lang);
}else{
//exit("SETTING ON en");
App::setLocale('en');
}
return $next($request);
}
If i un-comment the two exit it works, but, the function "trans" on route side is not working, seems to trans only in default lang.
why the "trans" function is called before the middleware?
I have test with 'before' and 'after', but no work...
If I understood you correctly, you could consider something like this:
Route::group(['prefix' => '{lang}/', 'middleware' => 'SetLanguage'], function() {
foreach (config('app.all_langs') as $language) {
$translatedRoute = trans('routes.element-container', [], $language);
Route::get("/$translatedRoute/{slugName}", 'ElementController#showByName');
}
});
But this will also register routes for e.g. /de/element-container/element-a.
Alternative:
foreach (config('app.all_langs') as $language) {
Route::group(['prefix' => $language, 'middleware' => 'SetLanguage'], function() {
$translatedRoute = trans('routes.element-container', [], $language);
Route::get("/$translatedRoute/{slugName}", 'ElementController#showByName');
});
}
This will register /en/element-container/element-a and /de/Elemente-Behälter/element-a, but not /de/element-container/element-a

Redirect entire route group to another url?

Given a route group like Route::group(['prefix' => 'foo',]) how would I redirect all routes under this group to domain.com?
I've tried:
Route::group(['prefix' => 'foo'], function() {
Route::get('/', function () {
return Redirect::to('http://domain.com');
});
});
But that would only redirect myoldsite.com/foo to domain.com, anything such as myoldsite.com/foo/deeper/path would just be a 404. Is there a way to catch all sub routes and redirect them?
You can add a catch-all parameter.
Route::group(['prefix' => 'foo'], function() {
Route::get('/{atsl}', function ($atsl) {
return Redirect::to('http://domain.com');
});
});

Laravel routing groups

I have a question about routing groups. I have two types of users and I can not use the role system. Following the laracast email verification video I was able to get a new type of user to work. So I can login and register no problem. However when I have both types of users routes going it starts rejecting logins and such.
I even tried separating the admin user routes and putting the artist user routes on a different php document but still will not allow two types of logins or to view the proper dashboard.
I have tried using namespace inside the group, prefix, and tried middleware to no avail.
Here's the routing code.
Route::group(['middleware' => ['web']], function () {
Route::get('/', function () {
return view('welcome');
});
Route::get('/artist', function () {
return view('artist');
});
Route::get('/sponsor', function () {
return view('sponsor');
});
Route::get('/viewer', function () {
return view('viewer');
});
Route::get('/contact', function () {
return view('contact');
});
// This is for the Artist Linkings
//Route::group(['middleware' => 'artist'], function () {
//Route::auth('artist');
//Route::get('art/dashboard', 'SessionsController#index');
//Route::get('art/dashboard', ['middleware' => 'artist', function() {
//return view('art/dashboard');
//}]);
//});
//Route::get('art/register', 'RegistrationController#register');
//Route::post('art/register', 'RegistrationController#postRegister');
//Route::get('register/confirm/{token}', 'RegistrationController#confirmEmail');
//Route::get('art/login', 'SessionsController#login');
//Route::post('login', 'SessionsController#postLogin');
//Route::get('/logout', 'SessionsController#logout');
//Route::get('art/dashboard', 'SessionsController#index');
//});
// Need to add the password stuff ect
// Route::group(['prefix' => 'viewer', 'namespace' => 'Viewer'], function () {
// require app_path('Http/Routes/viewers.php');
// });
// This is for all the Viewer Linkings
Route::get('viewer/register', 'ViewerRegistrationController#register');
Route::post('viewer/register', 'ViewerRegistrationController#postRegister');
Route::get('viewer/register/confirm/{token}', 'ViewerRegistrationController#confirmEmail');
Route::get('viewer/login', 'ViewerSessionsController#login');
Route::post('login', 'ViewerSessionsController#postLogin');
Route::get('/logout', 'ViewerSessionsController#logout');
Route::get('viewer/dashboard', 'ViewerSessionsController#index');
//});
//}]);
You can use this .
For artist user as you define
Route::group(["middleware" => ["auth.artist"], "prefix" => "artist","namespace"=>"Artist"], function() {
Route::controller('artist', 'UsersArtistController');
Route::controller('controles', 'controlsArtistController');
});
For viewer user if no any auth needed
Route::group("prefix" => "viewer","namespace"=>"Viewer"], function() {
Route::controller('Viewer ', 'UsersViewer Controller');
Route::controller('controles', 'controlsViewerController');
});
Route::group(['as'=>'admin.','prefix'=>'admin','namespace'=>'Admin','middleware'=>['auth','admin']], function (){
Route::get('dashboard','DashboardController#index')->name('dashboard');
Route::resource('tag','TagController');
Route::resource('category','CategoryController');
});
Route::group(['middleware'=>['auth']], function(){
Route::post('favorite/{post}/add','FavoriteController#add')->name('post.favorite');
Route::post('review/{id}/add','ReviewController#review')->name('review');
});
Route::group(['as'=>'user.','prefix'=>'user','namespace'=>'Author','middleware'=>['auth','user']], function (){
Route::get('dashboard','DashboardController#index')->name('dashboard');
Route::resource('post','PostController');
});

how to use the laravel subdomain routing function

I am using the following code its from the laravel 4 site
Route::group(array('domain' => '{account}.myapp.com'), function() {
Route::get('user/{id}', function($account, $id) {
// ...
return Redirect::to('https://www.myapp.com'.'/'.$account);
});
});
the idea is to redirect subdomain.myapp.com to myapp.com/user/subdomain
.what I have is not working any suggestions?sorry I just started with laravel about a month now.
Remove user/{id} and replace it with / and then use the following url https://accountname.myapp.com and it will redirect to https://www.myapp.com/accountname
Route::group(array('domain' => '{account}.myapp.com'), function() {
Route::get('/', function($account, $id) {
// ...
return Redirect::to('https://www.myapp.com'.'/'.$account);
});
});
Edit the answer to the correct answer
Route::group(array('domain' => '{account}.myapp.com'), function() {
Route::get('/', function($account) {
// ...
return Redirect::to('https://www.myapp.com/'.$account);
});
});
as Marc vd M answer but remove $id from get's closure function.
why use 'https://www.myapp.com'.'/'.$account and not 'https://www.myapp.com/'.$account

Resources