Add (new post)
This commit is contained in:
@@ -17,11 +17,20 @@ public function index(Request $request)
|
||||
|
||||
public function new(Request $request)
|
||||
{
|
||||
return 'PostController@new';
|
||||
$post = null;
|
||||
|
||||
return view('admin.posts.upsert', compact('post'));
|
||||
|
||||
}
|
||||
|
||||
public function edit(Request $request, $post_id)
|
||||
{
|
||||
return 'PostController@edit : '.$post_id;
|
||||
$post = Post::find($post_id);
|
||||
|
||||
if (!is_null($post))
|
||||
{
|
||||
return view('admin.posts.upsert', compact('post'));
|
||||
}
|
||||
return redirect()->back()->with('error','Post does not exist.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user