File: /home/imensosw/www/mpl.imenso.co/app/Http/Requests/DoEditTourArtistRequest.php
<?php
namespace App\Http\Requests;
use App\Models\Tour;
use Illuminate\Foundation\Http\FormRequest;
class DoEditTourArtistRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required',
'artwork' => 'mimes:jpeg,bmp,png|max:19000',
'event_ids' => 'required',
'artist_ids' => 'required',
'status' => function () {
if ($this->user()->isPromoter()) {
$tour = Tour::find($this->tour_id);
return ['required', 'in:'.$tour->status_id];
}
return ['required'];
},
];
}
/**
* Get the error messages for the defined validation rules.
*
* @return array
*/
public function messages()
{
return [
'name.required' => 'You need to enter a name.',
'artwork.required' => 'You need to supply artwork.',
'artwork.mimes' => 'The artwork you supplied must be an image.',
'artwork.max' => 'The artwork you supplied was over 19Mb',
'event_ids.required' => 'You must select at least 1 event',
'artist_ids.required' => 'You must select at least 1 artist',
];
}
}