mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 06:26:16 +00:00
API Feature (#334)
This commit is contained in:
@ -3,13 +3,16 @@
|
||||
namespace App\Actions\SourceControl;
|
||||
|
||||
use App\Models\SourceControl;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class DeleteSourceControl
|
||||
{
|
||||
public function delete(SourceControl $sourceControl): void
|
||||
{
|
||||
if ($sourceControl->sites()->exists()) {
|
||||
throw new \Exception('This source control is being used by a site.');
|
||||
throw ValidationException::withMessages([
|
||||
'source_control' => __('This source control is being used by a site.'),
|
||||
]);
|
||||
}
|
||||
|
||||
$sourceControl->delete();
|
||||
|
Reference in New Issue
Block a user