In this Repository you will get complete laravel 8 application with roles and auth. you can clone this repository and boom you setup your laravel application.
- Windows 10
- XAMPP, WAMPP server Download
- PHP 7.4 or better
- nodejs Download
- composer Download
- git bash Download
I hope you already install xampp server
- Download git bash from this link -> Download
- simply install
- after installation process complete
- open folder where you want to install your laravel application
- right click in folder and click in project folder and click on Git Bash Here option then run this command
- Download composer from this lnik -> Download
- simply install
- download link for nodejs -> Download
- simple install
run this command. replace your-app-name with your app name
composer create-project laravel/laravel:^8.0 your-app-name
cd your-app-name
- go to phpmyadmin
- create new database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=root
DB_PASSWORD=
composer require spatie/laravel-permission
Spatie\Permission\PermissionServiceProvider::class,
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
to publish the migration and permission.php file
- add this file (UserSeeder) in database/seeders directory to create user roles UserSeeder
- make changes in this file according to you need.
use Spatie\Permission\Traits\HasRoles;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
use Auth;
add this under User class
use HasFactory,HasRoles;
protected $guarded = [];
//roles and permission
'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class,
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role_or_permission' => \Spatie\Permission\Middlewares\RoleOrPermissionMiddleware::class,
php artisan optimize:clear
php artisan config:clear
php artisan migrate:fresh --seed
Run the bolow commands to install laravel ui package
1. composer require laravel/ui:*
2. php artisan ui bootstrap --auth you can use (vue/bootstrap/react)
3. npm install && npm run dev
4. run laravel project with -> php artisan serve
5. visit -> [http://127.0.0.1:8000/](http://127.0.0.1:8000/)
Auther: Inaam ul haq
YouTube: Techzhubb
Instagram: Techzhubb
Facebook: Techzhubb