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.

37 lines
1.0 KiB

  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Business;
  4. use App\Models\Status;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Http\Response;
  7. use Illuminate\Validation\Rule;
  8. class StatusController extends Controller
  9. {
  10. public function store($business, $workflow, Request $request)
  11. {
  12. permit('businessStatuses');
  13. Status::create($request->merge(['business_id' => $business, 'workflow_id' => $workflow])->except('_business_info'));
  14. return Business::info($business, true);
  15. }
  16. public function update($business, $workflow, $status, Request $request)
  17. {
  18. permit('businessStatuses');
  19. $status = Status::findOrFail($status);
  20. $status->update($request->except('_business_info'));
  21. return Business::info($business, true);
  22. }
  23. public function delete($business, $workflow, $status)
  24. {
  25. permit('businessStatuses');
  26. $status = Status::findOrFail($status);
  27. $status->delete();
  28. return Business::info($business, true);
  29. }
  30. }