fix code event
This commit is contained in:
@@ -8,10 +8,9 @@ use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmNoRoadAccessNeedProcessed
|
||||
class ConfirmGuaranteeLetterNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(public Harim $harim){}
|
||||
|
||||
}
|
||||
@@ -8,10 +8,9 @@ use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmGuaranteeLetterNeedProcessed
|
||||
class ConfirmNoRoadAccessNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public function __construct(public Harim $harim){}
|
||||
|
||||
}
|
||||
@@ -3,13 +3,11 @@
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmRoadAccessNeedProcessed
|
||||
class ConfirmRoadAccessEditNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
@@ -3,15 +3,11 @@
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\Channel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PresenceChannel;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class ConfirmRoadAccessEditNeedProcessed
|
||||
class ConfirmRoadAccessNeedEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
@@ -19,5 +15,4 @@ class ConfirmRoadAccessEditNeedProcessed
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Harim $harim){}
|
||||
|
||||
}
|
||||
18
app/Events/V3/Dashboard/Harim/RejectRequestEvent.php
Normal file
18
app/Events/V3/Dashboard/Harim/RejectRequestEvent.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RejectRequestEvent
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(public Harim $harim){}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events\V3\Dashboard\Harim;
|
||||
|
||||
use App\Models\Harim;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class RejectRequestProcessed
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $harimId;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public Harim $harim,)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Get the channels the event should broadcast on.
|
||||
*
|
||||
* @return array<int, \Illuminate\Broadcasting\Channel>
|
||||
*/
|
||||
public function broadcastOn(): array
|
||||
{
|
||||
return [
|
||||
new PrivateChannel('channel-name'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ namespace App\Http\Controllers\V3\Dashboard\Harim;
|
||||
|
||||
use App\Enums\HarimAction;
|
||||
use App\Enums\HarimStates;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedProcessed;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedProcessed;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedProcessed;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestProcessed;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use App\Facades\DataTable\DataTableFacade;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\V3\Dashboard\Harim\GeneralManager\ConfirmRoadAccessEditNeedRequest;
|
||||
@@ -44,8 +45,10 @@ class GeneralManagerController extends Controller
|
||||
|
||||
public function rejectRequest(RejectRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -61,15 +64,19 @@ class GeneralManagerController extends Controller
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
RejectRequestProcessed::dispatch($request->harim_id);
|
||||
|
||||
RejectRequestEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referRequest(ReferRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id'=> auth()->user()->id,
|
||||
'previous-state_id' => $harim->state_id,
|
||||
@@ -86,13 +93,16 @@ class GeneralManagerController extends Controller
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function referFile(ReferFileRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::REFER->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id'=> auth()->user()->id,
|
||||
'previous-state_id' => $harim->state_id,
|
||||
@@ -109,13 +119,16 @@ class GeneralManagerController extends Controller
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessNeed(ConfirmRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -126,19 +139,24 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
ConfirmRoadAccessNeedProcessed::dispatch($request->harim_id);
|
||||
|
||||
ConfirmRoadAccessNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmNoRoadAccessNeed(ConfirmNoRoadAccessNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -149,20 +167,25 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_BE_PANJAREH_VAHED_BEDONEH_NIAZ_BE_RAH_DASTRASI->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
ConfirmNoRoadAccessNeedProcessed::dispatch($request->harim_id);
|
||||
|
||||
ConfirmNoRoadAccessNeedEvent::dispatch($harim);
|
||||
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmRoadAccessEditNeed(ConfirmRoadAccessEditNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -173,19 +196,24 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::UPDATE_FILE_BARGOZARE_SHODE->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
ConfirmRoadAccessEditNeedRequest::dispatch($request->harim_id);
|
||||
|
||||
ConfirmRoadAccessEditNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
|
||||
public function confirmGuaranteeLetterNeed(ConfirmGuaranteeLetterNeedRequest $request, Harim $harim): JsonResponse
|
||||
{
|
||||
DB::transaction(function () use ($request, $harim) {
|
||||
DB::transaction(function () use ($request, $harim)
|
||||
{
|
||||
$action = HarimAction::CONFIRM->value;
|
||||
|
||||
$harim->histories()->create([
|
||||
'expert_id' => auth()->user()->id,
|
||||
'previous_state_id' => $harim->state_id,
|
||||
@@ -196,12 +224,15 @@ class GeneralManagerController extends Controller
|
||||
]);
|
||||
|
||||
$state = HarimStates::ERSAL_ZEMANAT_NAME_TAVASOTE_KARBAR->value;
|
||||
|
||||
$harim->update([
|
||||
'state_id' => $state,
|
||||
'state_name' => HarimStates::name($state),
|
||||
]);
|
||||
ConfirmGuaranteeLetterNeedProcessed::dispatch($request->harim_id);
|
||||
|
||||
ConfirmGuaranteeLetterNeedEvent::dispatch($harim);
|
||||
});
|
||||
|
||||
return $this->successResponse();
|
||||
}
|
||||
public function show(ShowRequest $request, Harim $harim): JsonResponse
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmGuaranteeLetterNeedListener
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
public function handle(ConfirmGuaranteeLetterNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
' ' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmNoRoadAccessNeedListener
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
public function handle(ConfirmNoRoadAccessNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmRoadAccessEditNeedListener
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
public function handle(ConfirmRoadAccessEditNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class ConfirmRoadAccessNeedListener
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessNeedEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
38
app/Listeners/V3/Dashboard/Harim/RejectRequestListener.php
Normal file
38
app/Listeners/V3/Dashboard/Harim/RejectRequestListener.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class RejectRequestListener
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(RejectRequestEvent $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
'' => $event->harim->id,
|
||||
))->throw();
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedProcessed;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class SendConfirmGuaranteeLetterNeed
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected int $harimId;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
public function handle(ConfirmGuaranteeLetterNeedProcessed $event): void
|
||||
{
|
||||
//
|
||||
}
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(
|
||||
ConfirmGuaranteeLetterNeedProcessed::class,
|
||||
SendConfirmGuaranteeLetterNeed::class,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\ConfirmNoRoadAccessEditNeedProcessed;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedProcessed;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class SendConfirmNoRoadAccessEditNeed
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected int $harimId;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
public function handle(ConfirmRoadAccessEditNeedProcessed $event): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(
|
||||
ConfirmRoadAccessEditNeedProcessed::class,
|
||||
SendConfirmNoRoadAccessEditNeed::class,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedProcessed;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class SendConfirmNoRoadAccessNeed
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected int $harimId;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
public function handle(ConfirmNoRoadAccessNeedProcessed $event): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(
|
||||
ConfirmNoRoadAccessNeedProcessed::class,
|
||||
SendConfirmNoRoadAccessNeed::class,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedProcessed;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class SendConfirmRoadAccessNeed
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected int $harimId;
|
||||
protected string $message = 'این درخواست نیاز به راه دسترسی دارد';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*/
|
||||
public function handle(ConfirmRoadAccessNeedProcessed $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'username' => $this->username,
|
||||
'password' => $this->password,
|
||||
'harim_id' => $this->harimId,
|
||||
'status' => 'rejected',
|
||||
'message' => $this->message,
|
||||
))->throw();
|
||||
}
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(
|
||||
ConfirmRoadAccessNeedProcessed::class ,
|
||||
SendConfirmRoadAccessNeed::class,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\V3\Dashboard\Harim;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestProcessed;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Http\Client\RequestException;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class SendRejectNotification
|
||||
{
|
||||
protected string $url;
|
||||
protected string $password;
|
||||
protected string $username;
|
||||
protected int $harimId;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->url = config('harim_web_services.reject.url');
|
||||
$this->username = config('harim_web_services.reject.username');
|
||||
$this->password = config('harim_web_services.reject.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RequestException
|
||||
*/
|
||||
public function handle(RejectRequestProcessed $event): void
|
||||
{
|
||||
Http::post($this->url,
|
||||
array(
|
||||
'username' => $this->username,
|
||||
'password' => $this->password,
|
||||
'harim_id' => $this->harimId,
|
||||
'status' => 'need road access',
|
||||
'panjareh_vahed_id' => $this->panjareh_vahed_id,
|
||||
'date' => now(),
|
||||
'single choice' => 'accepted',
|
||||
|
||||
))->throw();
|
||||
}
|
||||
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(
|
||||
RejectRequestProcessed::class,
|
||||
SendRejectNotification::class, 'handle'
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\ConfirmRoadAccessNeedEvent;
|
||||
use App\Events\V3\Dashboard\Harim\RejectRequestEvent;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmGuaranteeLetterNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmNoRoadAccessNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmRoadAccessEditNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\ConfirmRoadAccessNeedListener;
|
||||
use App\Listeners\V3\Dashboard\Harim\RejectRequestListener;
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
@@ -25,6 +35,22 @@ class EventServiceProvider extends ServiceProvider
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\LogSuccessfulLogin',
|
||||
],
|
||||
|
||||
RejectRequestEvent::class => [
|
||||
RejectRequestListener::class
|
||||
],
|
||||
ConfirmRoadAccessNeedEvent::class => [
|
||||
ConfirmRoadAccessNeedListener::class
|
||||
],
|
||||
ConfirmNoRoadAccessNeedEvent::class => [
|
||||
ConfirmNoRoadAccessNeedListener::class
|
||||
],
|
||||
ConfirmRoadAccessEditNeedEvent::class => [
|
||||
ConfirmRoadAccessEditNeedListener::class
|
||||
],
|
||||
ConfirmGuaranteeLetterNeedEvent::class => [
|
||||
ConfirmGuaranteeLetterNeedListener::class
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user