mirror of
https://github.com/10h30/Test-Laravel-Validation.git
synced 2026-07-13 11:55:52 +09:00
Complete all tasks
This commit is contained in:
@@ -9,14 +9,14 @@ class PostController extends Controller
|
||||
{
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate(
|
||||
$request->validate([
|
||||
'title' => 'required|unique:posts'
|
||||
// ... TASK: write validation here so that "title" field
|
||||
// would be required and unique in the "posts" DB table
|
||||
);
|
||||
]);
|
||||
|
||||
// Saving the post
|
||||
Post::create(['title' => $request->title]);
|
||||
|
||||
return 'Success';
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user