51 lines
1.5 KiB
PHP
51 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class CreateDiscordWebhookMessage extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function authorize()
|
|
{
|
|
return Auth::check();
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
"enabled" => "required|boolean",
|
|
"discord_webhook_url" => "required|url|starts_with:https://discordapp.com/api/webhooks/,https://discord.com/api/webhooks/",
|
|
"username" => "nullable|string|max:50",
|
|
"avatar" => "nullable|file|image",
|
|
"delete_avatar" => "nullable|in:true,1",
|
|
"content" => "nullable|string|max:2000",
|
|
"embed_color" => [
|
|
"nullable",
|
|
"string",
|
|
"regex:/^#[0-9A-F]{6}$/i"
|
|
],
|
|
"embed_author_name" => "nullable|boolean",
|
|
"embed_author_url" => "nullable|boolean",
|
|
"embed_author_icon" => "nullable|boolean",
|
|
"embed_thumbnail" => "nullable|boolean",
|
|
"embed_title" => "nullable|string|max:191",
|
|
"embed_description" => "nullable|string|max:2000",
|
|
"embed_url" => "nullable|url|max:191",
|
|
"embed_image" => "nullable|boolean",
|
|
"embed_fields" => "nullable|json"
|
|
];
|
|
}
|
|
}
|