Admin dashboard in Laravel 9 | Sample Template
Hello Dev,
This tutorial will give you an example of how to clone a Laravel project from GitHub. let’s discuss the steps to clone the Laravel project from GitHub. I explained simply about the clone Laravel project from GitHub. This article goes into detail on the clone Laravel project from Github on the server.
In this tutorial, I will show you step-by-step how to clone laravel projects from Github, GitLab, or bitbucket and set up an ubuntu server from scratch. you can easily clone laravel 6, laravel 7, laravel 8, and laravel 9 projects from this post.
So, let's follow the below step-by-step and get done with the clone laravel app.
'
Git Clone my Project
1.Run `git clone 'link projer github'
2.Run composer update
3.Run cp .env.example .env or copy .env.example .env
4.Run php artisan key:generate
5.Run php artisan migrate
6.Run php artisan serve
7.Go to link localhost:8000
Step 1: Git Clone Laravel 9
First, clone a new Laravel app just by running the below command in your terminal.
git clone https://gitlab.com/SoengSouy/admin-dashboard-sample-laravel-9.git
Step 2: Composer Update
Type the command in your terminal.
composer update
composer update
Step 3: Set active on the route
Type the command in your terminal.
routes/web.php
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\FormController;
/*
|--------------------------------------------------------------------------
| 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!
|
*/
/** set active side bar */
function set_active($route) {
if (is_array($route)) {
return in_array(Request::path(), $route) ? 'active' : '';
}
return Request::path() == $route ? 'active' : '';
}
Route::get('/', function () {
return view('dashboard.dashboard');
})->name('/');
// ----------------------------- main dashboard ------------------------------//
Route::controller(HomeController::class)->group(function () {
Route::get('dashboard/page', 'index')->name('dashboard/page');
Route::get('form/input', 'index')->name('form/input');
});
// -------------------------------- form ------------------------------------//
Route::controller(FormController::class)->group(function () {
Route::get('view/upload/file', 'formFileView')->name('view/upload/file'); // file view
Route::get('download/file/{file_name}', 'fileDownload'); // file download
});
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\FormController;
/*
|--------------------------------------------------------------------------
| 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!
|
*/
/** set active side bar */
function set_active($route) {
if (is_array($route)) {
return in_array(Request::path(), $route) ? 'active' : '';
}
return Request::path() == $route ? 'active' : '';
}
Route::get('/', function () {
return view('dashboard.dashboard');
})->name('/');
// ----------------------------- main dashboard ------------------------------//
Route::controller(HomeController::class)->group(function () {
Route::get('dashboard/page', 'index')->name('dashboard/page');
Route::get('form/input', 'index')->name('form/input');
});
// -------------------------------- form ------------------------------------//
Route::controller(FormController::class)->group(function () {
Route::get('view/upload/file', 'formFileView')->name('view/upload/file'); // file view
Route::get('download/file/{file_name}', 'fileDownload'); // file download
});
Step 4: Form
views/pageview/form-upload-file.blade.php
@extends('layouts.master')
@section('content')
{{-- message --}}
{!! Toastr::message() !!}
<div class="page-wrapper">
<div class="content container-fluid">
<div class="page-header">
<div class="row">
<div class="col-sm-12">
<h3 class="page-title">Form Report File Upload</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
<li class="breadcrumb-item active">Form Report File Upload</li>
</ul>
</div>
</div>
</div>
<div class="row filter-row">
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus select-focus">
<input class="form-control floating" type="text">
<label class="focus-label">Full Name By</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<div class="cal-icon">
<input class="form-control floating datetimepicker" type="text">
</div>
<label class="focus-label">From</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<div class="cal-icon">
<input class="form-control floating datetimepicker" type="text">
</div>
<label class="focus-label">To</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="btn btn-success btn-block"> Search </a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped custom-table mb-0 datatable">
<thead>
<tr>
<th>No</th>
<th>Upload By</th>
<th>Date Time</th>
<th>File Name</th>
<th>Uuid</th>
<th>View File</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($fileUpload as $key=>$items )
<tr>
<td>{{ ++ $key }}</td>
<td>
<strong>{{ $items->upload_by }}</strong>
</td>
<td>{{ $items->date_time }}</td>
<td><a href="{{ url('download/file/'.$items->file_name) }}">{{ $items->file_name }}</a></td>
<td>{{ $items->uuid }}</td>
<td>
<span class="avatar">
<img alt="" src="">
</span>
</td>
<td class="text-right">
<div class="dropdown dropdown-action">
<a href="#" class="action-icon dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="">
<i class="fa fa-pencil m-r-5"></i>Edit
</a>
<a class="dropdown-item delete" href="#" data-toggle="modal" data-target="#delete_form_record">
<i class="fa fa-trash-o m-r-5"></i>Delete
</a>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('layouts.master')
@section('content')
{{-- message --}}
{!! Toastr::message() !!}
<div class="page-wrapper">
<div class="content container-fluid">
<div class="page-header">
<div class="row">
<div class="col-sm-12">
<h3 class="page-title">Form Report File Upload</h3>
<ul class="breadcrumb">
<li class="breadcrumb-item"><a href="index.html">Dashboard</a></li>
<li class="breadcrumb-item active">Form Report File Upload</li>
</ul>
</div>
</div>
</div>
<div class="row filter-row">
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus select-focus">
<input class="form-control floating" type="text">
<label class="focus-label">Full Name By</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<div class="cal-icon">
<input class="form-control floating datetimepicker" type="text">
</div>
<label class="focus-label">From</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<div class="form-group form-focus">
<div class="cal-icon">
<input class="form-control floating datetimepicker" type="text">
</div>
<label class="focus-label">To</label>
</div>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="btn btn-success btn-block"> Search </a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped custom-table mb-0 datatable">
<thead>
<tr>
<th>No</th>
<th>Upload By</th>
<th>Date Time</th>
<th>File Name</th>
<th>Uuid</th>
<th>View File</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
@foreach ($fileUpload as $key=>$items )
<tr>
<td>{{ ++ $key }}</td>
<td>
<strong>{{ $items->upload_by }}</strong>
</td>
<td>{{ $items->date_time }}</td>
<td><a href="{{ url('download/file/'.$items->file_name) }}">{{ $items->file_name }}</a></td>
<td>{{ $items->uuid }}</td>
<td>
<span class="avatar">
<img alt="" src="">
</span>
</td>
<td class="text-right">
<div class="dropdown dropdown-action">
<a href="#" class="action-icon dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="">
<i class="fa fa-pencil m-r-5"></i>Edit
</a>
<a class="dropdown-item delete" href="#" data-toggle="modal" data-target="#delete_form_record">
<i class="fa fa-trash-o m-r-5"></i>Delete
</a>
</div>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
Step 5: Controller
app\Http\Controllers\FormController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Uuid;
use Carbon\Carbon;
use App\Models\FormInput;
use App\Models\FileUpload;
use Brian2694\Toastr\Facades\Toastr;
class FormController extends Controller
{/** view file upload */
public function formFileView()
{
$fileUpload = FileUpload::all();
return view('pageview.view-file-upload-table',compact('fileUpload'));
}
/** file upload */
public function fileDownload($file_name)
{
$fileDownload = FileUpload::where('file_name',$file_name)->first();
$download = storage_path("app/file_store/{$fileDownload->file_name}");
return \Response::download($download);
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Uuid;
use Carbon\Carbon;
use App\Models\FormInput;
use App\Models\FileUpload;
use Brian2694\Toastr\Facades\Toastr;
class FormController extends Controller
{/** view file upload */
public function formFileView()
{
$fileUpload = FileUpload::all();
return view('pageview.view-file-upload-table',compact('fileUpload'));
}
/** file upload */
public function fileDownload($file_name)
{
$fileDownload = FileUpload::where('file_name',$file_name)->first();
$download = storage_path("app/file_store/{$fileDownload->file_name}");
return \Response::download($download);
}
}
php artisan migrate
php artisan migrate
Step 5:Run
After adding the run file now run the migrate command.
php artisan serve
Tags:
Laravel