-
-
Save ilyasozkurt/0c1f24f1245392dd4000837393280fa2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Controllers; | |
class PostController extends Controller{ | |
public function store(Request $request) { | |
$validated = $request->validate([ | |
'title' => 'required|unique:posts|max:255', | |
'body' => 'required', | |
]); | |
$post = Post::create($validated); | |
return redirect('/posts/' . $post->id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment