mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-20 21:14:10 +00:00
33 lines
872 B
PHP
33 lines
872 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Companies\Services;
|
|
|
|
use App\Classes\Exceptions\MalformedRequestException;
|
|
use App\Classes\General\Eloquent\AbstractUpdateRecord;
|
|
use App\Models\CompanyConnection;
|
|
use App\Models\Segment;
|
|
use Illuminate\Database\QueryException;
|
|
|
|
class RemovesCompanyConnectionFromConnectionSegment extends AbstractUpdateRecord
|
|
{
|
|
/**
|
|
* @param CompanyConnection $companyConnection
|
|
* @param Segment $segment
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @throws MalformedRequestException
|
|
*/
|
|
public function execute(CompanyConnection $companyConnection, Segment $segment)
|
|
{
|
|
try {
|
|
|
|
$companyConnection->segments()->detach($segment);
|
|
|
|
return $companyConnection;
|
|
|
|
} catch (QueryException $exception){
|
|
throw new MalformedRequestException($exception);
|
|
}
|
|
|
|
|
|
}
|
|
} |