當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。