Skip to content

Instantly share code, notes, and snippets.

@Konafets
Last active February 9, 2019 19:03
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/09788b0158b54c7ebea989594f5d275a to your computer and use it in GitHub Desktop.
Save Konafets/09788b0158b54c7ebea989594f5d275a to your computer and use it in GitHub Desktop.
Validate inside an action.
<?php namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BlogPost extends Model
{
public static $createRules = [
'title' => 'required|unique:posts|max:255',
'body' => 'required',
];
public static $updateRules = [
'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