本文整理汇总了PHP中Posts::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::destroy方法的具体用法?PHP Posts::destroy怎么用?PHP Posts::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Posts::destroy($id);
return Redirect::route('posts.index');
}
示例2: function
} 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);
}