diff --git a/app/Console/Commands/CreateApiKey.php b/app/Console/Commands/CreateApiKey.php index f8a7340..d99ce09 100644 --- a/app/Console/Commands/CreateApiKey.php +++ b/app/Console/Commands/CreateApiKey.php @@ -44,6 +44,6 @@ public function handle() 'created_at' => now(), ]); - $this->comment('API key `' . $name . '` has been created with following token: `' . $secret . '`'); + $this->comment('API key `'.$name.'` has been created with following token: `'.$secret.'`'); } } diff --git a/app/Console/Commands/DatabaseCleanup.php b/app/Console/Commands/DatabaseCleanup.php index 5676b9c..37979e4 100644 --- a/app/Console/Commands/DatabaseCleanup.php +++ b/app/Console/Commands/DatabaseCleanup.php @@ -2,8 +2,8 @@ namespace App\Console\Commands; -use Illuminate\Console\Command; use App\Models\Event; +use Illuminate\Console\Command; class DatabaseCleanup extends Command { diff --git a/app/Console/Commands/EventsNotify.php b/app/Console/Commands/EventsNotify.php index 1c6a1e4..f2411c7 100644 --- a/app/Console/Commands/EventsNotify.php +++ b/app/Console/Commands/EventsNotify.php @@ -2,10 +2,10 @@ namespace App\Console\Commands; -use Illuminate\Console\Command; -use App\Models\Event; use App\Helpers\EventHelper; +use App\Models\Event; use Carbon\Carbon; +use Illuminate\Console\Command; class EventsNotify extends Command { @@ -36,9 +36,9 @@ public function handle() // Notify about upcoming events foreach ($events as $event) { - + $result = EventHelper::discordPost( - EventHelper::discordMention() . "\n:clock2: **".$event->title.'** is starting in two hours!', + EventHelper::discordMention()."\n:clock2: **".$event->title.'** is starting in two hours!', $event->title, $event->long_description, asset($event->image), @@ -47,14 +47,14 @@ public function handle() ); // Save the message as published - if($result) { + if ($result) { $event->published = true; $event->save(); } - $this->info('Notified about event: ' . $event->title); + $this->info('Notified about event: '.$event->title); } - $this->info('Notified about ' . $events->count() . ' upcoming events'); + $this->info('Notified about '.$events->count().' upcoming events'); } } diff --git a/app/Console/Commands/NotifyCleanup.php b/app/Console/Commands/NotifyCleanup.php index 93508b6..3749342 100644 --- a/app/Console/Commands/NotifyCleanup.php +++ b/app/Console/Commands/NotifyCleanup.php @@ -2,10 +2,9 @@ namespace App\Console\Commands; -use Illuminate\Console\Command; -use App\Models\Event; use App\Helpers\EventHelper; use App\Models\DiscordMessage; +use Illuminate\Console\Command; class EventsCleanup extends Command { @@ -35,11 +34,11 @@ public function handle() foreach ($messages as $message) { // Delete the message EventHelper::discordDelete($message->message_id); - $this->info('Cleaned up message: ' . $message->message_id); + $this->info('Cleaned up message: '.$message->message_id); } DiscordMessage::whereIn('message_id', $messages->pluck('message_id'))->delete(); - $this->info('Cleaned up ' . $messages->count() . ' past events'); + $this->info('Cleaned up '.$messages->count().' past events'); } } diff --git a/app/Exceptions/PolicyMethodMissingException.php b/app/Exceptions/PolicyMethodMissingException.php index f3d0f1c..0591c24 100644 --- a/app/Exceptions/PolicyMethodMissingException.php +++ b/app/Exceptions/PolicyMethodMissingException.php @@ -12,7 +12,8 @@ class PolicyMethodMissingException extends Exception * @param null $message * @param null $code */ - public function __construct($message = null, $code = null, ?Exception $exception = null) { + public function __construct($message = null, $code = null, ?Exception $exception = null) + { parent::__construct($message ?? 'The method does not exist in the policy.', 0, $exception); $this->code = $code ?: 0; diff --git a/app/Exceptions/PolicyMissingException.php b/app/Exceptions/PolicyMissingException.php index fc25e24..a320b69 100644 --- a/app/Exceptions/PolicyMissingException.php +++ b/app/Exceptions/PolicyMissingException.php @@ -12,7 +12,8 @@ class PolicyMissingException extends Exception * @param null $message * @param null $code */ - public function __construct($message = null, $code = null, ?Exception $exception) { + public function __construct($message, $code, ?Exception $exception) + { parent::__construct($message ?? 'A policy does not exist for this model.', 0, $exception); $this->code = $code ?: 0; diff --git a/app/Helpers/EventHelper.php b/app/Helpers/EventHelper.php index f684fcf..cb779fe 100644 --- a/app/Helpers/EventHelper.php +++ b/app/Helpers/EventHelper.php @@ -2,18 +2,18 @@ namespace App\Helpers; +use App\Models\DiscordMessage; use Carbon\Carbon; use Illuminate\Support\Facades\Http; -use App\Models\DiscordMessage; -enum EventHelper: string +enum EventHelper: string { case DAY = 'day'; case WEEK = 'week'; case MONTH = 'month'; case YEAR = 'year'; - public static function labels() : array + public static function labels(): array { return [ self::DAY->value => 'Daily', @@ -23,16 +23,16 @@ public static function labels() : array ]; } - public static function discordMention() : string + public static function discordMention(): string { - if(config('discord.mention_role') === null) { + if (config('discord.mention_role') === null) { return ''; } - return '<@&' . config('discord.mention_role') . '>'; + return '<@&'.config('discord.mention_role').'>'; } - public static function discordPost( string $text, string $title, string $content, string $image = null, Carbon $timestamp, Carbon $expireMessageAt = null) : bool + public static function discordPost(string $text, string $title, string $content, ?string $image, Carbon $timestamp, ?Carbon $expireMessageAt = null): bool { $webhookUrl = config('discord.webhook'); $payload = [ @@ -56,11 +56,11 @@ public static function discordPost( string $text, string $title, string $content ]; // Send the message to Discord - $response = Http::post($webhookUrl."?wait=true", $payload); + $response = Http::post($webhookUrl.'?wait=true', $payload); $messageId = $response->json()['id'] ?? null; // Save the message for expiration - if($messageId !== null && $expireMessageAt !== null) { + if ($messageId !== null && $expireMessageAt !== null) { DiscordMessage::create([ 'message_id' => $messageId, 'expires_at' => $expireMessageAt, @@ -70,9 +70,9 @@ public static function discordPost( string $text, string $title, string $content return $messageId !== null; } - public static function discordDelete(int $messageId) : void + public static function discordDelete(int $messageId): void { $webhookUrl = config('discord.webhook'); - Http::delete($webhookUrl . "/messages/{$messageId}"); + Http::delete($webhookUrl."/messages/{$messageId}"); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/API/CalendarController.php b/app/Http/Controllers/API/CalendarController.php index 9a0be05..b57e26d 100644 --- a/app/Http/Controllers/API/CalendarController.php +++ b/app/Http/Controllers/API/CalendarController.php @@ -14,6 +14,7 @@ class CalendarController extends Controller public function index() { $calendars = Calendar::all(); + return response()->json(['data' => $calendars->values()], 200); } @@ -25,7 +26,7 @@ public function store(Request $request) $request->validate([ 'name' => 'required|string|max:255', 'description' => 'nullable|string', - 'public' => 'required|boolean' + 'public' => 'required|boolean', ]); $calendar = Calendar::create([ @@ -45,7 +46,7 @@ public function store(Request $request) */ public function show(Calendar $calendar) { - return response()->json(['calendar' => $calendar,], 200); + return response()->json(['calendar' => $calendar], 200); } /** diff --git a/app/Http/Controllers/API/EventController.php b/app/Http/Controllers/API/EventController.php index 5634f49..1808e14 100644 --- a/app/Http/Controllers/API/EventController.php +++ b/app/Http/Controllers/API/EventController.php @@ -15,7 +15,7 @@ class EventController extends Controller /** * Display a listing of the resource. */ - public function index(Calendar $calendar) + public function index(Calendar $calendar) { $events = $calendar ->events() @@ -23,11 +23,11 @@ public function index(Calendar $calendar) ->orderBy('start_date', 'asc') ->get(); - // Set the full path on the image attribute and add a full url to event $events->transform(function ($event) { - $event->image = isset($event->image) ? asset('storage/banners/' . $event->image) : asset('images/tba.jpg'); + $event->image = isset($event->image) ? asset('storage/banners/'.$event->image) : asset('images/tba.jpg'); $event->link = route('events.show', $event->id); + return $event; }); @@ -37,7 +37,7 @@ public function index(Calendar $calendar) /** * Store a newly created resource in storage. */ - public function store(Request $request) + public function store(Request $request) { $data = $this->validate($request, [ 'calendar_id' => 'required|exists:calendars,id', @@ -61,19 +61,19 @@ public function store(Request $request) if ($request->hasFile('image')) { $image = $request->file('image'); - $imageName = now()->format('Y-m-d') . '-' . uniqid() . '.' . $image->getClientOriginalExtension(); - + $imageName = now()->format('Y-m-d').'-'.uniqid().'.'.$image->getClientOriginalExtension(); + // Get image dimensions - list($width, $height) = getimagesize($image->getPathName()); + [$width, $height] = getimagesize($image->getPathName()); if (round($width / $height, 2) != round(16 / 9, 2)) { return back()->withErrors(['image' => 'Image must be in 16:9 aspect ratio.'])->withInput(); } - + // Store the image $storedPath = $image->storeAs('banners', $imageName, 'public'); - + // Check if the image was successfully uploaded - if (!$storedPath && !Storage::disk('public')->exists($storedPath)) { + if (! $storedPath && ! Storage::disk('public')->exists($storedPath)) { return back()->withErrors(['image' => 'Failed to upload the image.'])->withInput(); } @@ -111,10 +111,10 @@ public function store(Request $request) /** * Display the specified resource. */ - public function show(Event $event) + public function show(Event $event) { // Set the full path on the image attribute and add a full url to event - $event->image = isset($event->image) ? asset('storage/banners/' . $event->image) : asset('images/tba.jpg'); + $event->image = isset($event->image) ? asset('storage/banners/'.$event->image) : asset('images/tba.jpg'); $event->link = route('events.show', $event->id); return response()->json(['event' => $event], 200); @@ -123,7 +123,7 @@ public function show(Event $event) /** * Update the specified resource in storage. */ - public function update(Request $request, Event $event) + public function update(Request $request, Event $event) { $data = $this->validate($request, [ 'calendar_id' => 'required|exists:calendars,id', @@ -148,29 +148,29 @@ public function update(Request $request, Event $event) if ($request->hasFile('image')) { $image = $request->file('image'); - $imageName = now()->format('Y-m-d') . '-' . uniqid() . '.' . $image->getClientOriginalExtension(); - + $imageName = now()->format('Y-m-d').'-'.uniqid().'.'.$image->getClientOriginalExtension(); + // Get image dimensions - list($width, $height) = getimagesize($image->getPathName()); + [$width, $height] = getimagesize($image->getPathName()); if (round($width / $height, 2) != round(16 / 9, 2)) { return back()->withErrors(['image' => 'Image must be in 16:9 aspect ratio.']); } - + // Delete the old image if it exists if ($event->image) { - Storage::disk('public')->delete('banners/' . $event->image); + Storage::disk('public')->delete('banners/'.$event->image); } - + // Store the new image $image->storeAs('banners', $imageName, 'public'); - + // Check if the image was successfully uploaded - if (!Storage::disk('public')->exists('banners/' . $imageName)) { + if (! Storage::disk('public')->exists('banners/'.$imageName)) { return back()->withErrors(['image' => 'Failed to upload the image.']); } - $imageURL = asset('storage/banners/' . $imageName); - + $imageURL = asset('storage/banners/'.$imageName); + $event->image = $imageURL; } @@ -180,7 +180,7 @@ public function update(Request $request, Event $event) 'short_description' => $request->input('short_description'), 'long_description' => $request->input('long_description'), 'start_date' => Carbon::parse($request->input('start_date'))->format('Y-m-d H:i'), - 'end_date' => Carbon::parse($request->input('end_date'))->format('Y-m-d H:i'), + 'end_date' => Carbon::parse($request->input('end_date'))->format('Y-m-d H:i'), 'recurrence_interval' => $request->input('event_type') == '0' ? null : $request->input('recurrence_interval'), 'recurrence_unit' => $request->input('event_type') == '0' ? null : $request->input('recurrence_unit'), 'recurrence_end_date' => $request->input('event_type') == '0' ? null : $request->input('recurrence_end_date'), @@ -211,16 +211,16 @@ public function update(Request $request, Event $event) /** * Remove the specified resource from storage. */ - public function destroy(Event $event) + public function destroy(Event $event) { // Delete the old image if it exists if ($event->image && $event->parent_id === null) { - Storage::disk('public')->delete('banners/' . $event->image); + Storage::disk('public')->delete('banners/'.$event->image); } // Delete the event and any of its children $event->children()->delete(); - + $event->delete(); return response()->json([ diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index e1650cc..4f6e409 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -53,7 +53,7 @@ public function __construct() */ public function login(Request $request) { - if (!$request->has('code') || !$request->has('state')) { + if (! $request->has('code') || ! $request->has('state')) { $authorizationUrl = $this->provider->getAuthorizationUrl([ 'required_scopes' => implode(' ', config('oauth.scopes')), 'scope' => implode(' ', config('oauth.scopes')), @@ -81,17 +81,17 @@ protected function verifyLogin(Request $request) 'code' => $request->input('code'), ]); } catch (IdentityProviderException $e) { - return redirect()->route('home')->withError('Authentication error: ' . $e->getMessage()); + return redirect()->route('home')->withError('Authentication error: '.$e->getMessage()); } $resourceOwner = json_decode(json_encode($this->provider->getResourceOwner($accessToken)->toArray())); $data = OAuthController::mapOAuthProperties($resourceOwner); if ( - !$data['id'] || - !$data['email'] || - !$data['first_name'] || - !$data['last_name'] + ! $data['id'] || + ! $data['email'] || + ! $data['first_name'] || + ! $data['last_name'] ) { return redirect()->route('home')->withError('Missing data from sign-in request. You need to grant all permissions.'); } diff --git a/app/Http/Controllers/CalendarController.php b/app/Http/Controllers/CalendarController.php index e531100..13dc023 100644 --- a/app/Http/Controllers/CalendarController.php +++ b/app/Http/Controllers/CalendarController.php @@ -35,17 +35,17 @@ public function create() public function store(Request $request) { $this->authorize('create', Calendar::class); - + $request->validate([ 'name' => 'required|string|max:255', 'description' => 'nullable|string', - 'public' => 'nullable|boolean' + 'public' => 'nullable|boolean', ]); Calendar::create([ 'name' => $request->input('name'), 'description' => $request->input('description'), - 'public' => $request->input('public') + 'public' => $request->input('public'), ]); return redirect()->route('calendars.index')->withSuccess('Calendar has been created successfully'); @@ -59,7 +59,7 @@ public function show(Calendar $calendar) $this->authorize('view', $calendar); $allEvents = $calendar->events()->get(); - $events = $allEvents->map(function ($event){ + $events = $allEvents->map(function ($event) { return [ 'id' => $event->id, 'title' => $event->title, diff --git a/app/Http/Controllers/EventController.php b/app/Http/Controllers/EventController.php index d76e038..5d94d45 100644 --- a/app/Http/Controllers/EventController.php +++ b/app/Http/Controllers/EventController.php @@ -2,15 +2,12 @@ namespace App\Http\Controllers; +use App\Helpers\EventHelper; use App\Models\Calendar; use App\Models\Event; use Carbon\Carbon; use Illuminate\Http\Request; -use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Facades\File; -use App\Helpers\EventHelper; - class EventController extends Controller { @@ -22,7 +19,7 @@ public function index() $this->authorize('index', Event::class); $events = Event::orderBy('start_date', 'ASC')->get(); - + return view('events.index', compact('events')); } @@ -63,19 +60,19 @@ public function store(Request $request) if ($request->hasFile('image')) { $image = $request->file('image'); - $imageName = now()->format('Y-m-d') . '-' . uniqid() . '.' . $image->getClientOriginalExtension(); - + $imageName = now()->format('Y-m-d').'-'.uniqid().'.'.$image->getClientOriginalExtension(); + // Get image dimensions - list($width, $height) = getimagesize($image->getPathName()); + [$width, $height] = getimagesize($image->getPathName()); if (round($width / $height, 2) != round(16 / 9, 2)) { return back()->withErrors(['image' => 'Image must be in 16:9 aspect ratio.'])->withInput(); } - + // Store the image $storedPath = $image->storeAs('banners', $imageName, 'public'); - + // Check if the image was successfully uploaded - if (!$storedPath && !Storage::disk('public')->exists($storedPath)) { + if (! $storedPath && ! Storage::disk('public')->exists($storedPath)) { return back()->withErrors(['image' => 'Failed to upload the image.'])->withInput(); } @@ -101,7 +98,7 @@ public function store(Request $request) // Post to Discord EventHelper::discordPost( - ':calendar_spiral: A new event has been scheduled.', + ':calendar_spiral: A new event has been scheduled.', $event->title, $event->long_description, asset($event->image), @@ -165,24 +162,24 @@ public function update(Request $request, Event $event) if ($request->hasFile('image')) { $image = $request->file('image'); - $imageName = now()->format('Y-m-d') . '-' . uniqid() . '.' . $image->getClientOriginalExtension(); - + $imageName = now()->format('Y-m-d').'-'.uniqid().'.'.$image->getClientOriginalExtension(); + // Get image dimensions - list($width, $height) = getimagesize($image->getPathName()); + [$width, $height] = getimagesize($image->getPathName()); if (round($width / $height, 2) != round(16 / 9, 2)) { return back()->withErrors(['image' => 'Image must be in 16:9 aspect ratio.']); } - + // Delete the old image if it exists if ($event->image) { - Storage::disk('public')->delete('banners/' . $event->image); + Storage::disk('public')->delete('banners/'.$event->image); } - + // Store the new image $image->storeAs('banners', $imageName, 'public'); - + // Check if the image was successfully uploaded - if (!Storage::disk('public')->exists('banners/' . $imageName)) { + if (! Storage::disk('public')->exists('banners/'.$imageName)) { return back()->withErrors(['image' => 'Failed to upload the image.']); } } @@ -193,7 +190,7 @@ public function update(Request $request, Event $event) 'short_description' => $request->input('short_description'), 'long_description' => $request->input('long_description'), 'start_date' => Carbon::parse($request->input('start_date'))->format('Y-m-d H:i'), - 'end_date' => Carbon::parse($request->input('end_date'))->format('Y-m-d H:i'), + 'end_date' => Carbon::parse($request->input('end_date'))->format('Y-m-d H:i'), 'recurrence_interval' => $request->input('event_type') == '0' ? null : $request->input('recurrence_interval'), 'recurrence_unit' => $request->input('event_type') == '0' ? null : $request->input('recurrence_unit'), 'recurrence_end_date' => $request->input('event_type') == '0' ? null : $request->input('recurrence_end_date'), @@ -227,7 +224,7 @@ public function destroy(Event $event) // Delete the old image if it exists if ($event->image && $event->parent_id === null) { - Storage::disk('public')->delete('banners/' . $event->image); + Storage::disk('public')->delete('banners/'.$event->image); } // Delete the event and any of its children diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 94d49c8..31d0f52 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -17,7 +17,7 @@ public function index() { // Get events with start date today and the connected Calendar is public $upcomingEvents = Event::where('start_date', '>=', Carbon::today()) - ->whereHas('calendar', function($query) { + ->whereHas('calendar', function ($query) { $query->where('public', 1); }) ->orderBy('start_date', 'asc') @@ -26,9 +26,9 @@ public function index() $calendar = Calendar::where('public', 1)->first(); - if($calendar) { + if ($calendar) { $allEvents = $calendar->events()->get(); - $events = $allEvents->map(function ($event){ + $events = $allEvents->map(function ($event) { return [ 'id' => $event->id, 'title' => $event->title, @@ -40,7 +40,6 @@ public function index() } else { $events = collect(); } - return view('home', compact('upcomingEvents', 'events', 'calendar')); } diff --git a/app/Http/Controllers/OAuthController.php b/app/Http/Controllers/OAuthController.php index b4eef21..bbdb0c9 100644 --- a/app/Http/Controllers/OAuthController.php +++ b/app/Http/Controllers/OAuthController.php @@ -2,8 +2,8 @@ namespace App\Http\Controllers; -use League\OAuth2\Client\Provider\GenericProvider; use League\OAuth2\Client\Provider\Exception\IdentityProviderException; +use League\OAuth2\Client\Provider\GenericProvider; class OAuthController extends GenericProvider { @@ -21,16 +21,17 @@ public function __construct() 'clientId' => config('oauth.id'), 'clientSecret' => config('oauth.secret'), 'redirectUri' => route('login'), - 'urlAuthorize' => config('oauth.base') . '/oauth/authorize', - 'urlAccessToken' => config('oauth.base') . '/oauth/token', - 'urlResourceOwnerDetails' => config('oauth.base') . '/api/user', + 'urlAuthorize' => config('oauth.base').'/oauth/authorize', + 'urlAccessToken' => config('oauth.base').'/oauth/token', + 'urlResourceOwnerDetails' => config('oauth.base').'/api/user', 'scopes' => config('scopes'), ]); } /** * Gets an (updated) user token - * @param Token $token + * + * @param Token $token * @return Token * @return null */ diff --git a/app/Http/Controllers/StaffingController.php b/app/Http/Controllers/StaffingController.php index b83de79..39a9c3b 100644 --- a/app/Http/Controllers/StaffingController.php +++ b/app/Http/Controllers/StaffingController.php @@ -16,6 +16,7 @@ class StaffingController extends Controller public function index() { $staffings = Staffing::all(); + return view('staffing.index', compact('staffings')); } @@ -27,8 +28,8 @@ public function create() $client = Http::withHeaders([ 'Accept' => 'application/json', ]) - ->withBasicAuth(Config::get('custom.forum_api_secret'), ''); - + ->withBasicAuth(Config::get('custom.forum_api_secret'), ''); + $allData = []; // Initialize an empty array to store the combined results for ($currentPage = 1; $currentPage <= 2; $currentPage++) { @@ -39,12 +40,12 @@ public function create() 'calendars' => Config::get('custom.forum_calendar_type'), 'page' => $currentPage, ]); - + $currentData = $response->json('results'); - + // Filter out data where the "recurrence" property is null $filteredData = array_filter($currentData, function ($item) { - return !empty($item['recurrence']); + return ! empty($item['recurrence']); }); // Check for duplicate titles and select the newest entry for each unique title @@ -54,7 +55,7 @@ public function create() // If a newer entry with the same title is found, replace the existing entry if (isset($allData[$title]) && strtotime($item['start']) > strtotime($allData[$title]['start'])) { $allData[$title] = $item; - } elseif (!isset($allData[$title])) { + } elseif (! isset($allData[$title])) { $allData[$title] = $item; } elseif (Staffing::find($item['id'])) { unset($allData[$title]); @@ -67,14 +68,15 @@ public function create() return view('staffing.create', compact('allData', 'channels')); } - protected function getGuildChannels() { + protected function getGuildChannels() + { try { $response = Http::withHeaders([ - 'Authorization' => 'Bot ' . Config::get('custom.discord_bot_token'), + 'Authorization' => 'Bot '.Config::get('custom.discord_bot_token'), 'Content-Type' => 'application/json', - ])->get('https://discord.com/api/v10/guilds/' . Config::get('custom.discord_guild_id') . '/channels'); + ])->get('https://discord.com/api/v10/guilds/'.Config::get('custom.discord_guild_id').'/channels'); - if($response->successful()) { + if ($response->successful()) { $channelsData = $response->json(); // Filter channels where 'type' is equal to 0 @@ -87,10 +89,10 @@ protected function getGuildChannels() { return $filteredChannels; } else { - return "Error: Unable to fetch guild channels. HTTP status code: " . $response->status(); + return 'Error: Unable to fetch guild channels. HTTP status code: '.$response->status(); } } catch (\Exception $e) { - return 'Error: '. $e->getMessage(); + return 'Error: '.$e->getMessage(); } } @@ -118,28 +120,30 @@ public function store(Request $request) // 'title' => $eventData->title, // 'date' => $this->getDate($eventData->start), // ]) - + var_dump($this->getDate($eventData->start)); } - protected function getEvent($id) { + protected function getEvent($id) + { try { $response = Http::withHeaders([ 'Accept' => 'application/json', ]) - ->withBasicAuth(Config::get('custom.forum_api_secret'), '') - ->get(Config::get('custom.forum_api_url') . '/' . $id); - + ->withBasicAuth(Config::get('custom.forum_api_secret'), '') + ->get(Config::get('custom.forum_api_url').'/'.$id); + if ($response->successful()) { return $response->json(); } } catch (\Exception $e) { return 'Error: '.$e->getMessage(); } - + } - protected function getDate($date) { + protected function getDate($date) + { $carbonDate = Carbon::parse($date); $dayofweek = $carbonDate->dayOfWeek->format('l'); diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 9525ae0..7cea0ff 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -4,7 +4,6 @@ use App\Models\Group; use App\Models\User; -use Carbon\Carbon; use Illuminate\Http\Request; class UserController extends Controller @@ -31,7 +30,7 @@ public function show(User $user) $events = $user->events() ->orderBy('start_date', 'asc') ->get() - ->filter(function($event) { + ->filter(function ($event) { return \Auth::user()->can('view', $event); }); diff --git a/app/Http/Middleware/ApiToken.php b/app/Http/Middleware/ApiToken.php index 38b576b..a1e1b44 100644 --- a/app/Http/Middleware/ApiToken.php +++ b/app/Http/Middleware/ApiToken.php @@ -18,11 +18,11 @@ public function handle(Request $request, Closure $next, $args = ''): Response { $key = ApiKey::find($request->bearerToken()); - if($key === null || ($args == 'edit' && $key->readonly == true)) - { + if ($key === null || ($args == 'edit' && $key->readonly == true)) { // Exception for open calendar fetch if (preg_match('/^\/api\/calendars\/\d+\/events$/', $request->getRequestUri())) { $request->attributes->set('unauthenticated', true); + return $next($request); } else { return response()->json([ @@ -32,7 +32,7 @@ public function handle(Request $request, Closure $next, $args = ''): Response } $key->update(['last_used_at', now()]); - + return $next($request); } } diff --git a/app/Models/ApiKey.php b/app/Models/ApiKey.php index fd0df7c..ebc92c6 100644 --- a/app/Models/ApiKey.php +++ b/app/Models/ApiKey.php @@ -14,10 +14,10 @@ class ApiKey extends Model public $incrementing = false; public $fillable = [ - 'id', - 'name', + 'id', + 'name', 'last_used_at', 'readonly', - 'created_at' + 'created_at', ]; } diff --git a/app/Models/Calendar.php b/app/Models/Calendar.php index 1f6b77e..2f7e213 100644 --- a/app/Models/Calendar.php +++ b/app/Models/Calendar.php @@ -15,7 +15,7 @@ class Calendar extends Model 'public', ]; - public function events() + public function events() { return $this->hasMany(Event::class); } diff --git a/app/Models/Event.php b/app/Models/Event.php index 21b58a6..71cc886 100644 --- a/app/Models/Event.php +++ b/app/Models/Event.php @@ -29,7 +29,7 @@ class Event extends Model 'recurrence_end_date', 'published', 'image', - 'user_id' + 'user_id', ]; protected $dates = [ @@ -42,17 +42,17 @@ public function user() return $this->belongsTo(User::class); } - public function calendar() + public function calendar() { return $this->belongsTo(Calendar::class); } - public function children() + public function children() { return $this->hasMany(Event::class, 'parent_id'); } - public function parent() + public function parent() { return $this->belongsTo(Event::class, 'parent_id'); } @@ -118,7 +118,7 @@ public function generateRecurrences() 'recurrence_unit' => $this->recurrence_unit, 'recurrence_end_date' => $this->recurrence_end_date, 'image' => $this->image, - 'user_id' => $this->user_id + 'user_id' => $this->user_id, ]); // Move to the next recurrence date diff --git a/app/Models/Staffing.php b/app/Models/Staffing.php index b8aaa21..3f8975f 100644 --- a/app/Models/Staffing.php +++ b/app/Models/Staffing.php @@ -15,7 +15,6 @@ class Staffing extends Model * @var array */ protected $fillable = [ - 'id', 'title', 'date', 'description', 'channel_id', 'message_id', 'week_int', 'section_1_title', 'section_2_title', 'section_3_title', 'section_4_title', 'restrict_bookings' + 'id', 'title', 'date', 'description', 'channel_id', 'message_id', 'week_int', 'section_1_title', 'section_2_title', 'section_3_title', 'section_4_title', 'restrict_bookings', ]; - } diff --git a/app/Models/User.php b/app/Models/User.php index d285e63..717bf1e 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -30,9 +30,9 @@ class User extends Authenticatable ]; public $timestamps = false; - + protected $dates = [ - 'last_login' + 'last_login', ]; /** @@ -69,19 +69,19 @@ public function getNameAttribute() * * @return bool */ - public function isModerator() + public function isModerator() { return $this->groups->where('id', 2)->isNotEmpty(); } /** * Return if user is a moderator or above - * + * * @return bool */ - public function isModeratorOrAbove() + public function isModeratorOrAbove() { - return $this->groups->where('id', '<=', 2)->isNotEmpty();; + return $this->groups->where('id', '<=', 2)->isNotEmpty(); } /** @@ -89,7 +89,7 @@ public function isModeratorOrAbove() * * @return bool */ - public function isAdmin() + public function isAdmin() { return $this->groups->contains('id', 1); } diff --git a/app/Policies/CalendarPolicy.php b/app/Policies/CalendarPolicy.php index 4697853..0007885 100644 --- a/app/Policies/CalendarPolicy.php +++ b/app/Policies/CalendarPolicy.php @@ -10,27 +10,27 @@ class CalendarPolicy { use HandlesAuthorization; - public function index(User $user) + public function index(User $user) { return $user->isAdmin(); } - public function view(?User $user, Calendar $calendar) + public function view(?User $user, Calendar $calendar) { return ($user && $user->isModeratorOrAbove()) || $calendar->public; } - public function create(User $user) + public function create(User $user) { - return $user->isAdmin(); + return $user->isAdmin(); } - public function update(User $user, Calendar $calendar) + public function update(User $user, Calendar $calendar) { return $user->isAdmin(); } - public function destroy(User $user, Calendar $calendar) + public function destroy(User $user, Calendar $calendar) { return $user->isAdmin(); } diff --git a/app/Policies/EventPolicy.php b/app/Policies/EventPolicy.php index c9c5f33..c39b412 100644 --- a/app/Policies/EventPolicy.php +++ b/app/Policies/EventPolicy.php @@ -20,12 +20,12 @@ public function view(?User $user, Event $event) return $user && ($user->isModeratorOrAbove() || $user->isModerator() || $user->is($event->user)) || $event->calendar->public; } - public function create(User $user) + public function create(User $user) { return $user->isModeratorOrAbove(); } - public function update(User $user, Event $event) + public function update(User $user, Event $event) { return $user->isModerator() || $user->isAdmin(); } diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index a9bc88a..37a1de2 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -2,7 +2,6 @@ namespace App\Policies; -use App\Models\Group; use App\Models\User; use Illuminate\Auth\Access\HandlesAuthorization; @@ -10,22 +9,22 @@ class UserPolicy { use HandlesAuthorization; - public function index(User $user) + public function index(User $user) { return $user->isAdmin(); } - public function view(User $user, User $model) + public function view(User $user, User $model) { return $user->isAdmin() || ($user->is($model) && $user->isModeratorOrAbove()); } - public function viewAccess(User $user) + public function viewAccess(User $user) { return $user->isAdmin(); } - public function update(User $user, User $model) + public function update(User $user, User $model) { return $user->isAdmin(); } diff --git a/config/custom.php b/config/custom.php index 9dc83c4..ac868ae 100644 --- a/config/custom.php +++ b/config/custom.php @@ -9,4 +9,4 @@ */ 'discord_bot_token' => env('DISCORD_BOT_TOKEN', null), 'discord_guild_id' => env('DISCORD_GUILD_ID', null), -]; \ No newline at end of file +]; diff --git a/config/discord.php b/config/discord.php index 2f69548..ecb0a29 100644 --- a/config/discord.php +++ b/config/discord.php @@ -1,8 +1,5 @@ [ 'block_separator' => "\n", 'inner_separator' => "\n", - 'soft_break' => "\n", + 'soft_break' => "\n", ], /* @@ -88,10 +88,10 @@ */ 'commonmark' => [ - 'enable_em' => true, - 'enable_strong' => true, - 'use_asterisk' => true, - 'use_underscore' => true, + 'enable_em' => true, + 'enable_strong' => true, + 'use_asterisk' => true, + 'use_underscore' => true, 'unordered_list_markers' => ['-', '+', '*'], ], @@ -150,7 +150,7 @@ 'slug_normalizer' => [ 'max_length' => 255, - 'unique' => 'document', + 'unique' => 'document', ], ]; diff --git a/config/oauth.php b/config/oauth.php index 9c9d225..d8b03eb 100644 --- a/config/oauth.php +++ b/config/oauth.php @@ -32,4 +32,4 @@ 'mapping_first_name' => env('OAUTH_MAPPING_FIRSTNAME', 'data-personal-name_first'), 'mapping_last_name' => env('OAUTH_MAPPING_LASTNAME', 'data-personal-name_last'), -]; \ No newline at end of file +]; diff --git a/database/factories/ApiKeyFactory.php b/database/factories/ApiKeyFactory.php index 38dd217..e6336da 100644 --- a/database/factories/ApiKeyFactory.php +++ b/database/factories/ApiKeyFactory.php @@ -19,7 +19,7 @@ public function definition(): array return [ 'id' => fake()->uuid(), 'name' => fake()->sentence(1), - 'readonly' => rand(0,1), + 'readonly' => rand(0, 1), ]; } } diff --git a/database/factories/StaffingFactory.php b/database/factories/StaffingFactory.php index 863b17d..090c314 100644 --- a/database/factories/StaffingFactory.php +++ b/database/factories/StaffingFactory.php @@ -31,13 +31,14 @@ public function definition(): array ]; } - function ranNumbers() { + public function ranNumbers() + { $random_17_digits = mt_rand(1e16, 1e17 - 1); $random_two_digits = str_pad(mt_rand(0, 99), 2, '0', STR_PAD_LEFT); - $random_19_digits = $random_17_digits . $random_two_digits; + $random_19_digits = $random_17_digits.$random_two_digits; // If you need to use it as an integer, you can cast it to an integer - return (int)$random_19_digits; + return (int) $random_19_digits; } } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index d44699a..374fe5c 100755 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -3,7 +3,6 @@ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; -use Illuminate\Support\Str; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> @@ -21,7 +20,7 @@ public function definition(): array 'first_name' => fake()->firstName(), 'last_name' => fake()->lastName(), 'email' => fake()->unique()->safeEmail(), - 'last_login' => now() + 'last_login' => now(), ]; } diff --git a/database/seeders/APIKeySeeder.php b/database/seeders/APIKeySeeder.php index 8e4c96f..4b82f67 100644 --- a/database/seeders/APIKeySeeder.php +++ b/database/seeders/APIKeySeeder.php @@ -3,7 +3,6 @@ namespace Database\Seeders; use App\Models\ApiKey; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class APIKeySeeder extends Seeder @@ -17,7 +16,7 @@ public function run(): void 'id' => '51a64a9a-a243-4317-b1ac-080952b2ca05', 'name' => 'Event', 'readonly' => false, - 'created_at' => now() + 'created_at' => now(), ]); } } diff --git a/database/seeders/CalendarSeeder.php b/database/seeders/CalendarSeeder.php index f7f8b68..3e5a15b 100644 --- a/database/seeders/CalendarSeeder.php +++ b/database/seeders/CalendarSeeder.php @@ -3,7 +3,6 @@ namespace Database\Seeders; use App\Models\Calendar; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class CalendarSeeder extends Seeder diff --git a/database/seeders/EventSeeder.php b/database/seeders/EventSeeder.php index e5319f9..c451dfa 100644 --- a/database/seeders/EventSeeder.php +++ b/database/seeders/EventSeeder.php @@ -16,7 +16,7 @@ public function run(): void // Create Normal Events Event::factory()->count(5)->create([ - 'calendar_id' => rand(1,2), + 'calendar_id' => rand(1, 2), ])->each(function ($event) { $event->user()->associate(User::whereHas('groups')->inRandomOrder()->first()->id); $event->save(); @@ -24,7 +24,7 @@ public function run(): void // Create Recurring Events Event::factory()->count(3)->create([ - 'calendar_id' => rand(1,2), + 'calendar_id' => rand(1, 2), 'recurrence_interval' => 1, // Example: every 1 week 'recurrence_unit' => 'week', 'recurrence_end_date' => now()->addWeeks(5)->format('Y-m-d H:i:s'), diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 0d58792..41e031f 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -4,7 +4,6 @@ use App\Models\Group; use App\Models\User; -use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class UserSeeder extends Seeder @@ -16,13 +15,13 @@ public function run(): void { $groups = Group::all(); - for($i = 1; $i <= 11; $i++) { + for ($i = 1; $i <= 11; $i++) { $first_name = 'Web'; $last_name = 'X'; - $email = 'auth.dev' . $i .'@vatsim.net'; + $email = 'auth.dev'.$i.'@vatsim.net'; $group = null; - switch($i) { + switch ($i) { case 1: $last_name = 'One'; break; @@ -67,13 +66,13 @@ public function run(): void 'id' => 10000000 + $i, 'email' => $email, 'first_name' => $first_name, - 'last_name' => $last_name + 'last_name' => $last_name, ]); // Assign groups randomly, or specific group for user 10 if ($i == 10) { $user->groups()->attach(Group::find($group)); - } else if ($i !== 11) { + } elseif ($i !== 11) { $randomGroup = $groups->random(rand(0, $groups->count()))->pluck('id')->toArray(); $user->groups()->attach($randomGroup); } diff --git a/routes/api.php b/routes/api.php index bc94a1f..ae3fb11 100755 --- a/routes/api.php +++ b/routes/api.php @@ -18,7 +18,7 @@ // return $request->user(); // }); -Route::group(['middleware' => ['api-token:edit']], function() { +Route::group(['middleware' => ['api-token:edit']], function () { // Calendars Route::post('/calendars', [App\Http\Controllers\API\CalendarController::class, 'store'])->name('api.calendars.store'); Route::patch('/calendars/{calendar}', [App\Http\Controllers\API\CalendarController::class, 'update'])->name('api.calendars.update'); @@ -30,11 +30,11 @@ Route::delete('/events/{event}', [App\Http\Controllers\API\EventController::class, 'destroy'])->name('api.event.destroy'); }); -Route::group(['middleware' => ['api-token']], function() { +Route::group(['middleware' => ['api-token']], function () { // Calendars Route::get('/calendars', [App\Http\Controllers\API\CalendarController::class, 'index'])->name('api.calendars.index'); Route::get('/calendars/{calendar}', [App\Http\Controllers\API\CalendarController::class, 'show'])->name('api.calendars.show'); - + // Events Route::get('/calendars/{calendar}/events', [App\Http\Controllers\API\EventController::class, 'index'])->name('api.event.index'); Route::get('/events/{event}', [App\Http\Controllers\API\EventController::class, 'show'])->name('api.event.show'); diff --git a/routes/web.php b/routes/web.php index 11e1b09..ca2ef94 100755 --- a/routes/web.php +++ b/routes/web.php @@ -3,8 +3,8 @@ use App\Http\Controllers\Auth\LoginController; use App\Http\Controllers\CalendarController; use App\Http\Controllers\EventController; -use App\Http\Controllers\UserController; use App\Http\Controllers\HomeController; +use App\Http\Controllers\UserController; use Illuminate\Support\Facades\Route; /* @@ -30,12 +30,11 @@ Route::get('/validate', [LoginController::class, 'validateLogin'])->middleware('guest'); Route::get('/logout', [LoginController::class, 'logout'])->middleware('auth')->name('logout'); - // Auth::routes(); -Route::middleware(['auth'])->group(function() { +Route::middleware(['auth'])->group(function () { - Route::controller(CalendarController::class)->group(function() { + Route::controller(CalendarController::class)->group(function () { Route::get('/calendars', 'index')->name('calendars.index'); Route::get('/calendars/create', 'create')->name('calendars.create'); Route::get('/calendars/edit/{calendar}', 'edit')->name('calendars.edit'); @@ -44,7 +43,7 @@ Route::delete('/calendars', 'destroy')->name('calendars.destroy'); }); - Route::controller(EventController::class)->group(function() { + Route::controller(EventController::class)->group(function () { Route::get('/events', 'index')->name('events.index'); Route::get('/events/create', 'create')->name('events.create'); Route::get('/events/{event}/edit', 'edit')->name('events.edit'); @@ -53,7 +52,7 @@ Route::delete('/events/{event}', 'destroy')->name('events.destroy'); }); - Route::controller(UserController::class)->group(function() { + Route::controller(UserController::class)->group(function () { Route::get('/users', 'index')->name('users.index'); Route::get('/users/{user}', 'show')->name('users.show'); Route::patch('/users/{user}', 'update')->name('users.update'); @@ -65,7 +64,7 @@ // Route::post('/staffings/store', [App\Http\Controllers\StaffingController::class, 'store'])->name('staffings.store'); // Route::patch('/staffings/edit/{staffing}', [App\Http\Controllers\StaffingController::class, 'update'])->name('staffings.update'); // Route::delete('/staffings/delete/{staffing}', [App\Http\Controllers\StaffingController::class, 'delete'])->name('staffings.delete'); - + }); Route::get('/events/{event}', [EventController::class, 'show'])->name('events.show'); diff --git a/tests/Feature/Misc/APITest.php b/tests/Feature/Misc/APITest.php index 377854a..c7b88df 100644 --- a/tests/Feature/Misc/APITest.php +++ b/tests/Feature/Misc/APITest.php @@ -3,7 +3,6 @@ namespace Tests\Feature\Misc; use App\Models\ApiKey; -use App\Models\Calendar; use App\Models\Event; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; @@ -12,8 +11,8 @@ class APITest extends TestCase { - use WithFaker, RefreshDatabase; - + use RefreshDatabase, WithFaker; + /** * Test a system administrator can create an API key with readonly rights. */ @@ -69,11 +68,11 @@ public function test_events_can_be_recieved_from_the_api() // Send a GET request to the API endpoint with the bearer token in the headers $response = $this->withHeaders([ - 'Authorization' => 'Bearer ' . $api->id, - 'Accept' => 'application/json' + 'Authorization' => 'Bearer '.$api->id, + 'Accept' => 'application/json', ])->get(route('api.event.index', $event->calendar)); - // Assert that the response status is 200 (OK) + // Assert that the response status is 200 (OK) $response->assertStatus(200); // Assert that the response JSON structure contains the expected keys diff --git a/tests/Feature/Models/CalendarTest.php b/tests/Feature/Models/CalendarTest.php index 450cfa3..de7455b 100644 --- a/tests/Feature/Models/CalendarTest.php +++ b/tests/Feature/Models/CalendarTest.php @@ -10,7 +10,7 @@ class CalendarTest extends TestCase { - use WithFaker, RefreshDatabase; + use RefreshDatabase, WithFaker; /** * A calendars page can be rendered. @@ -45,7 +45,7 @@ public function test_calendars_page_cannot_be_rendered_without_correct_permissio /** * A calendars create page can be rendered. */ - public function test_calendars_create_page_can_be_rendered(): void + public function test_calendars_create_page_can_be_rendered(): void { // Setup user with permissions $user = $this->getUser(); @@ -75,12 +75,11 @@ public function test_calendars_create_page_cannot_be_rendered_without_correct_pe /** * A calendars edit page can be rendered. */ - public function test_calendars_edit_page_can_be_rendered(): void + public function test_calendars_edit_page_can_be_rendered(): void { // Setup user with permissions $user = $this->getUser(); - // Create a test calendar $calendar = Calendar::factory()->create(); @@ -112,11 +111,11 @@ public function test_calendars_edit_page_cannot_be_rendered_without_correct_perm /** * A calendar page can be rendered. */ - public function test_calendar_page_can_be_rendered(): void + public function test_calendar_page_can_be_rendered(): void { // Setup user with permissions $user = $this->getUser(); - + // Create a test calendar $calendar = Calendar::factory()->create(); @@ -145,7 +144,7 @@ public function test_calendar_page_cannot_be_rendered_when_not_public(): void $response->assertStatus(403); } - public function test_calendar_can_be_created(): void + public function test_calendar_can_be_created(): void { // Setup user with permissions $user = $this->getUser(); @@ -162,7 +161,7 @@ public function test_calendar_can_be_created(): void $response->assertSessionHas('success', 'Calendar has been created successfully'); } - public function test_calendar_can_be_updated(): void + public function test_calendar_can_be_updated(): void { // Setup user with permissions $user = $this->getUser(); @@ -182,7 +181,7 @@ public function test_calendar_can_be_updated(): void $response->assertSessionHas('success', 'Calendar updated successfully'); } - public function test_calendar_can_be_deleted(): void + public function test_calendar_can_be_deleted(): void { // Setup user with permissions $user = $this->getUser(); diff --git a/tests/Feature/Models/EventTest.php b/tests/Feature/Models/EventTest.php index 9deedee..0e3dda1 100644 --- a/tests/Feature/Models/EventTest.php +++ b/tests/Feature/Models/EventTest.php @@ -14,7 +14,7 @@ class EventTest extends TestCase { - use WithFaker, RefreshDatabase; + use RefreshDatabase, WithFaker; /** * A events page can be rendered. @@ -49,7 +49,7 @@ public function test_events_page_cannot_be_rendered_without_correct_permissions( /** * A events create page can be rendered. */ - public function test_events_create_page_can_be_rendered(): void + public function test_events_create_page_can_be_rendered(): void { // Setup user with permissions $user = $this->getUser(); @@ -79,7 +79,7 @@ public function test_events_create_page_cannot_be_rendered_without_correct_permi /** * A events edit page can be rendered. */ - public function test_events_edit_page_can_be_rendered(): void + public function test_events_edit_page_can_be_rendered(): void { // Setup user with permissions $user = $this->getUser(); @@ -115,7 +115,7 @@ public function test_events_edit_page_cannot_be_rendered_without_correct_permiss $response->assertStatus(403); } - public function test_normal_event_can_be_created() : void + public function test_normal_event_can_be_created(): void { // Setup user with permissions $user = $this->getUser(); @@ -145,10 +145,10 @@ public function test_normal_event_can_be_created() : void // Check if the file exists $event = Event::latest()->first(); - Storage::disk('public')->assertExists('banners/' . $event->image); + Storage::disk('public')->assertExists('banners/'.$event->image); } - public function test_recurrent_event_can_be_created() : void + public function test_recurrent_event_can_be_created(): void { // Setup user with permissions $user = $this->getUser(); @@ -205,7 +205,7 @@ public function test_recurrent_event_can_be_created() : void } } - public function test_event_can_be_updated(): void + public function test_event_can_be_updated(): void { // Setup user with permissions $user = $this->getUser(); @@ -234,7 +234,7 @@ public function test_event_can_be_updated(): void $response->assertSessionHas('success', 'Event updated successfully.'); } - public function test_event_can_be_deleted(): void + public function test_event_can_be_deleted(): void { // Setup user with permissions $user = $this->getUser(); diff --git a/tests/Feature/Models/UserTest.php b/tests/Feature/Models/UserTest.php index 564382c..66fb366 100644 --- a/tests/Feature/Models/UserTest.php +++ b/tests/Feature/Models/UserTest.php @@ -2,7 +2,6 @@ namespace Tests\Feature\Models; -use App\Models\Group; use App\Models\User; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\WithFaker; @@ -10,7 +9,7 @@ class UserTest extends TestCase { - use WithFaker, RefreshDatabase; + use RefreshDatabase, WithFaker; /** * A users page can be rendered.