<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TransactionRequest 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 [
            'trx_code' => 'required|unique:transaction,trx_code',
            'id_cust' => 'required',
            'poin' => 'required',
            'amount' => 'required',
            'persentase' => 'required',
            'tipe' => 'required',
            'tgl_trx' => 'required',
            'id_branch' => 'required',

        ];
    }

    public function messages()
    {
        return [
            'trx_code.required' => 'No Nota harus diisi.',
            'trx_code.unique' => 'No Nota telah digunakan.',
            'id_cust.required' => 'Customer harus diisi.',
            'poin.required' => 'Poin harus diisi.',
            'amount.required' => 'Nominal Transaksi harus diisi.',
            'persentase.required' => 'Persentase harus diisi.',
            'tipe.required' => 'Tipe harus diisi',
            'tgl_trx.required' => 'Tanggal harus diisi',
            'id_branch.required' => 'Cabang harus diisi',
            
        ];
    }
}
