/**
  * Remove the specified resource from storage.
  *
  * @param int $id
  *
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $bill = Bill::findOrFail($id);
     if (policy($bill)->destroy(Auth::user(), $bill)) {
         $bill->delete();
         $successInfo = '成功删除账单 <strong>' . $bill->name . '</strong>。';
         return redirect('bill')->withSuccess($successInfo);
     } else {
         return redirect('bill')->withErrors('你没有足够的权限来执行此操作。');
     }
 }
Exemple #2
0
 public function archive($id)
 {
     $bill = Bill::findOrFail($id);
     $bill->delete();
     if ($bill->trashed()) {
         return redirect()->back()->with('success', "La Facture a bien été archivé");
     }
 }