From fcc7b451b0ea49f4ee6e8a209e69cca08615e228 Mon Sep 17 00:00:00 2001 From: ScuffedNewt Date: Sun, 25 Feb 2024 20:29:52 +0000 Subject: [PATCH] requested changes --- app/Http/Controllers/Users/SubmissionController.php | 6 +++++- app/Models/Submission/Submission.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Users/SubmissionController.php b/app/Http/Controllers/Users/SubmissionController.php index 397fb5a8f9..293dff63dc 100644 --- a/app/Http/Controllers/Users/SubmissionController.php +++ b/app/Http/Controllers/Users/SubmissionController.php @@ -7,6 +7,7 @@ use App\Models\Character\Character; use App\Models\Currency\Currency; use App\Models\Gallery\GallerySubmission; +use App\Models\Gallery\GallerySubmissionCollaborator; use App\Models\Item\Item; use App\Models\Item\ItemCategory; use App\Models\Prompt\Prompt; @@ -88,7 +89,10 @@ public function getNewSubmission(Request $request) { $inventory = UserItem::with('item')->whereNull('deleted_at')->where('count', '>', '0')->where('user_id', Auth::user()->id)->get(); if (config('lorekeeper.settings.allow_gallery_submissions_on_prompts')) { - $gallerySubmissions = GallerySubmission::where('user_id', Auth::user()->id)->where('status', 'Accepted')->orderBy('id', 'DESC')->get()->pluck('title', 'id'); + $collaboratorIds = GallerySubmissionCollaborator::where('user_id', Auth::user()->id)->where('has_approved', 1)->pluck('gallery_submission_id')->toArray(); + + $gallerySubmissions = GallerySubmission::where('user_id', Auth::user()->id)->orWhereIn('id', $collaboratorIds)->orderBy('id', 'DESC')->get()->pluck('title', 'id'); + $gallerySubmissions = $gallerySubmissions->map(function ($item, $key) { return '"'.$item.'" by '.Auth::user()->name; }); diff --git a/app/Models/Submission/Submission.php b/app/Models/Submission/Submission.php index 41e73652cf..f70595af6d 100644 --- a/app/Models/Submission/Submission.php +++ b/app/Models/Submission/Submission.php @@ -39,7 +39,7 @@ class Submission extends Model { * @var array */ public static $createRules = [ - 'url' => 'nullable', + 'url' => 'nullable|url', ]; /** @@ -48,7 +48,7 @@ class Submission extends Model { * @var array */ public static $updateRules = [ - 'url' => 'nullable', + 'url' => 'nullable|url', ]; /**********************************************************************************************