Skip to content

Commit a20dfb2

Browse files
committed
Laravel8 Tailwinds (User/Roles/Permissions) CRUD
0 parents  commit a20dfb2

File tree

164 files changed

+28675
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+28675
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.env.example

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
LOG_CHANNEL=stack
8+
9+
DB_CONNECTION=mysql
10+
DB_HOST=127.0.0.1
11+
DB_PORT=3306
12+
DB_DATABASE=laravel
13+
DB_USERNAME=root
14+
DB_PASSWORD=
15+
16+
BROADCAST_DRIVER=log
17+
CACHE_DRIVER=file
18+
QUEUE_CONNECTION=sync
19+
SESSION_DRIVER=file
20+
SESSION_LIFETIME=120
21+
22+
REDIS_HOST=127.0.0.1
23+
REDIS_PASSWORD=null
24+
REDIS_PORT=6379
25+
26+
MAIL_MAILER=smtp
27+
MAIL_HOST=smtp.mailtrap.io
28+
MAIL_PORT=2525
29+
MAIL_USERNAME=null
30+
MAIL_PASSWORD=null
31+
MAIL_ENCRYPTION=null
32+
MAIL_FROM_ADDRESS=null
33+
MAIL_FROM_NAME="${APP_NAME}"
34+
35+
AWS_ACCESS_KEY_ID=
36+
AWS_SECRET_ACCESS_KEY=
37+
AWS_DEFAULT_REGION=us-east-1
38+
AWS_BUCKET=
39+
40+
PUSHER_APP_ID=
41+
PUSHER_APP_KEY=
42+
PUSHER_APP_SECRET=
43+
PUSHER_APP_CLUSTER=mt1
44+
45+
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
46+
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.scss linguist-vendored
4+
*.js linguist-vendored
5+
CHANGELOG.md export-ignore

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/node_modules
2+
/public/hot
3+
/public/storage
4+
/storage/*.key
5+
/vendor
6+
/.idea
7+
.env
8+
.env.backup
9+
.phpunit.result.cache
10+
Homestead.json
11+
Homestead.yaml
12+
npm-debug.log
13+
yarn-error.log

.styleci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
php:
2+
preset: laravel
3+
disabled:
4+
- unused_use
5+
finder:
6+
not-name:
7+
- index.php
8+
- server.php
9+
js:
10+
finder:
11+
not-name:
12+
- webpack.mix.js
13+
css: true

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Admin Dashoard: User/Roles/Permissions with Tailwind Theme
2+
3+
- - - - -
4+
5+
## How to use
6+
7+
- Clone the repository with __git clone__
8+
- Copy __.env.example__ file to __.env__ and edit database credentials there
9+
- Run __composer update__
10+
- Run __php artisan key:generate__
11+
- Run __php artisan migrate --seed__ (it has some seeded data for your testing)
12+
- That's it: launch the main URL.
13+
- You can login to admin dashboard with default credentials __[email protected]__ - __Admin@2022__
14+
15+
## License
16+
17+
Free to use and re-use any way you want.
18+
19+
---
20+
21+
Structure / Folders (where is everything?)
22+
23+
* Routes in `wep.php` included
24+
* Routes in `api.php` included
25+
* Views `Resources\Views\Admin` included
26+
* Database `Seeder` & `Migrations` included
27+
```
28+
- Migrations include:
29+
1. Users
30+
2. Roles
31+
3. Permissions
32+
4. Permission_Role pivot table
33+
5. Role_User pivot table
34+
```
35+
* Controllers:
36+
1. Admin - with User / Roles / Permissions
37+
2. Api - with User / Roles / Permissions
38+
39+
* Model (not on a Models Folder but just `App\`)
40+
41+
* Requests Folder (CRUD Functions)
42+
43+
* Resources\Admin

app/Console/Kernel.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
//
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
// $schedule->command('inspire')->hourly();
28+
}
29+
30+
/**
31+
* Register the commands for the application.
32+
*
33+
* @return void
34+
*/
35+
protected function commands()
36+
{
37+
$this->load(__DIR__.'/Commands');
38+
39+
require base_path('routes/console.php');
40+
}
41+
}

app/Exceptions/Handler.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
6+
7+
class Handler extends ExceptionHandler
8+
{
9+
/**
10+
* A list of the exception types that are not reported.
11+
*
12+
* @var array
13+
*/
14+
protected $dontReport = [
15+
//
16+
];
17+
18+
/**
19+
* A list of the inputs that are never flashed for validation exceptions.
20+
*
21+
* @var array
22+
*/
23+
protected $dontFlash = [
24+
'password',
25+
'password_confirmation',
26+
];
27+
28+
/**
29+
* Register the exception handling callbacks for the application.
30+
*
31+
* @return void
32+
*/
33+
public function register()
34+
{
35+
//
36+
}
37+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
class HomeController
6+
{
7+
public function index()
8+
{
9+
return view('home');
10+
}
11+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Admin;
4+
5+
use App\Http\Controllers\Controller;
6+
use App\Http\Requests\MassDestroyPermissionRequest;
7+
use App\Http\Requests\StorePermissionRequest;
8+
use App\Http\Requests\UpdatePermissionRequest;
9+
use App\Permission;
10+
use Gate;
11+
use Illuminate\Http\Request;
12+
use Symfony\Component\HttpFoundation\Response;
13+
14+
class PermissionsController extends Controller
15+
{
16+
public function index()
17+
{
18+
abort_if(Gate::denies('permission_access'), Response::HTTP_FORBIDDEN, '403 Forbidden');
19+
20+
$permissions = Permission::all();
21+
22+
return view('admin.permissions.index', compact('permissions'));
23+
}
24+
25+
public function create()
26+
{
27+
abort_if(Gate::denies('permission_create'), Response::HTTP_FORBIDDEN, '403 Forbidden');
28+
29+
return view('admin.permissions.create');
30+
}
31+
32+
public function store(StorePermissionRequest $request)
33+
{
34+
$permission = Permission::create($request->all());
35+
36+
return redirect()->route('admin.permissions.index');
37+
}
38+
39+
public function edit(Permission $permission)
40+
{
41+
abort_if(Gate::denies('permission_edit'), Response::HTTP_FORBIDDEN, '403 Forbidden');
42+
43+
return view('admin.permissions.edit', compact('permission'));
44+
}
45+
46+
public function update(UpdatePermissionRequest $request, Permission $permission)
47+
{
48+
$permission->update($request->all());
49+
50+
return redirect()->route('admin.permissions.index');
51+
}
52+
53+
public function show(Permission $permission)
54+
{
55+
abort_if(Gate::denies('permission_show'), Response::HTTP_FORBIDDEN, '403 Forbidden');
56+
57+
return view('admin.permissions.show', compact('permission'));
58+
}
59+
60+
public function destroy(Permission $permission)
61+
{
62+
abort_if(Gate::denies('permission_delete'), Response::HTTP_FORBIDDEN, '403 Forbidden');
63+
64+
$permission->delete();
65+
66+
return back();
67+
}
68+
69+
public function massDestroy(MassDestroyPermissionRequest $request)
70+
{
71+
Permission::whereIn('id', request('ids'))->delete();
72+
73+
return response(null, Response::HTTP_NO_CONTENT);
74+
}
75+
}

0 commit comments

Comments
 (0)