Skip to content

Commit dada1f3

Browse files
committed
V1.0
1 parent 23cccc3 commit dada1f3

File tree

3 files changed

+43
-69
lines changed

3 files changed

+43
-69
lines changed

README.md

Lines changed: 12 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,5 @@
1-
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
2-
3-
<p align="center">
4-
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
5-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
6-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
7-
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
8-
</p>
9-
10-
## About Laravel
11-
12-
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
13-
14-
- [Simple, fast routing engine](https://laravel.com/docs/routing).
15-
- [Powerful dependency injection container](https://laravel.com/docs/container).
16-
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17-
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18-
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19-
- [Robust background job processing](https://laravel.com/docs/queues).
20-
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
21-
22-
Laravel is accessible, powerful, and provides tools required for large, robust applications.
23-
24-
## Learning Laravel
25-
26-
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
27-
28-
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
29-
30-
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
31-
32-
## Laravel Sponsors
33-
34-
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
35-
36-
### Premium Partners
37-
38-
- **[Vehikl](https://vehikl.com/)**
39-
- **[Tighten Co.](https://tighten.co)**
40-
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
41-
- **[64 Robots](https://64robots.com)**
42-
- **[Cubet Techno Labs](https://cubettech.com)**
43-
- **[Cyber-Duck](https://cyber-duck.co.uk)**
44-
- **[Many](https://www.many.co.uk)**
45-
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
46-
- **[DevSquad](https://devsquad.com)**
47-
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
48-
- **[OP.GG](https://op.gg)**
49-
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
50-
- **[Lendio](https://lendio.com)**
51-
52-
## Contributing
53-
54-
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
55-
56-
## Code of Conduct
57-
58-
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
59-
60-
## Security Vulnerabilities
61-
62-
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
63-
64-
## License
65-
66-
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
671

2+
# Laravel App with Roles and Permissions Boilerplate
683

694

705
## Clone the repo
@@ -74,8 +9,12 @@ git clone https://github.com/saurabh2k1/laravel_api.git
749
cd laravel_api
7510
composer install
7611
```
77-
## create .env file by copying .env.example
12+
- Create .env file by copying .env.example
13+
```sh
14+
cp .env.example .env
7815

16+
```
17+
- Create key and migrate the database
7918
```sh
8019
php artisan key:generate
8120
php artisan migrate:fresh
@@ -86,6 +25,12 @@ php artisan migrate:fresh
8625
```sh
8726
php artisan migrate:fresh --seed --seeder=PermissionsSeeder
8827
```
28+
- If you want only Super Admin call the AdminSeeder
29+
30+
```sh
31+
php artisan migrate:fresh --seed --seeder=AdminSeeder
32+
33+
```
8934

9035

9136

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "laravel/laravel",
33
"type": "project",
4-
"description": "The skeleton application for the Laravel framework.",
5-
"keywords": ["laravel", "framework"],
4+
"description": "The bolierplate application for the Laravel with permissions .",
5+
"keywords": ["laravel", "bolierplate", "laravel with permissions"],
66
"license": "MIT",
77
"require": {
88
"php": "^8.1",

database/seeders/AdminSeeder.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Database\Seeders;
4+
5+
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
6+
use Illuminate\Database\Seeder;
7+
use App\Models\Role;
8+
use Spatie\Permission\PermissionRegistrar;
9+
10+
11+
class AdminSeeder extends Seeder
12+
{
13+
/**
14+
* Run the database seeds.
15+
*/
16+
public function run(): void
17+
{
18+
// Reset cached roles and permissions
19+
app()[PermissionRegistrar::class]->forgetCachedPermissions();
20+
21+
$admin_role = Role::create(['name' => 'Super-Admin']);
22+
$user = \App\Models\User::factory()->create([
23+
'name' => 'Super-Admin User',
24+
'email' => 'superadmin@example.com',
25+
]);
26+
$user->assignRole($admin_role);
27+
28+
}
29+
}

0 commit comments

Comments
 (0)