Skip to content

Commit

Permalink
Merge pull request #97 from RonasIT/dpankratov/refactoring
Browse files Browse the repository at this point in the history
chore: remove useless code
  • Loading branch information
astorozhevsky authored Oct 29, 2024
2 parents 41dbb05 + 9b1f717 commit e324968
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 40 deletions.
11 changes: 1 addition & 10 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Middleware;

use App\Providers\RouteServiceProvider;
use Closure;
use Illuminate\Support\Facades\Auth;

Expand All @@ -11,18 +10,10 @@
*/
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
return redirect('/status');
}

return $next($request);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/Users/DeleteProfileRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class DeleteProfileRequest extends Request
{
public function authorize(): bool
{
return $this->user()->isUser();
return !$this->user()->isAdmin();
}
}
6 changes: 0 additions & 6 deletions app/Http/Resources/User/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
namespace App\Http\Resources\User;

use App\Http\Resources\BaseJsonResource;
use Illuminate\Http\Response;

class UserResource extends BaseJsonResource
{
public function withResponse($request, $response): void
{
$response->setStatusCode(Response::HTTP_OK);
}

public function toArray($request): array
{
return [
Expand Down
10 changes: 0 additions & 10 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@

class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
{
/**
Expand Down Expand Up @@ -67,11 +62,6 @@ public function boot(): void
RouteFacade::macro('version', fn (VersionEnum $version) => RouteFacade::prefix('v' . $version->value));
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"php-open-source-saver/jwt-auth": "^2.7",
"psr/simple-cache": "^3.0",
"ronasit/laravel-helpers": "^3.0.0-beta",
"ronasit/laravel-swagger": "^3.0.1-beta",
"ronasit/laravel-swagger": "^3.0.2",
"spatie/laravel-google-cloud-storage": "^2.3",
"spatie/laravel-ignition": "^2.8",
"symfony/http-client": "^7.1.3",
Expand Down
17 changes: 8 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class DatabaseSeeder extends Seeder
{
public function run()
public function run(): void
{
$this->call(UserSeeder::class);
}
Expand Down
Empty file removed database/seeders/MediaSeeder.php
Empty file.
2 changes: 1 addition & 1 deletion database/seeders/UserSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class UserSeeder extends Seeder
{
public function run()
public function run(): void
{
factory(User::class)->create([
'role_id' => Role::USER,
Expand Down
2 changes: 1 addition & 1 deletion tests/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function testCreate()

$response = $this->actingAs(self::$admin)->json('post', '/users', $data);

$response->assertOk();
$response->assertCreated();

$this->assertEqualsFixture('user_created.json', $response->json());

Expand Down

0 comments on commit e324968

Please sign in to comment.