mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
honey trap
This commit is contained in:
@@ -6,7 +6,11 @@ namespace App\Classes\Modules\Companies\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\Companies\Processors\AssignSegmentProcessor;
|
||||
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SeasonalSegmentObject;
|
||||
use App\Classes\Modules\Segments\Services\CreatesSeasonalSegment;
|
||||
use App\Http\Resources\CompanyResource;
|
||||
use App\Models\SeasonalSegment;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -29,15 +33,20 @@ class AssignCompanyToSegmentLogic extends AbstractControllerLogic
|
||||
/** @var AssignSegmentProcessor */
|
||||
private $assignCompanyToSegmentProcessor;
|
||||
|
||||
/** @var CreatesSeasonalSegment */
|
||||
private $createsSeasonalSegment;
|
||||
|
||||
/**
|
||||
* AssignCompanyToSegmentLogic constructor.
|
||||
* @param FetchesCompany $fetchesCompany
|
||||
* @param AssignSegmentProcessor $assignCompanyToSegmentProcessor
|
||||
* @param CreatesSeasonalSegment $createsSeasonalSegment
|
||||
*/
|
||||
public function __construct(FetchesCompany $fetchesCompany, AssignSegmentProcessor $assignCompanyToSegmentProcessor)
|
||||
public function __construct(FetchesCompany $fetchesCompany, AssignSegmentProcessor $assignCompanyToSegmentProcessor, CreatesSeasonalSegment $createsSeasonalSegment)
|
||||
{
|
||||
$this->fetchesCompany = $fetchesCompany;
|
||||
$this->assignCompanyToSegmentProcessor = $assignCompanyToSegmentProcessor;
|
||||
$this->createsSeasonalSegment = $createsSeasonalSegment;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,6 +63,16 @@ class AssignCompanyToSegmentLogic extends AbstractControllerLogic
|
||||
|
||||
$this->assignCompanyToSegmentProcessor->execute($company, $request->input('segment_id'));
|
||||
|
||||
if (env('HONEY_TRAP_SEGMENT_ID') && env('HONEY_TRAP_SEGMENT_ID') == $request->input('segment_id')) {
|
||||
$start_date = $request->input('starting_on') ? $request->input('starting_on') : Carbon::now();
|
||||
$seasonalSegmentObject = new SeasonalSegmentObject($request->route('id'), $request->input('segment_id'), $start_date, $request->input('ending_on'));
|
||||
// $seasonalSegmentObject = new SeasonalSegmentObject((int)$request->route('id'), $request->input('segment_id'), '01-01-2022', '01-01-2022');
|
||||
|
||||
$this->createsSeasonalSegment->execute($seasonalSegmentObject);
|
||||
} else {
|
||||
dd('d');
|
||||
}
|
||||
|
||||
return $this->resourceResponse(new CompanyResource($company));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user