mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
fix contact processor and remarks database
This commit is contained in:
@@ -2,11 +2,10 @@
|
||||
|
||||
namespace App\Classes\Modules\Contacts\Processors;
|
||||
|
||||
use App\Classes\General\Interfaces\Contactable;
|
||||
use App\Classes\Modules\Contacts\DataTransferObjects\ContactObject;
|
||||
use App\Classes\Modules\Contacts\Services\CreatesContact;
|
||||
use App\Classes\Modules\Contacts\Standards\Rules\CanCreateContact;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CreateContactProcessor
|
||||
@@ -15,6 +14,9 @@ class CreateContactProcessor
|
||||
/** @var CanCreateContact */
|
||||
private $canCreateContact;
|
||||
|
||||
/** @var CreatesContact */
|
||||
private $createsContact;
|
||||
|
||||
/**
|
||||
* CreateContactProcessor constructor.
|
||||
* @param CanCreateContact $canCreateContact
|
||||
@@ -28,17 +30,17 @@ class CreateContactProcessor
|
||||
|
||||
/**
|
||||
* @param ContactObject $object
|
||||
* @param Company $company
|
||||
* @param Contactable $contactable
|
||||
* @return Model
|
||||
* @throws \App\Classes\Exceptions\AccessForbiddenException
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
* @throws \App\Classes\Exceptions\RequestValidationException
|
||||
*/
|
||||
public function execute(ContactObject $object, Company $company): Model
|
||||
public function execute(ContactObject $object, Contactable $contactable): Model
|
||||
{
|
||||
|
||||
$this->canCreateContact->passes($object);
|
||||
|
||||
return $this->createsContact->execute($company,$object);
|
||||
return $this->createsContact->execute($contactable,$object);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
|
||||
final class RemarkTypes
|
||||
{
|
||||
|
||||
public const INTERNAL = 0;
|
||||
|
||||
public const EXTERNAL = 1;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\RemarkTypes;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
@@ -18,6 +19,7 @@ class CreateRemarksTable extends Migration
|
||||
$table->morphs('owner');
|
||||
$table->bigInteger('commenter_id')->unsigned()->index();
|
||||
$table->string('content',200);
|
||||
$table->integer('type')->default(RemarkTypes::INTERNAL);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user