mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-20 04:53:59 +00:00
33 lines
870 B
PHP
33 lines
870 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 AssignsCompanyConnectionToConnectionSegment 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()->attach($segment);
|
|
|
|
return $companyConnection;
|
|
|
|
} catch (QueryException $exception){
|
|
throw new MalformedRequestException($exception);
|
|
}
|
|
|
|
|
|
}
|
|
} |