%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/forge/api-takeaseat.eco-n-tech.co.uk/app/Http/Requests/
Upload File :
Create Path :
Current File : //home/forge/api-takeaseat.eco-n-tech.co.uk/app/Http/Requests/StoreAvailability.php

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class StoreAvailability extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return auth()->guard('api')->check() && auth()->user()->hasRole('therapist');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'available_from' => 'required_with:available_to|date_format:H:i|before:available_to',
            'available_to' => 'required_with:available_from|date_format:H:i|after:available_from',
            'date' => 'required|date_format:Y-m-d',
            'address_id' => 'nullable|exists:user_addresses,id'
        ];
    }

    /**
     * Get the error messages for the defined validation rules.
     *
     * @return array
     */
    public function messages()
    {
        return [
            'available_to.after' => __('This time must be after the available from time')
        ];
    }
}

Zerion Mini Shell 1.0