Laravel Structure

How to create new page?

Let's create new page named test. create new route for page in routes/web.php like below.

Route::get('/test-page', [App\Http\Controllers\TestController::class, 'test'])->name('test');

After adding routes create new controller using below command.

php artisan make:controller TestController

Open your TestController file. which is located in app/Http/Controller/TestController.php. and create new function named test().

public function test() {
    return view('test');
}

Now time to make view of test page. create test.blade.php in resources/views/ directory.

@extends("layouts.master")
@section('title') Page Title @endsection
@section('css')
<!-- your page css file -->
@endsection
@section('content')
<!-- your page content start from here -->

@endsection
@section('content')
<!-- your page script here -->
@endsection

Now, simple run below command for clear cache. and you can use your page after.

php artisan optimize

How to add new javascript dependency?

Let's add new module named simplebar. Install Simplebar using below command.

npm install simplebar

Its time to register Simplebar in package-copy-config.json file.

{
"packagesToCopy": [
    "simplebar"
    ]
}

and then run below command. after you can access this from public/build/libs/simplebar.

npm run build
© Velzon.
Design & Develop by Themesbrand