In this updated tutorial, we’ll create a responsive admin dashboard layout with CSS and a touch of JavaScript. To build it, we’ll borrow some ideas from the WordPress dashboard, such as its collapsible sidebar menu.
Throughout the tutorial, we’ll face plenty of challenges, but ones that will give us good practice for enhancing our front-end skills.
Header
Moving on with our admin dashboard layout, let’s look at the page header.
Within it, we’ll define a nav element that will serve as the wrapper for the following elements:
The logo.
The Collapse button that will toggle the menu on mobile screens.
The menu itself. This will contain the menu links, two headings, a light/dark mode switch, and the collapse/expand button. It might be more semantically correct to have two individual menus and place the headings outside them, but you can approach things differently if you prefer.
The header structure With Code:
Define the Main Dashboard Styles
holidaylandmark\assets\dist\css\adminlte.min.css this file call
holidaylandmark\assets\dist\css\adminlte.js this file call
holidaylandmark\assets\dist\css\adminlte.min.css this file call
holidaylandmark\assets\dist\css\adminlte.min.css this file call
holidaylandmark\assets\dist\css\adminlte.min.css this file call
holidaylandmark\assets\dist\css\adminlte.min.css this file call
In this tutorial I’m going to describe about crud operation how to install project and setup and create controller, models, migration and all the things please read it carefully and follow some easy steps.
Lets go to download project and set up to
composer create-project laravel/laravel form "5.8.*"
Next go to .env file and put your database name -> form
Next step create database in PhpMyAdmin Database name 👇
form
Now migrate the table run this command 👇
php artisan migrate
Table has been migrated successfully.
let’s go to create model, migration and controller in one command copy below code and paste in your terminal.
php artisan make:model product -mcr
Now migrate the table
php artisan migrate
Step 4: Add Resource Route
<?php
use App\Http\Controllers\ProductController;
/* |-------------------------------------------------------------------------- | 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('/', function () { return view('welcome'); });
Step 5: Go to Your Controller and paste below code in your controller file
<?php
namespace App\Http\Controllers;
use App\Product; use Illuminate\Http\Request;
class ProductController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $products = Product::latest()->paginate(5);
return redirect()->route('products.index') ->with('success','Product created successfully.'); }
/** * Display the specified resource. * * @param \App\Product $product * @return \Illuminate\Http\Response */ public function show(Product $product) { return view('products.show',compact('product')); }
/** * Show the form for editing the specified resource. * * @param \App\Product $product * @return \Illuminate\Http\Response */ public function edit(Product $product) { return view('products.edit',compact('product')); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Product $product * @return \Illuminate\Http\Response */ public function update(Request $request, Product $product) { $request->validate([ 'name' => 'required', 'detail' => 'required' ]);
@if ($errors->any()) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif
@if ($errors->any()) <div class="alert alert-danger"> <strong>Whoops!</strong> There were some problems with your input.<br><br> <ul> @foreach ($errors->all() as $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif