Exemplo n.º 1
0
 public function komentar()
 {
     $komen = new Komentar();
     $komen->idposts = Input::get('idposts');
     $komen->isi = Input::get('isi');
     $komen->idpengguna = Auth::user()->id;
     $komen->save();
     echo "sukses";
 }
Exemplo n.º 2
0
 public function komentar($next)
 {
     if (trim(Input::get('isi')) != "") {
         $komen = new Komentar();
         $komen->idpengguna = Auth::user()->id;
         $komen->idpost = $next;
         $komen->isi = Input::get('isi');
         $komen->save();
         $a = Posts::find($next);
         return redirect(url($a->slug));
     } else {
         return redirect(url($a->slug));
     }
 }
Exemplo n.º 3
0
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::get('artikel', 'ArtikelController@index');
Route::get('artikel/add', 'ArtikelController@create');
Route::post('artikel/save', 'ArtikelController@store');
Route::post('artikel/update', 'ArtikelController@update');
Route::get('artikel/edit/{id}', 'ArtikelController@edit');
Route::get('artikel/delete/{id}', 'ArtikelController@destroy');
Route::post('komentar', 'ArtikelController@komentar');
Route::get('load_comments/{id}', function ($id) {
    $data = \App\Komentar::where('idpost', $id)->get();
    echo json_encode($data);
});
Route::get('/images/{filename}', function ($filename) {
    $path = storage_path() . '/' . $filename;
    $file = File::get($path);
    $type = File::mimeType($path);
    $response = Response::make($file, 200);
    $response->header("content-Type", $type);
    return $response;
});
Route::get('/mail/{slug}', function ($slug) {
    $artikel = \App\Posts::where('slug', $slug)->first();
    Mail::send('artikel.pdf', ['data' => $artikel], function ($message) {
        $message->to('*****@*****.**', "Sopie Halimah")->subject("Update Artikel");
    });
 public function deleteKomentar($id)
 {
     $komentar = Komentar::where('id', '=', $id)->delete();
 }
 public function deletePost($id)
 {
     $komentar = Komentar::where('post_id', '=', $id)->delete();
     $post = Post::find($id);
     $post->delete();
 }