コード例 #1
0
ファイル: Main.php プロジェクト: luijar/fp-php
 public function deleteItem($id) : RedirectResponse
 {
     $count = Nullable::fromValue($id)->reject('')->map('intval')->filter(P::lt(0))->map(function ($id) {
         Log::info("Deleting item with {$id}...");
         return Item::destroy($id);
     })->getOrCall(function () {
         Log::info('Invalid item ID. Skipping delete...');
         return 0;
     });
     return redirect('/main')->with('status', "{$count} item deleted!");
 }
コード例 #2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Item::destroy($id);
     return redirect('item')->with('message', 'Data berhasil dihapus!');
 }
コード例 #3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     Item::destroy($id);
     Session::flash('flash_message', 'Item successfully deleted!');
     return redirect('item');
 }
コード例 #4
0
ファイル: ItemsController.php プロジェクト: robboyland/ecom
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Item::destroy($id);
     return redirect('items');
 }
コード例 #5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // 通过删除itemsite,同时删除了item
     $item = Item::findOrFail($id);
     $itemsite = $item->itemsite;
     if ($itemsite != null) {
         Itemsite::destroy($itemsite->id);
     }
     Item::destroy($id);
     return redirect('items');
 }
コード例 #6
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($course_url, $stage_url, $id)
 {
     Item::destroy($id);
     return redirect()->route('items.index', ['course_url' => $course_url, 'stage_url' => $stage_url]);
 }
コード例 #7
0
 public function deleteItem($id)
 {
     Item::destroy($id);
 }