Exemplo n.º 1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update()
 {
     $post = posts::find(Input::get('id'));
     $post->idpengguna = Auth::user()->id;
     $post->judul = Input::get('judul');
     $post->isi = Input::get('isi');
     $post->tag = Input::get('tag');
     $post->slug = str_slug(input::get('judul'));
     if (Input::hasfile('sampul')) {
         $sampul = date("YmdHis") . uniqid() . "." . Input::file('sampul')->getClientOriginalExtension();
         Input::file('sampul')->move(storage_path(), $sampul);
         $post->sampul = $sampul;
     }
     $post->save();
     return redirect(url('artikel'));
 }
Exemplo n.º 2
0
 /**
  * delete comment by ronak
  */
 public function dlt($id)
 {
     $comment = comments::find($id);
     $postid = $comment->on_post;
     $slug = posts::find($postid);
     $slugcontent = $slug->slug;
     $comment->delete();
     return redirect('/posts' . $slugcontent);
 }