Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Laravel Create Custom Route File

<?php
 
 
namespace AppProviders;
 
 
use IlluminateSupportFacadesRoute;
use IlluminateFoundationSupportProvidersRouteServiceProvider as ServiceProvider;
 
 
class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'AppHttpControllers';
 
 
    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();
    }
 
 
    /**
     * Define the routes for the application.
     *
     * @return void
     */
    public function map()
    {
 
 
        $this->mapApiRoutes();
 
 
        $this->mapWebRoutes();
 
         
        $this->mapStudentRoutes();
 
    }
 
     
    /**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    }
 
 
    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::prefix('api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }
 
 
    /**
     * Define the "student" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapStudentRoutes()
    {
        Route::prefix('admin')
            ->namespace($this->namespace)
            ->group(base_path('routes/student.php'));
    }
 
 
 
}
Comment

Laravel Create Custom Route File

<?php
 
 
namespace AppProviders;
 
 
use IlluminateSupportFacadesRoute;
use IlluminateFoundationSupportProvidersRouteServiceProvider as ServiceProvider;
 
 
class RouteServiceProvider extends ServiceProvider
{
    /**
     * This namespace is applied to your controller routes.
     *
     * In addition, it is set as the URL generator's root namespace.
     *
     * @var string
     */
    protected $namespace = 'AppHttpControllers';
 
 
    /**
     * Define your route model bindings, pattern filters, etc.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();
    }
 
 
    /**
     * Define the routes for the application.
     *
     * @return void
     */
    public function map()
    {
 
 
        $this->mapApiRoutes();
 
 
        $this->mapWebRoutes();
 
         
        $this->mapStudentRoutes();
 
    }
 
     
    /**
     * Define the "web" routes for the application.
     *
     * These routes all receive session state, CSRF protection, etc.
     *
     * @return void
     */
    protected function mapWebRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/web.php'));
    }
 
 
    /**
     * Define the "api" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapApiRoutes()
    {
        Route::prefix('api')
             ->middleware('api')
             ->namespace($this->namespace)
             ->group(base_path('routes/api.php'));
    }
 
 
    /**
     * Define the "student" routes for the application.
     *
     * These routes are typically stateless.
     *
     * @return void
     */
    protected function mapStudentRoutes()
    {
        Route::prefix('admin')
            ->namespace($this->namespace)
            ->group(base_path('routes/student.php'));
    }
 
 
 
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel looping checking if last record has reached 
Php :: wp php blog info image 
Php :: php detect daylight saving time DST 
Php :: Eager realationship in laravel 
Php :: Show All Categories as Links 
Php :: php string variable 
Php :: php order array 
Php :: check multiple roles with Blade directive @can? 
Php :: like button phpAdd Answer 
Php :: symfony request type 
Php :: sqlsrv select 
Php :: Call to undefined method PsyUtilStr::random() 
Php :: php namespaces 
Php :: change wordpress viewport 
Php :: multiple primary key defined laravel 
Php :: validate file count with validate in laravel 
Php :: php pass 2 date value to javascript 
Php :: delete all rows in table laravel foreign key 
Php :: get product price by id woocommerce snippet 
Php :: laravel-check-if-related-model-exists 
Php :: using laravel passport with mongodb 
Php :: phpmailer doesnt work on infinityfree 
Php :: laravel create model for existing table 
Php :: drupal show php errors 
Php :: Laravel unique Validation with multiple input field 
Php :: magento 2 add in static block 
Php :: parent in php 
Php :: cors header ‘access-control-allow-origin’ missing IN PARTICULAR CAKEPHP API 
Php :: withcookie function in php 
Php :: session variable 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =