Skip to content

Instantly share code, notes, and snippets.

@Konafets
Last active October 26, 2017 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Konafets/58a95272fef1682c227dfd1d37968fc8 to your computer and use it in GitHub Desktop.
Save Konafets/58a95272fef1682c227dfd1d37968fc8 to your computer and use it in GitHub Desktop.
Validation via FormRequest
<?php namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PostStoreRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'title' => 'required|unique:posts|max:255',
'body' => 'required',
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment