1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-02-24 11:13:02 +01:00
LinkAce/app/Http/Requests/LinkStoreRequest.php

38 lines
778 B
PHP
Raw Normal View History

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class LinkStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'url' => [
'required',
Rule::unique('links')->where(function ($query) {
return $query->where('user_id', auth()->user()->id);
}),
],
'is_private' => 'required|boolean',
];
}
}