You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.0 KiB

  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Business;
  4. use App\System;
  5. use Illuminate\Http\Request;
  6. class SystemController extends Controller
  7. {
  8. public function store($business, $project, Request $request)
  9. {
  10. permit('projectSystems', ['project_id' => $project]);
  11. System::create([
  12. 'business_id' => $business,
  13. 'project_id' => $project,
  14. 'name' => $request->name
  15. ]);
  16. return Business::info($business, true);
  17. }
  18. public function update($business, $project, $system, Request $request)
  19. {
  20. permit('projectSystems', ['project_id' => $project]);
  21. $system = System::findOrFail($system);
  22. $system->update($request->except('_business_info'));
  23. return Business::info($business, true);
  24. }
  25. public function delete($business, $project, $system)
  26. {
  27. permit('projectSystems', ['project_id' => $project]);
  28. $system = System::findOrFail($system);
  29. $system->delete();
  30. return Business::info($business, true);
  31. }
  32. }