コード例 #1
0
ファイル: PostController.php プロジェクト: Abenaman/ggc-talk
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Posts::destroy($id);
     return Redirect::route('posts.index');
 }
コード例 #2
0
ファイル: admin.route.php プロジェクト: kuslahne/SlimBlog
     } else {
         $app->render('404_post.html');
     }
 })->conditions(array('id' => '\\d+'));
 $app->get('/posts/delete/:id', $authenticate($app, $settings), function ($id) use($app) {
     $post = Posts::where('id', '=', $id)->first();
     if ($post) {
         $app->render('a_post_delete.html', array('post_id' => $id));
     } else {
         $app->render('404_post.html');
     }
 })->conditions(array('id' => '\\d+'));
 $app->delete('/posts/delete/:id', $authenticate($app, $settings), function ($id) use($app, $settings) {
     $post = Posts::where('id', '=', $id)->first();
     if ($post) {
         Posts::destroy($id);
         $redirect = $settings->base_url . '/admin';
         $app->render('success.html', array('redirect' => $redirect));
     } else {
         $app->render('404_post.html');
     }
 })->conditions(array('id' => '\\d+'));
 $app->get('/settings/', $authenticate($app, $settings), function () use($app) {
     $flash = $app->view()->getData('flash');
     $error = isset($flash['error']) ? $flash['error'] : '';
     $paths = glob(TEMPLATEDIR . '*', GLOB_ONLYDIR);
     $dirs = array();
     foreach ($paths as $path) {
         $a = explode(DS, $path);
         $dirs[] = end($a);
     }