@diaskinkotakbaskin

Почему не работает route::fallback?

в проекте есть Route::domain группы прописываю fallback под ними и прописал fallback под всем web.php не работает и выдает шаблон 404

<?php

use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| 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('/test', function () {
//    return 'Hello all!';
//});

/**
 * Маршруты интерфейса FRONT - главная страница Dodoc
 **/
//    'namespace' => ,
Route::domain(config('server.constants.mainDomainName'))
    ->namespace('Front')
    ->middleware('FrontDataset')
    ->group(function() {

        Route::get('/refreshtoken', 'FunctionsController@RefreshToken');

        Route::namespace('Home')->group(function (){
            Route::get('/', 'MainController@Index')->name('Front.Home');
        });

        /* https://dodoc.kz/sitemap.xml */
        /*
            /almaty/doctors
            /almaty/doctors/khirurgi
            -- almaty/specializations/{name} - врачи и клиники конкретной специализации в городе
        */

        /*
         *  /doctors/
         *  /doctors/123-ivanov-i-i
         *  /doctors/khirurgi {specialization}
         *  -- /doctors/obsledovanie {service}
         */

//        !!!!TODO: medcenters-types

        Route::namespace('Medcenters')->group(function () {
            Route::get('/medcenter/{MedcenterPageName}', 'MainController@medcenterPage')->name('Front.Medcenters.One');
        });

        Route::namespace('Doctors')->group(function () {
            Route::get('/doctor/{DoctorPageName}', 'MainController@doctorPage')->name('Front.Doctors.One');
        });

        Route::namespace('Specializations')->group(function () {
            Route::get('/specializations', 'MainController@index')->name('Front.Specializations.All');
            Route::get('/specialization/{ SpecializationPageName }', 'MainController@index')->name('Front.Specializations.One');
        });

        Route::namespace('Specializations')->group(function () {
            Route::get('/specializations', 'MainController@index')->name('Front.Specializations.All');
            Route::get('/specializations/{ SpecializationPageName }', 'MainController@index')->name('Front.Specializations.One');
        });
        Route::namespace('Services')->group(function () {
            Route::get('/services', 'MainController@index')->name('Front.Services.All');
            Route::get('/services/{ ServicePageName }', 'MainController@index')->name('Front.Services.One');
        });
        Route::namespace('MedcentersTypes')->group(function () {
            Route::get('/medcenters-types', 'MainController@index')->name('Front.MedcentersTypes.All');
            Route::get('/medcenters-types/{ ServicePageName }', 'MainController@index')->name('Front.MedcentersTypes.One');
        });

        Route::namespace('CMS')->prefix('/cms')->group(function () {
//                Route::get('/', 'MainController@Index')->name('Front.Home');
            Route::get('/', function (){ return redirect(route('Front.CMS.About'), 302); })->name('Front.CMS'); // Редирект на куки
            Route::get('/links', 'MainController@instaLinks')->name('Front.CMS.InstaLinks'); // Ссылка на кнопки для инстаграма (аналог Taplink)

            Route::get('/about', 'MainController@about')->name('Front.CMS.About');
            Route::get('/faq', 'MainController@FAQ')->name('Front.CMS.FAQ');
//            Route::get('/{ urlName }', 'MainController@index')->name('Front.CMS.Any');

            Route::prefix('/rules')->group(function () {
                Route::get('/', function (){ return redirect(route('Front.CMS.Rules.Cookies'), 302); })->name('Front.CMS.Rules'); // Редирект на куки
                Route::get('/cookies', 'MainController@rulesCookies')->name('Front.CMS.Rules.Cookies');
                Route::get('/terms-of-use', 'MainController@rulesTermsOfUse')->name('Front.CMS.Rules.TermsOfUse');
                Route::get('/user-agreement', 'MainController@rulesUserAgreement')->name('Front.CMS.Rules.UserAgreement');
                Route::get('/processing-personal-data', 'MainController@rulesProcessingPersonalData')->name('Front.CMS.Rules.ProcessingPersonalData');
                Route::get('/protection-personal-data', 'MainController@rulesProtectionPersonalData')->name('Front.CMS.Rules.ProtectionPersonalData');
            });
        });

        Route::namespace('Promo')->prefix('/promo')->group(function () {
            Route::get('/', function (){ return redirect(route('Front.Promo.BecomePartner'), 302); })->name('Front.Promo'); // Редирект на партнеров
            Route::get('/become-a-partner', 'MainController@becomePartner')->name('Front.Promo.BecomePartner');
        });

        Route::namespace('Account')->prefix('/account')->group(function () {
            Route::get('/', 'MainController@index')->name('Front.Account.Saved');
            Route::get('/saved', 'MainController@saved')->name('Front.Account.Saved');
        });

        Route::prefix('/search')->namespace('Search')->group(function () {
            Route::any('/', 'MainController@main')->name('Front.Search.Main');
        });

        Route::namespace('Search')->group(function () {
            Route::any('/{cityName?}/{type?}/{activity?}', 'RouterController@main')->name('Front.Search.Universal');
        });

        Route::namespace('Search')->group(function () {
            Route::get('/medcenters', 'RouterController@main')->name('Front.Medcenters.All');
            Route::get('/medcenters/{TypeName}', 'RouterController@bySpec')->name('Front.Medcenters.Type');
            Route::get('/doctors', 'RouterController@main')->name('Front.Doctors.All');
            Route::get('/doctors/{SpecializationName}', 'RouterController@bySpec')->name('Front.Doctors.Specialization');
            Route::get('/doctors/service/{ServicetionName}', 'RouterController@byService')->name('Front.Doctors.Service');
        });


//      Route::any('/doctors', 'MainController@main'); //->name();
//      Route::any('/medcenters', 'MainController@main'); //->name();
//      Route::any('/medcenters-types', 'MainController@main'); //->name();
//      Route::any('/specializations', 'MainController@main'); //->name();
//      Route::any('/services', 'MainController@main'); //->name();
        Route::fallback(function() {
            return 'Hm, why did you land here somehow?';
        });
    });

Route::domain('partner.' . config('server.constants.mainDomainName'))
    ->namespace('Partner')
    ->group(function() {

        Route::get('/', 'HomeController@index');

        Route::group(['prefix' => '/ajax'], function() {
        });
});
  • Вопрос задан
  • 122 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы