MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
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',
        ];
    }
}