/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CategoryRequest $request)
 {
     $category = Categories::create(array('creater_id' => Auth::id(), 'name' => $request->name));
     $category->save();
     $lists = MyAsset::where('user_id', Auth::id())->orderBy('id', 'desc')->get();
     $categories = Categories::distinct()->select('name')->where('creater_id', Auth::id())->orderBy('id', 'desc')->get();
     return view('myasset.index')->withLists($lists)->with('category', $categories);
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $myasset = MyAsset::find($id);
     $myasset->delete();
     return \Redirect::route('myasset.index')->with('message', 'Task deleted!');
 }