/home/mip/mip/app/Modules/Client/Requests/Posts/PostRequest.php
<?php

namespace QxCMS\Modules\Client\Requests\Posts;

use Illuminate\Foundation\Http\FormRequest;

class PostRequest 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 [
            'title'     => 'required|min:3',
            'posts_category_id' => 'required',
            'expired_at' => 'after:published_at'
        ];
    }

    public function messages()
    {
        return [
            'title.required' => 'Title is required.',
            'posts_category_id.required' => 'Category is required.',
            'expired_at.after' => 'This must be after publish date.',
        ];
    }
}