Skip to content

Commit

Permalink
Getting back into it.
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmrr committed Dec 26, 2023
1 parent 264ecb0 commit ff598cd
Show file tree
Hide file tree
Showing 95 changed files with 2,443 additions and 3,916 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/duster-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Duster Lint

on:
push:
branches: [ main ]
pull_request:

jobs:
duster:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: "Duster Lint"
uses: tighten/duster-action@v2
with:
args: lint
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"plugins": ["@prettier/plugin-php", "prettier-plugin-tailwindcss"],
"phpVersion": "8.2",
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"vueIndentScriptAndStyle": true,
"spaceBeforeFunctionParen": true
}
3 changes: 1 addition & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
Expand All @@ -34,7 +33,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/Auth/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use App\Http\Requests\Auth\LoginRequest;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

Expand All @@ -28,7 +27,6 @@ public function create()
/**
* Handle an incoming authentication request.
*
* @param \App\Http\Requests\Auth\LoginRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function store(LoginRequest $request)
Expand All @@ -43,12 +41,11 @@ public function store(LoginRequest $request)
/**
* Destroy an authenticated session.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Request $request)
{
Auth::guard('web')->logout();
auth()->guard('web')->logout();

$request->session()->invalidate();

Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Auth/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Inertia\Inertia;
use Inertia\Response;
Expand All @@ -19,7 +18,7 @@ public function show(): Response

public function store(Request $request): \Illuminate\Http\RedirectResponse
{
if (! Auth::guard('web')->validate([
if (! auth()->guard('web')->validate([
'email' => $request->user() ? $request->user()->email : '',
'password' => $request->password,
])) {
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Auth/NewPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class NewPasswordController extends Controller
/**
* Display the password reset view.
*
* @param \Illuminate\Http\Request $request
* @return \Inertia\Response
*/
public function create(Request $request)
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Auth/PasswordResetLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function create()
/**
* Handle an incoming password reset link request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*
* @throws \Illuminate\Validation\ValidationException
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Inertia\Inertia;
Expand Down Expand Up @@ -55,7 +54,7 @@ public function store(Request $request): RedirectResponse

event(new Registered($user));

Auth::login($user);
auth()->login($user);

return redirect(RouteServiceProvider::HOME);
}
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Controllers/Auth/VerifyEmailController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@ class VerifyEmailController extends Controller
/**
* Mark the authenticated user's email address as verified.
*
* @param \Illuminate\Foundation\Auth\EmailVerificationRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function __invoke(EmailVerificationRequest $request)
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}

if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}

return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
return redirect()->intended(RouteServiceProvider::HOME . '?verified=1');
}
}
16 changes: 8 additions & 8 deletions app/Http/Controllers/ConstructorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@

class ConstructorController extends Controller
{
public function adminIndex(): Response
{
$franchises = Franchise::all();

return Inertia::render('Admin/Constructors/Index')
->with(compact('franchises'));
}

public function index(Franchise $franchise): Response
{
$teams = Constructor::query()
Expand Down Expand Up @@ -116,4 +108,12 @@ public function destroy(Constructor $team)

return redirect()->route('admin.constructor.index');
}

public function adminIndex(): Response
{
$franchises = Franchise::all();

return Inertia::render('Admin/Constructors/Index')
->with(compact('franchises'));
}
}
55 changes: 27 additions & 28 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,15 @@
use App\Models\Result;
use App\Models\Track;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Inertia\Inertia;
use Inertia\Response;

class DashboardController extends Controller
{
public function adminIndex(): Response
{
$users = User::all()->count();
$franchises = Franchise::all()->count();
$drivers = Driver::all()->count();
$events = Event::all()->count();
$results = Result::all()->count();
$fantasyTeams = FantasyTeam::all()->count();
$tracks = Track::all()->count();
$leagues = League::all()->count();
$constructors = Constructor::all()->count();

return Inertia::render('Admin/Dashboard')
->with(compact(
'users',
'franchises',
'constructors',
'drivers',
'events',
'results',
'fantasyTeams',
'tracks',
'leagues'
));
}

public function index(): Response
{
$fantasy_teams = FantasyTeam::query()
->where('user_id', Auth::id())
->where('user_id', auth()->id())
->join('leagues', 'leagues.id', 'fantasy_teams.league_id')
->join('franchises', 'franchises.id', 'leagues.franchise_id')
->select(
Expand All @@ -60,4 +33,30 @@ public function index(): Response
return Inertia::render('Dashboard')
->with(compact('fantasy_teams'));
}

public function adminIndex(): Response
{
$users = User::all()->count();
$franchises = Franchise::all()->count();
$drivers = Driver::all()->count();
$events = Event::all()->count();
$results = Result::all()->count();
$fantasyTeams = FantasyTeam::all()->count();
$tracks = Track::all()->count();
$leagues = League::all()->count();
$constructors = Constructor::all()->count();

return Inertia::render('Admin/Dashboard')
->with(compact(
'users',
'franchises',
'constructors',
'drivers',
'events',
'results',
'fantasyTeams',
'tracks',
'leagues'
));
}
}
16 changes: 8 additions & 8 deletions app/Http/Controllers/DriverController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@

class DriverController extends Controller
{
public function adminIndex(): Response
{
$franchises = Franchise::all();

return Inertia::render('Admin/Drivers/Index')
->with(compact('franchises'));
}

public function index(Franchise $franchise): Response
{
$constructors = Constructor::query()
Expand Down Expand Up @@ -109,4 +101,12 @@ public function destroy(Driver $driver)

return Redirect(route('admin.driver.index'));
}

public function adminIndex(): Response
{
$franchises = Franchise::all();

return Inertia::render('Admin/Drivers/Index')
->with(compact('franchises'));
}
}
54 changes: 27 additions & 27 deletions app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@

class EventController extends Controller
{
public function adminIndex()
{
$franchises = Franchise::all();

return Inertia::render(
'Admin/Events/Index',
['franchises' => $franchises]
);
}

public function index(Franchise $franchise): Response
{
$events = Race::query()
Expand All @@ -35,68 +25,78 @@ public function index(Franchise $franchise): Response
return Inertia::render('Events/Index')
->with(compact('franchise', 'events'));
}

public function create(Franchise $franchise): Response
{
$franchises = Franchise::all();
$tracks = Track::all();

return Inertia::render('Admin/Events/Create')
->with(compact('franchises', 'tracks'));
}

public function store(Franchise $franchise, EventRequest $request): RedirectResponse
{
Event::create(
$request->validated()
);

return redirect(route('admin.events.index'));
}

public function show(Franchise $franchise, Event $event): Response
{
$event->load('track');

$results = Result::query()
->where('race_id', $event->id)
->with('driver')
->orderBy('finish_pos', 'ASC')
->orderBy('starting_pos', 'ASC')
->get();

return Inertia::render('Events/Show')
->with(compact(
'franchise',
'franchise',
'event',
'results'
));
}
public function edit(Event $event): Response

public function edit(Event $event): Response
{
$franchises = Franchise::get();
$tracks = Track::get();

return Inertia::render('Admin/Events/Edit')
->with(compact(
'franchises',
'tracks',
'tracks',
'event'
));
}

public function update(Event $event, EventRequest $request)
{
$event->update($request->validated());

return redirect(route('admin.events.index'));
}
public function destroy(Event $event)

public function destroy(Event $event)
{
$event->delete();

return redirect(route('admin.events.index'));
}

public function adminIndex()
{
$franchises = Franchise::all();

return Inertia::render(
'Admin/Events/Index',
['franchises' => $franchises]
);
}
}
Loading

0 comments on commit ff598cd

Please sign in to comment.