<?php namespace Codeboard\Http\Requests;
use Illuminate\Contracts\Auth\Authenticator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Str;
class PostArticleRequest extends FormRequest {
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$this->merge(['slug' => Str::slug($this->input('slug'))]); // This ain't working
return [
'title' => 'required',
'slug' => 'required|unique:articles',
'tags' => 'required'
];
}
/**
* Determine if the user is authorized to make this request.
*
* @param \Illuminate\Contracts\Auth\Authenticator $auth
* @return bool
*/
public function authorize(Authenticator $auth)
{
return $auth->check();
}
}