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
40 lines
1.0 KiB
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Business;
|
|
use App\Models\System;
|
|
use Illuminate\Http\Request;
|
|
|
|
class SystemController extends Controller
|
|
{
|
|
public function store($business, $project, Request $request)
|
|
{
|
|
permit('projectSystems', ['project_id' => $project]);
|
|
System::create([
|
|
'business_id' => $business,
|
|
'project_id' => $project,
|
|
'name' => $request->name
|
|
]);
|
|
return Business::info($business, true);
|
|
}
|
|
|
|
public function update($business, $project, $system, Request $request)
|
|
{
|
|
permit('projectSystems', ['project_id' => $project]);
|
|
$system = System::findOrFail($system);
|
|
$system->update($request->except('_business_info'));
|
|
return Business::info($business, true);
|
|
}
|
|
|
|
|
|
public function delete($business, $project, $system)
|
|
{
|
|
permit('projectSystems', ['project_id' => $project]);
|
|
$system = System::findOrFail($system);
|
|
$system->delete();
|
|
return Business::info($business, true);
|
|
}
|
|
|
|
|
|
}
|