Skip to content

Commit fd33974

Browse files
authored
Merge pull request #1 from Innovix-Matrix-Systems/IMS-3
Laravel Version upgrade to 11 & code improvement
2 parents 71fdfc2 + e6de6ea commit fd33974

35 files changed

+1751
-1900
lines changed

.env.testing.example

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_URL=http://localhost
6+
7+
TELESCOPE_ENABLED=true
8+
DEBUGBAR_ENABLED=true
9+
10+
LOG_CHANNEL=stack
11+
LOG_DEPRECATIONS_CHANNEL=null
12+
LOG_LEVEL=debug
13+
14+
DB_CONNECTION=sqlite
15+
DB_DATABASE=database/database.sqlite
16+
17+
BROADCAST_DRIVER=log
18+
CACHE_DRIVER=file
19+
FILESYSTEM_DISK=local
20+
QUEUE_CONNECTION=database
21+
SESSION_DRIVER=file
22+
SESSION_LIFETIME=120
23+
24+
MEMCACHED_HOST=127.0.0.1
25+
26+
REDIS_HOST=127.0.0.1
27+
REDIS_PASSWORD=null
28+
REDIS_PORT=6379
29+
30+
MAIL_MAILER=smtp
31+
MAIL_HOST=mailpit
32+
MAIL_PORT=1025
33+
MAIL_USERNAME=null
34+
MAIL_PASSWORD=null
35+
MAIL_ENCRYPTION=null
36+
MAIL_FROM_ADDRESS="[email protected]"
37+
MAIL_FROM_NAME="${APP_NAME}"
38+
39+
AWS_ACCESS_KEY_ID=
40+
AWS_SECRET_ACCESS_KEY=
41+
AWS_DEFAULT_REGION=us-east-1
42+
AWS_BUCKET=
43+
AWS_USE_PATH_STYLE_ENDPOINT=false
44+
45+
PUSHER_APP_ID=
46+
PUSHER_APP_KEY=
47+
PUSHER_APP_SECRET=
48+
PUSHER_HOST=
49+
PUSHER_PORT=443
50+
PUSHER_SCHEME=https
51+
PUSHER_APP_CLUSTER=mt1
52+
53+
VITE_APP_NAME="${APP_NAME}"
54+
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
55+
VITE_PUSHER_HOST="${PUSHER_HOST}"
56+
VITE_PUSHER_PORT="${PUSHER_PORT}"
57+
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
58+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.github/workflows/laravel-test.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Laravel-Test
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
laravel-tests:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
15+
with:
16+
php-version: "8.2"
17+
- uses: actions/checkout@v3
18+
- name: Copy .env
19+
run: php -r "file_exists('.env') || copy('.env.testing.example', '.env');"
20+
- name: Install Dependencies
21+
run: |
22+
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
23+
- name: Generate key
24+
run: php artisan key:generate
25+
- name: Directory Permissions
26+
run: |
27+
chmod -R 777 storage storage
28+
chmod -R 777 storage bootstrap/cache
29+
- name: Create Database
30+
env:
31+
DB_CONNECTION: sqlite
32+
DB_DATABASE: database/database.sqlite
33+
run: |
34+
mkdir -p database
35+
touch database/database.sqlite
36+
php artisan cache:clear
37+
php artisan migrate --seed
38+
- name: Execute tests (Unit and Feature tests) via PEST
39+
env:
40+
DB_CONNECTION: sqlite
41+
DB_DATABASE: database/database.sqlite
42+
run: vendor/bin/pest

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Explore this project and experience the convenience of a ready-made local develo
1010

1111
## Features
1212

13-
- **Authentication using Laravel Sanctum**: Implement secure authentication using [Laravel Sanctum](https://laravel.com/docs/10.x/sanctum).
13+
- **Authentication using Laravel Sanctum**: Implement secure authentication using [Laravel Sanctum](https://laravel.com/docs/11.x/sanctum).
1414

1515
- **Role & Permission-Based Authorization**: Utilize [Laravel Permission](https://spatie.be/docs/laravel-permission/v6/introduction) for a flexible authorization system based on roles and permissions.
1616

@@ -134,6 +134,10 @@ To execute tests for your application, utilize the following command:
134134
./vendor/bin/pest
135135
```
136136

137+
```bash
138+
php artisan test
139+
```
140+
137141
Running tests is crucial to ensure the reliability and correctness of your application's functionality. The above command will initiate the testing process and provide you with valuable insights into the quality of your codebase.
138142

139143
## Extra Artisan Commands
@@ -156,15 +160,6 @@ php artisan make:service TestService
156160
```
157161
The newly created service will be located at `app/Http/Services/TestService.php`, ready to handle your application's business logic.
158162

159-
### Generate a Trait
160-
Traits are reusable code components that enhance code organization. To create a new trait, simply run:
161-
162-
```bash
163-
php artisan make:trait TestTrait
164-
```
165-
166-
This command generates a new trait file for your project, promoting code reusability and maintainability.
167-
168163
Leverage these Artisan commands to streamline your development process and maintain a well-structured codebase.
169164

170165
## Authors

app/Console/Commands/MakeTraitCommand.php

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

app/Console/Commands/stubs/traits.stub

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

app/Enums/UserRole.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
enum UserRole: string
6+
{
7+
case SUPER_ADMIN = 'Super-Admin';
8+
case ADMIN = 'Admin';
9+
case USER = 'User';
10+
}

app/Enums/UserStatus.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace App\Enums;
4+
5+
enum UserStatus: int
6+
{
7+
case ACTIVE = 1;
8+
case DEACTIVE = 0;
9+
}

app/Http/Controllers/Api/V1/Auth/AuthController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,13 @@ public function __construct(AuthService $authService)
3434
*/
3535
public function login(LoginRequest $request)
3636
{
37-
3837
$user = User::where('email', $request->email)
3938
->with('roles.permissions')
4039
->first();
4140
$authData = $this->authService->login(
4241
$user,
4342
$request->password,
4443
$request->device,
45-
true,
4644
);
4745
$data = [
4846
'user' => UserResource::make($authData['user']),

0 commit comments

Comments
 (0)