| @@ 54-70 (lines=17) @@ | ||
| 51 | * @param \App\Http\Requests\ValidatePostRequest $request |
|
| 52 | * @return \Illuminate\Http\Response |
|
| 53 | */ |
|
| 54 | public function store(ValidatePostRequest $request) |
|
| 55 | { |
|
| 56 | $post = Post::create($request->only([ |
|
| 57 | 'title', |
|
| 58 | 'sub_title', |
|
| 59 | 'slug', |
|
| 60 | 'user_id', |
|
| 61 | 'excerpt', |
|
| 62 | 'content', |
|
| 63 | 'allow_comments', |
|
| 64 | 'allow_guest_comments', |
|
| 65 | ])); |
|
| 66 | ||
| 67 | return redirect() |
|
| 68 | ->route('posts.edit', ['post' => $post->id]) |
|
| 69 | ->with('success', 'Post created.'); |
|
| 70 | } |
|
| 71 | ||
| 72 | /** |
|
| 73 | * Display the specified resource. |
|
| @@ 111-127 (lines=17) @@ | ||
| 108 | * @param \Chriscreates\Blog\Post $post |
|
| 109 | * @return \Illuminate\Http\Response |
|
| 110 | */ |
|
| 111 | public function update(ValidatePostRequest $request, Post $post) |
|
| 112 | { |
|
| 113 | $post->update($request->only([ |
|
| 114 | 'title', |
|
| 115 | 'sub_title', |
|
| 116 | 'slug', |
|
| 117 | 'user_id', |
|
| 118 | 'excerpt', |
|
| 119 | 'content', |
|
| 120 | 'allow_comments', |
|
| 121 | 'allow_guest_comments', |
|
| 122 | ])); |
|
| 123 | ||
| 124 | return redirect() |
|
| 125 | ->route('posts.edit', ['post' => $post->id]) |
|
| 126 | ->with('success', 'Post updated.'); |
|
| 127 | } |
|
| 128 | ||
| 129 | /** |
|
| 130 | * Remove the specified resource from storage. |
|