If you are new for laravel template, here you start with creating new page.
Create New View with blade.php
extension under the resources->views->content->pages
directory.
Let's create a testPage for an example with filename testPage.blade.php
and placing the below code in that file.
@extends('layouts/layoutMaster')
@section('title', 'Your Page Title') // change title accordingly
@section('content')
// your page content goes here
@endsection
Create Controller for different methods related to page. (Optional: You can use default controller also.)
Add Configuration as per your requirements in controller as described here.
php artisan make:controller {ControllerName} {-r}
After creating file and controller you need to declare its route where it can be served on the browser.
Suppose, you want to create this page to be serve on the route http://localhost:8080/pages/testPage
, you need to define its routes in the resources->web.php
file.
use App\Http\Controllers\pages\TestPage;
Route::get('/pages/testpage', [TestPage::class, 'index'])->name('dashboard-analytics');
Add page link to vertical & horizontal menu. Find verticalMenu.json
and horizontalMenu.json
files inside resources/menu/
folder.
Option 1: To add menu item as main menu:
{
"url": "pages/testPage",
"name": "Test Page",
"icon": "menu-icon tf-icons bx bx-home",
"slug": "pages-testpage"
},
Option 2: To add menu item as sub menu:
{
"name": "Pages",
"icon": "menu-icon tf-icons bx bx-file",
"slug": "pages-testpage",
"submenu": [
{
"url": "/pages/testPage",
"name": "Test Page",
"slug": "pages-testpage"
},
]
},
search-vertical.json
and search-horizontal.json
inside public/assets/json/
folder.{
"name": "Test Page",
"icon": "bx-home-alt",
"url": "pages/testPage"
},
lang->en.json
{all language json} file to display in multi language."Dashboard"=> "Instrumententafel",
"Modern"=> "Modern",
For Mix: You need to run the command yarn dev
or yarn watch
command in the project directory.
For Vite: You need to run the command yarn build
or yarn dev
command in the project directory.
To serve your project to localhost, you need to run the command php artisan serve
.