Skip to content

Instantly share code, notes, and snippets.

@Konafets
Last active October 26, 2017 13:56
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/bfcfe7896292a1cd8dff86afb9a57c56 to your computer and use it in GitHub Desktop.
Save Konafets/bfcfe7896292a1cd8dff86afb9a57c56 to your computer and use it in GitHub Desktop.
In-Action Validation with rules from Model
<?php namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\BlogPost;
class PostController extends Controller
{
public function store(Request $request)
{
$validatedData = $request->validate(BlogPost::$createRules);
// The blog post is valid...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment