Skip to content

Commit e2ac4bc

Browse files
authored
Merge pull request #18 from skn-036/noman
version 2 with laravel 10 & vue 3, entire rework
2 parents 5bd55b2 + d635b7e commit e2ac4bc

File tree

219 files changed

+9998
-69612
lines changed

Some content is hidden

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

219 files changed

+9998
-69612
lines changed

.editorconfig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@ root = true
33
[*]
44
charset = utf-8
55
end_of_line = lf
6-
insert_final_newline = true
7-
indent_style = space
86
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

1111
[*.md]
1212
trim_trailing_whitespace = false
1313

1414
[*.{yml,yaml}]
1515
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

.env.example

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
APP_NAME=Laravel
22
APP_ENV=local
3-
APP_KEY=base64:UrQfqSTf3hsGIcldX1Y/bsO6WVLThXETt1GHZPKrq/0=
3+
APP_KEY=base64:BNRn58cujolcMCmBtdjN/8TLExrxoDQUBmiKw8h/p1o=
44
APP_DEBUG=true
5-
APP_URL=http://localhost
5+
APP_URL=http://127.0.0.1:8000
66

77
LOG_CHANNEL=stack
8+
LOG_DEPRECATIONS_CHANNEL=null
89
LOG_LEVEL=debug
910

1011
DB_CONNECTION=mysql
@@ -16,11 +17,10 @@ DB_PASSWORD=
1617

1718
BROADCAST_DRIVER=log
1819
CACHE_DRIVER=file
20+
FILESYSTEM_DISK=local
1921
QUEUE_CONNECTION=sync
20-
SESSION_DRIVER=cookie
21-
SESSION_LIFETIME=600
22-
SESSION_DOMAIN="null"
23-
SANCTUM_STATEFUL_DOMAINS="127.0.0.1:8000"
22+
SESSION_DRIVER=file
23+
SESSION_LIFETIME=120
2424

2525
MEMCACHED_HOST=127.0.0.1
2626

@@ -29,23 +29,33 @@ REDIS_PASSWORD=null
2929
REDIS_PORT=6379
3030

3131
MAIL_MAILER=smtp
32-
MAIL_HOST=mailhog
32+
MAIL_HOST=mailpit
3333
MAIL_PORT=1025
3434
MAIL_USERNAME=null
3535
MAIL_PASSWORD=null
3636
MAIL_ENCRYPTION=null
37-
MAIL_FROM_ADDRESS=null
37+
MAIL_FROM_ADDRESS="hello@example.com"
3838
MAIL_FROM_NAME="${APP_NAME}"
3939

4040
AWS_ACCESS_KEY_ID=
4141
AWS_SECRET_ACCESS_KEY=
4242
AWS_DEFAULT_REGION=us-east-1
4343
AWS_BUCKET=
44+
AWS_USE_PATH_STYLE_ENDPOINT=false
4445

4546
PUSHER_APP_ID=
4647
PUSHER_APP_KEY=
4748
PUSHER_APP_SECRET=
49+
PUSHER_HOST=
50+
PUSHER_PORT=443
51+
PUSHER_SCHEME=https
4852
PUSHER_APP_CLUSTER=mt1
4953

50-
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
51-
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
54+
SANCTUM_STATEFUL_DOMAINS=127.0.0.1:8000
55+
56+
VITE_APP_NAME="${APP_NAME}"
57+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
58+
VITE_PUSHER_HOST="${PUSHER_HOST}"
59+
VITE_PUSHER_PORT="${PUSHER_PORT}"
60+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
61+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.gitattributes

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
* text=auto
2-
*.css linguist-vendored
3-
*.scss linguist-vendored
4-
*.js linguist-vendored
1+
* text=auto eol=lf
2+
3+
*.blade.php diff=html
4+
*.css diff=css
5+
*.html diff=html
6+
*.md diff=markdown
7+
*.php diff=php
8+
9+
/.github export-ignore
510
CHANGELOG.md export-ignore
11+
.styleci.yml export-ignore

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1+
/.phpunit.cache
12
/node_modules
3+
/public/build
24
/public/hot
35
/public/storage
6+
/storage/app
47
/storage/*.key
58
/vendor
69
.env
710
.env.backup
11+
.env.production
812
.phpunit.result.cache
9-
docker-compose.override.yml
1013
Homestead.json
1114
Homestead.yaml
15+
auth.json
1216
npm-debug.log
1317
yarn-error.log
18+
/.fleet
19+
/.idea
20+
/.vscode

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": ["@prettier/plugin-php"],
3+
"tabWidth": 4,
4+
"trailingComma": "all",
5+
"arrowParens": "always",
6+
"printWidth": 80,
7+
"semi": true,
8+
"singleQuote": true,
9+
"singleAttributePerLine": true,
10+
"vueIndentScriptAndStyle": false
11+
}

.styleci.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## About This Repository
22

3-
This repository uses PHP Laravel and Javascript Vue.js frameworks to implement Role Permissions management in CMS. Cookie based SPA authorization feature of Laravel Sanctum package is used to authorize the user inside the content management system. If a logged user has permission to do specific task, the link to visit the task and the page containing the task will be available to the logged user. Otherwise the page will be unavailable to the logged user with 401 unauthorized error even though try to access the route manually. This repo utilizes the SPA feature of Vue.js.
3+
This repository uses PHP Laravel version 10, Javascript Vue.js version 3 and Tailwind css frameworks to implement Role Permissions management in CMS. Vite is used to compile the frontend assets. Cookie based SPA authorization feature of Laravel Sanctum package is used to authorize the user inside the content management system. Vue router is used to handle the routing and Pinia is used as the frontend store management system. If a logged user has permission to do specific task, the link to visit the task and the page containing the task will be available to the logged user. Otherwise the page will be unavailable to the logged user with 401 unauthorized error even though try to access the route manually. Though some actions are visible on the frontend for better user experience, but it will handled on the backend and shows a error toast with relevant error message as well as permission requirements. This repo utilizes the SPA feature of Vue.js.
44

55
## Logging In
66

@@ -90,29 +90,37 @@ Following credentials can be used to log in the system
9090
</table>
9191
<br>
9292

93-
Initailly only Super Admin is granted all the permissions. All other role has no permissions. To add permissions to any other role first log in as super admin, then visit all roles then role edit. Permissions can be attached or detached to any role from here.
93+
Initailly only Super Admin is granted all the permissions. All other role has no permissions. To add permissions to any other role, first log in as super admin, then go to the roles page. Assign necessary permissions to the role. Then come to the users page and update users roles. One user can have multiple roles. Overall user permissions will be the collection of all roles permissions combined. Super admin role is readonly(can not be edited or deleted). This role can not be applied to any other user. If a new permission is created, updated or deleted, it will be automatically applied to super admin.
9494

9595
## Installation
9696

9797
First download this repository. Navigate to root of the project and then
98+
9899
<pre>
99100
<code>composer install</code>
100101
<code>npm install</code>
101102
</pre>
102103

103104
Copy the contents of .env.example to .env file. Fill up the database credentials(DB_DATABASE, DB_USERNAME, DB_PASSWORD) according to your database. At the root of your project run the following commands on terminal sequentially.
105+
104106
<pre>
105107
<code>php artisan key:generate</code>
106108
<code>php artisan migrate</code>
107109
<code>php artisan db:seed</code>
108110
</pre>
109111

110-
This will store all the default data into the database. Then compile the assets by
112+
This will store all the default data into the database. Then compile the assets and run development server by
113+
111114
<pre>
112115
<code>npm run dev</code>
113116
</pre>
114117

115-
Finally initiate your server and enjoy !!!
118+
Finally initiate your server on a new terminal and enjoy !!!
119+
116120
<pre>
117121
<code>php artisan serve</code>
118122
</pre>
123+
124+
## Api resource
125+
126+
Postman collection for this repository can be found here in https://www.postman.com/cms-spa-036/workspace/cms-role-permission-laravel-vue

app/Console/Kernel.php

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,18 @@
77

88
class Kernel extends ConsoleKernel
99
{
10-
/**
11-
* The Artisan commands provided by your application.
12-
*
13-
* @var array
14-
*/
15-
protected $commands = [
16-
//
17-
];
18-
1910
/**
2011
* Define the application's command schedule.
21-
*
22-
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23-
* @return void
2412
*/
25-
protected function schedule(Schedule $schedule)
13+
protected function schedule(Schedule $schedule): void
2614
{
2715
// $schedule->command('inspire')->hourly();
2816
}
2917

3018
/**
3119
* Register the commands for the application.
32-
*
33-
* @return void
3420
*/
35-
protected function commands()
21+
protected function commands(): void
3622
{
3723
$this->load(__DIR__.'/Commands');
3824

app/Exceptions/Handler.php

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,9 @@
88
class Handler extends ExceptionHandler
99
{
1010
/**
11-
* A list of the exception types that are not reported.
11+
* The list of the inputs that are never flashed to the session on validation exceptions.
1212
*
13-
* @var array
14-
*/
15-
protected $dontReport = [
16-
//
17-
];
18-
19-
/**
20-
* A list of the inputs that are never flashed for validation exceptions.
21-
*
22-
* @var array
13+
* @var array<int, string>
2314
*/
2415
protected $dontFlash = [
2516
'current_password',
@@ -29,10 +20,8 @@ class Handler extends ExceptionHandler
2920

3021
/**
3122
* Register the exception handling callbacks for the application.
32-
*
33-
* @return void
3423
*/
35-
public function register()
24+
public function register(): void
3625
{
3726
$this->reportable(function (Throwable $e) {
3827
//

app/Http/Controllers/Auth/ConfirmPasswordController.php

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)