Techz Hub
We engage and delight your customer community with creative and quality services.
We grow your network, expand your reach, increase interaction and brand recognition and drive lead conversion.
Steps to setup Laravel 8 Application with Roles and Auth
1. Create application with command -> composer create-project laravel/laravel your-app-name (https://laravel.com/docs/8.x/installation -via-composer)
2. cd your-app-name
3. create database and edit in .env file
4. install spatie package for assign roles and permissions -> composer show spatie/laravel-permission (https://spatie.be/docs/laravel-permission/v4/installation-laravel)
5. add this code in config/app.php -> providers -> Spatie\Permission\PermissionServiceProvider::class,
6. run this php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" to publish the migration and permission.php file
7. add this file (UserSeeder) in database/seeders directory to create user roles
8. add this code in User Model
use Spatie\Permission\Traits\HasRoles;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Auth;
and add this in User class use HasRoles
9. add this code in http/kernal => routeMiddleware
//roles and permission\
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
10. run this command -> php artisan optimize:clear, php artisan config:clear
11. create your table migration files if needed otherwise run this command -> php artisan migrate
Now install Login/Register Screens
//Run the bolow commands to install laravel ui package
12. composer require laravel/ui
13. php artisan ui bootstrap--auth you can use (vue/bootstrap/react)
14. npm install && npm run dev
15. php artisan ui:auth
16. run laravel project with -> php artisan serve
17. http://127.0.0.1:8000/
18. add this code in routes/web.php
Route::get('/clear', function() {
Artisan::call('config:cache');
Artisan::call('cache:clear');
Artisan::call('route:clear');
Artisan::call('view:clear');
return "Cleared";
});
Enjoy!
23/08/2021
Hello i am academic writer
Subject we deal with👇
Management science
Social science
Law
English
Finance
Organizational behavior
Strategic management
Accounting
Maths
Chemistry
Physics
Information technology
Project management
Philosophy
Economics
Literature
Calculas
Marketing
Matlab
Spss
PHP
Laravel
Web Development
Final Year Projects
Computer Science
Contact Details
Whatsapp +923136282699
e-Mail: [email protected]
22/08/2021
Hello i am academic writer
Subject we deal with👇
Management science
Social science
Law
English
Finance
Organizational behavior
Strategic management
Accounting
Maths
Chemistry
Physics
Information technology
Project management
Philosophy
Economics
Literature
Calculas
Marketing
Matlab
Spss
Java
Contact Details
Whatsapp +923136282699
e-Mail: [email protected]
09/05/2021
Best Web Hosting 2021 - Domains - WordPress - Bluehost Bluehost is one of the largest website hosting providers and powers millions of websites. Learn more about our secure and reliable hosting services today!
26/03/2020
26/03/2020
01/03/2020
Click here to claim your Sponsored Listing.
Category
Contact the school
Website
Address
Muscat