当前位置: 首页>>代码示例>>PHP>>正文


PHP News::destroy方法代码示例

本文整理汇总了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');
 }
开发者ID:AmirHome,项目名称:CMS_20160115,代码行数:16,代码来源:NewsController.php

示例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);
 }
开发者ID:poudigne,项目名称:lcdj,代码行数:12,代码来源:NewsController.php

示例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');
 }
开发者ID:pz6tnk,项目名称:laravel-CRM,代码行数:11,代码来源:NewsController.php

示例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);
 }
开发者ID:semmiverian,项目名称:webJok,代码行数:12,代码来源:newsController.php

示例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(['新闻删除失败']);
});
开发者ID:kcwikizh,项目名称:kcwiki-api,代码行数:31,代码来源:NewsRouter.php

示例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'));
 }
开发者ID:jambik,项目名称:sellmecar,代码行数:12,代码来源:NewsController.php

示例7: getDeleteNews

 public function getDeleteNews($id)
 {
     if (News::destroy($id)) {
         return redirect('/dashboard/news');
     } else {
         return 'error';
     }
 }
开发者ID:avbrugen,项目名称:uace-laravel,代码行数:8,代码来源:DashboardController.php

示例8: destroy

 public function destroy($encryptedNewsID)
 {
     $newsID = Crypt::decrypt($encryptedNewsID);
     News::destroy($newsID);
     return Redirect::back();
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:6,代码来源:NewsController.php


注:本文中的app\News::destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。