Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- use App\Post;
- class PostsController extends Controller
- {
- public function index()
- {
- return view('posts.index');
- }
- public function show()
- {
- return view('posts.show');
- }
- public function create()
- {
- return view('posts.create');
- }
- public function store()
- {
- $this->validate(request, [
- 'title' => 'required',
- 'body'=> 'required'
- ]);
- Post::create(request(['title', 'body']));
- return redirect('/');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment