Skip to content

Commit

Permalink
#43: Corrected the code in accordance with the new rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulin-evgeny committed Feb 29, 2024
1 parent 27b3f49 commit e8a29b5
Show file tree
Hide file tree
Showing 39 changed files with 192 additions and 193 deletions.
8 changes: 4 additions & 4 deletions app/Console/Commands/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public function handle(): void
$this->appUrl = $this->ask('Please enter an application URL', "https://api.dev.{$kebabName}.com");

$this->updateConfigFile('.env.testing', '=', [
'DATA_COLLECTOR_KEY' => "{$kebabName}-local"
'DATA_COLLECTOR_KEY' => "{$kebabName}-local",
]);

$envFile = (file_exists('.env')) ? '.env' : '.env.example';

$this->updateConfigFile($envFile, '=', [
'APP_NAME' => $appName,
'SWAGGER_REMOTE_DRIVER_KEY' => "{$kebabName}-local"
'SWAGGER_REMOTE_DRIVER_KEY' => "{$kebabName}-local",
]);

$this->updateConfigFile('.env.development', '=', [
Expand All @@ -76,7 +76,7 @@ public function handle(): void
]);

$this->updateConfigFile('.env.ci-testing', '=', [
'DATA_COLLECTOR_KEY' => "{$kebabName}"
'DATA_COLLECTOR_KEY' => "{$kebabName}",
]);

$this->info('Project initialized successfully!');
Expand Down Expand Up @@ -132,7 +132,7 @@ protected function createAdminUser(string $kebabName): void
'name' => $this->ask('Please enter an admin name', 'Admin'),
'email' => $this->ask('Please enter an admin email', "admin@{$kebabName}.com"),
'password' => $this->ask('Please enter an admin password', $defaultPassword),
'role_id' => Role::ADMIN
'role_id' => Role::ADMIN,
];

$this->publishMigration();
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function login(LoginRequest $request, UserService $service, JWTAuth $auth
'token' => $token,
'ttl' => config('jwt.ttl'),
'refresh_ttl' => config('jwt.refresh_ttl'),
'user' => $user
'user' => $user,
])
->withCookie($tokenCookie);
}
Expand All @@ -61,7 +61,7 @@ public function register(RegisterUserRequest $request, UserService $service, JWT
'token' => $token,
'ttl' => config('jwt.ttl'),
'refresh_ttl' => config('jwt.refresh_ttl'),
'user' => $user
'user' => $user,
])
->withCookie($tokenCookie);
}
Expand All @@ -87,7 +87,7 @@ public function refreshToken(RefreshTokenRequest $request, JWTAuth $auth): JsonR
->json([
'token' => $newToken,
'ttl' => config('jwt.ttl'),
'refresh_ttl' => config('jwt.refresh_ttl')
'refresh_ttl' => config('jwt.refresh_ttl'),
])
->withHeaders(['Authorization' => "Bearer {$newToken}"])
->withCookie($tokenCookie);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/StatusController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use DB;
use Exception;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\DB;

class StatusController extends BaseController
{
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Kernel extends HttpKernel
ValidatePostSize::class,
TrimStrings::class,
ConvertEmptyStringsToNull::class,
AutoDocMiddleware::class
AutoDocMiddleware::class,
];

/**
Expand All @@ -52,21 +52,21 @@ class Kernel extends HttpKernel
// AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class
SubstituteBindings::class,
],

'api' => [
'throttle:60,1',
'bindings'
'bindings',
],

'auth_group' => [
'auth',
'maintenance'
'maintenance',
],

'guest_group' => [
'maintenance'
'maintenance',
],
];

Expand All @@ -84,6 +84,6 @@ class Kernel extends HttpKernel
'can' => Authorize::class,
'guest' => RedirectIfAuthenticated::class,
'throttle' => ThrottleRequests::class,
'maintenance' => CheckForMaintenanceMode::class
'maintenance' => CheckForMaintenanceMode::class,
];
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/CheckRestoreTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CheckRestoreTokenRequest extends Request
public function rules(): array
{
return [
'token' => 'required|string|exists:users,set_password_hash'
'token' => 'required|string|exists:users,set_password_hash',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/ForgotPasswordRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ForgotPasswordRequest extends Request
public function rules(): array
{
return [
'email' => 'required|string|email|exists:users,email'
'email' => 'required|string|email|exists:users,email',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/LoginRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function rules(): array
return [
'email' => 'required',
'password' => 'required',
'remember' => 'boolean'
'remember' => 'boolean',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/RefreshTokenRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RefreshTokenRequest extends Request
public function rules(): array
{
return [
'remember' => 'boolean'
'remember' => 'boolean',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/RegisterUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function rules(): array
'email' => 'required|string|email|unique:users,email',
'password' => 'required|string|same:confirm',
'confirm' => 'required|string',
'remember' => 'boolean'
'remember' => 'boolean',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/RestorePasswordRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function rules(): array
{
return [
'token' => 'required|string|exists:users,set_password_hash',
'password' => 'required|string'
'password' => 'required|string',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Setting/SearchSettingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function rules(): array
'all' => 'integer',
'query' => 'string|nullable',
'order_by' => 'string|in:name',
'desc' => 'boolean'
'desc' => 'boolean',
];
}
}
2 changes: 1 addition & 1 deletion app/Http/Requests/Users/UpdateUserRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function rules(): array
return [
'email' => "string|email|unique:users,email,{$this->route('id')}",
'name' => 'string',
'role_id' => 'integer|exists:roles,id'
'role_id' => 'integer|exists:roles,id',
];
}

Expand Down
4 changes: 2 additions & 2 deletions app/Models/Setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class Setting extends Model
protected $fillable = [
'name',
'value',
'is_public'
'is_public',
];
protected $hidden = ['pivot'];

protected $casts = [
'value' => 'array',
'name' => 'string',
'is_public' => 'boolean'
'is_public' => 'boolean',
];

public function scopeApplySettingPermissionRestrictions(Builder $query): void
Expand Down
8 changes: 4 additions & 4 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ class User extends Authenticatable implements JWTSubject
'email',
'password',
'role_id',
'set_password_hash_created_at'
'set_password_hash_created_at',
];

protected $guarded = [
'set_password_hash'
'set_password_hash',
];

protected $hidden = [
'password',
'remember_token',
'set_password_hash'
'set_password_hash',
];

protected $casts = [
'is_public' => 'boolean',
'set_password_hash_created_at' => 'datetime'
'set_password_hash_created_at' => 'datetime',
];

public function getJWTIdentifier(): int
Expand Down
2 changes: 1 addition & 1 deletion app/Modules/Media/Http/Requests/CreateMediaRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function rules(): array
return [
'file' => "file|required|max:5120|mimes:{$types}",
'meta' => 'array',
'is_public' => 'boolean'
'is_public' => 'boolean',
];
}
}
2 changes: 1 addition & 1 deletion app/Modules/Media/Http/Requests/SearchMediaRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function rules(): array
'query' => 'string',
'order_by' => 'string',
'desc' => 'boolean',
'name' => 'string'
'name' => 'string',
];
}
}
2 changes: 1 addition & 1 deletion app/Modules/Media/Models/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Media extends Model
'name',
'owner_id',
'is_public',
'meta'
'meta',
];

protected $casts = [
Expand Down
Loading

0 comments on commit e8a29b5

Please sign in to comment.