Skip to content

Instantly share code, notes, and snippets.

@ilyasozkurt
Last active February 24, 2023 11:38
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 ilyasozkurt/0c1f24f1245392dd4000837393280fa2 to your computer and use it in GitHub Desktop.
Save ilyasozkurt/0c1f24f1245392dd4000837393280fa2 to your computer and use it in GitHub Desktop.
<?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