mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 18:20:48 +01:00
feat: refactor code and improve readability
This commit is contained in:
@@ -20,12 +20,15 @@ class ContactSubmissionController extends Controller
|
||||
$descriptionContent = "**Name**: {$contactSubmission->name}\n\n**Email**: {$contactSubmission->email}\n\n**Category**: {$contactSubmission->category->humanReadable()}\n\n**Subject**: {$contactSubmission->subject}\n\n**Message**: {$contactSubmission->message}";
|
||||
|
||||
if ($contactSubmission->discord) {
|
||||
$descriptionContent .= "\n\n\n**Discord**: {$contactSubmission->discord}";
|
||||
$descriptionContent .= '
|
||||
|
||||
|
||||
**Discord**: ' . $contactSubmission->discord;
|
||||
}
|
||||
|
||||
DiscordAlert::message("There is a new contact submission from {$contactSubmission->name} ({$contactSubmission->email}).", [
|
||||
DiscordAlert::message(sprintf('There is a new contact submission from %s (%s).', $contactSubmission->name, $contactSubmission->email), [
|
||||
[
|
||||
'title' => "{$contactSubmission->category->humanReadable()} - {$contactSubmission->subject}",
|
||||
'title' => sprintf('%s - %s', $contactSubmission->category->humanReadable(), $contactSubmission->subject),
|
||||
'description' => $descriptionContent,
|
||||
'color' => '#ff8a4c',
|
||||
],
|
||||
|
||||
@@ -10,9 +10,7 @@ class PostsController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$posts = Sheets::all()->filter(function ($post) {
|
||||
return ! $post->hidden;
|
||||
})->sortByDesc('date');
|
||||
$posts = Sheets::all()->filter(fn($post) => ! $post->hidden)->sortByDesc('date');
|
||||
$paginatedPosts = Paginate::collection($posts, 6);
|
||||
|
||||
return view('posts.index', [
|
||||
|
||||
@@ -27,12 +27,12 @@ class SaleController extends Controller
|
||||
|
||||
return $response;
|
||||
});
|
||||
} catch (\Exception $e) {
|
||||
if ($e->getMessage() === 'Trying to access array offset on value of type null') {
|
||||
} catch (\Exception $exception) {
|
||||
if ($exception->getMessage() === 'Trying to access array offset on value of type null') {
|
||||
logger()->error('LMI has broken');
|
||||
abort(503, 'Sorry, the Sale Rotation is currently under maintenance. Please try again later.');
|
||||
} else {
|
||||
logger()->error('An error occurred while trying to fetch the Sale Rotation', ['error' => $e->getMessage()]);
|
||||
logger()->error('An error occurred while trying to fetch the Sale Rotation', ['error' => $exception->getMessage()]);
|
||||
abort(500, 'Sorry, an error occurred while trying to fetch the Sale Rotation. Please try again later.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user