Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = Auth::user();
     $cerita = new Cerita();
     $cerita->judul = $request->judul;
     $cerita->isi = $request->isi;
     $cerita->user_id = $request->user_id;
     $cerita->views = 0;
     $cerita->save();
     return redirect('feed')->with('user', $user);
 }
Ejemplo n.º 2
0
 public function like($id)
 {
     $cerita = Cerita::findOrFail($id);
     $jumLike = $cerita->likes;
     $jumLike += 1;
     $cerita->likes = $jumLike;
     return "a";
 }
Ejemplo n.º 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function updatestory($id)
 {
     $post = Cerita::find(Input::get('id'));
     $post->idpengguna = Auth::user()->id;
     $post->title = Input::get('title');
     $post->contents = Input::get('contents');
     $post->save();
     return redirect(url('novel'));
     //
 }