Exemple #1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $post = Post::find($id);
     $postCats = $post->categories;
     $ids = [];
     foreach ($postCats as $cat) {
         $ids[] = $cat->id;
     }
     return view('cms::admin.post.edit', ['post' => $post, 'ids' => $ids, 'categories' => Category::where('status', 1)->get()]);
 }
Exemple #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Category::find($id)->delete();
     return redirect()->route('admin.category.index')->with('success', 'Successfully deleted!');
 }