<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request;

class reqGm 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(Request $request)
    {

        return [
            //
            'nip' => 'required|unique:tbl_gmaster,nip,'.$request->input('mhs_id'),
            'nama_gmaster' => 'required'
        ];
    }

    public function messages(){
        return [
            'nip.required' => 'NIP harus diisi',
            'nip.unique' => 'NIP sudah terdaftar',
            'nama_gmaster.required' => 'Nama master harus diisi'

        ];
    }
}
