user(); return auth()->check() and $user->hasWon()->exists(); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { /** @var \App\Models\User */ $user = auth()->user(); $ids = $user->unclaimedInstantGagnants()->pluck('id')->implode(','); return [ 'unclaimedWin' => 'required|integer|exists:instant_gagnants,id|in:' . $ids, 'firstname' => 'required|string|min:2|max:255', 'lastname' => 'required|string|min:2|max:255', 'address' => 'required|min: 5|string|max:255', 'address2' => 'sometimes|max:255', 'phone' => 'required|string|min:10|max:13', 'city' => 'required|string|min: 2|max:255', 'country' => 'required|string|min: 2|max:255', 'postcode' => 'required|digits:5', 'file' => 'required|file|mimes:png,jpg,pdf|max:2048', ]; } }