Пример #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $company = Company::find($id);
     if (!$company) {
         return response()->json(['message' => 'This Company does not exist', 'success' => 0, 'code' => 404], 404);
     }
     $company->delete();
     return response()->json(['message' => 'This Company has been deleted', 'success' => 1, 'code' => 200], 200);
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $companies = Company::all();
     return view('companies.index', ['companies' => $companies]);
 }