Skip to content

Instantly share code, notes, and snippets.

@Konafets
Last active October 26, 2017 13:09
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/78a82b0647946ed1bdf0dea7f8d82146 to your computer and use it in GitHub Desktop.
Save Konafets/78a82b0647946ed1bdf0dea7f8d82146 to your computer and use it in GitHub Desktop.
In-Action Validation
<?php namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
class PostController extends Controller
{
public function store(Request $request)
{
$validatedData = $request->validate([
'title' => 'required|unique:posts|max:255',
'body' => 'required',
]);
// The blog post is valid...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment