<?php

namespace Tricks\CampaignMonitor\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;

class CampaignMonitorRequest extends FormRequest
{
    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $routeName = $this->route()->getName();
        $mailSlug = Str::afterLast($routeName, '.');

        $rules = config('campaignmonitor.transactional.mails.' . $mailSlug . '.rules');

        return $rules ?? [];
    }

//    protected function prepareForValidation()
//    {
//
//        dd($this);
////        $this->merge([
////            'slug' => Str::slug($this->slug),
////        ]);
//    }
}
