/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $guestbook = new Guestbook();
     $guestbook->name = $request->name;
     $guestbook->text = $request->text;
     $guestbook->save();
     return redirect('guestbook');
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $entries = Guestbook::findOrFail($id);
     $entries->delete();
     return redirect()->route('guestbook.index')->withSuccess("The '{$entries->entries}' tag has been deleted.");
 }
示例#3
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $posts = Guestbook::with('user')->orderBy('id', 'desc')->paginate(10);
     return view('guestbook.index', compact('posts'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $guestbook = Guestbook::create(['name' => $request->name, 'content' => $request->content]);
     return redirect()->to('guestbook');
 }