honey trap

This commit is contained in:
edmondlang
2023-03-17 18:40:48 +08:00
parent f6082382bf
commit 7cf7fdec54
14 changed files with 415 additions and 4 deletions
@@ -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));
}
}