本文整理汇总了PHP中app\News::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP News::destroy方法的具体用法?PHP News::destroy怎么用?PHP News::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\News
的用法示例。
在下文中一共展示了News::destroy方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: massDelete
/**
* Mass delete function from index page
* @param Request $request
*
* @return mixed
*/
public function massDelete(Request $request)
{
if ($request->get('toDelete') != 'mass') {
$toDelete = json_decode($request->get('toDelete'));
News::destroy($toDelete);
} else {
News::whereNotNull('id')->delete();
}
return redirect()->route('admin.news.index');
}
示例2: multiple_delete
/**
* Remove the specified resource from storage.
*
* @param Request $request
* @return \Illuminate\Http\Response
*/
public function multiple_delete(Request $request)
{
News::destroy($request->ids);
$response = ['model_type' => 'News', 'ids' => $request->ids, 'action_type' => 'delete'];
return json_encode($response);
}
示例3: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
News::destroy($id);
return redirect('admin-area/news');
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
News::destroy($id);
$showDefault = cmsHelp('App\\News', 'news');
return Redirect('newsAdmin')->with($showDefault);
}
示例5: redirect
$successMessage = '新闻创建成功';
return redirect('/')->withSuccess($successMessage);
});
$app->post('/news/{id}', function ($id, Request $request) {
if (!Auth::check()) {
return redirect('/login');
}
$rules = ['title' => 'required|max:256', 'ship' => 'array', 'quest' => 'array', 'content' => 'max:1024', 'equip' => 'array'];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return redirect('/')->withErrors($validator);
}
$ship = $request->input('ship') ? join(',', $request->input('ship')) : '';
$quest = $request->input('quest') ? join(',', $request->input('quest')) : '';
$equip = $request->input('equip') ? join(',', $request->input('equip')) : '';
$news = News::findOrFail($id);
$news->fill(['title' => $request->input('title'), 'ship' => $ship, 'equip' => $equip, 'quest' => $quest, 'content' => $request->input('content')]);
$news->save();
$successMessage = '新闻更新成功';
return redirect('/')->withSuccess($successMessage);
});
$app->delete('/news/{id}', function ($id) {
if (!Auth::check()) {
return redirect('/login');
}
$ret = News::destroy($id);
if ($ret) {
return redirect('/')->withSuccess('新闻删除成功');
}
return response()->withErrors(['新闻删除失败']);
});
示例6: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
News::destroy($id);
Flash::success("Запись - {$id} удалена");
return redirect(route('admin.news.index'));
}
示例7: getDeleteNews
public function getDeleteNews($id)
{
if (News::destroy($id)) {
return redirect('/dashboard/news');
} else {
return 'error';
}
}
示例8: destroy
public function destroy($encryptedNewsID)
{
$newsID = Crypt::decrypt($encryptedNewsID);
News::destroy($newsID);
return Redirect::back();
}