migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Modules\RestaurantDelivery\Models\Delivery;
class DeliveryCreated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public readonly Delivery $delivery
) {}
/**
* Get the channels the event should broadcast on.
*/
public function broadcastOn(): array
{
return [
new PrivateChannel("restaurant.{$this->delivery->restaurant_id}.deliveries"),
];
}
/**
* Get the data to broadcast.
*/
public function broadcastWith(): array
{
return [
'delivery_id' => $this->delivery->id,
'tracking_code' => $this->delivery->tracking_code,
'restaurant_id' => $this->delivery->restaurant_id,
'status' => $this->delivery->status,
'pickup_address' => $this->delivery->pickup_address,
'drop_address' => $this->delivery->drop_address,
'created_at' => $this->delivery->created_at->toIso8601String(),
];
}
/**
* The event's broadcast name.
*/
public function broadcastAs(): string
{
return 'delivery.created';
}
}

View File

@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Modules\RestaurantDelivery\Enums\DeliveryStatus;
use Modules\RestaurantDelivery\Models\Delivery;
class DeliveryStatusChanged implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public readonly Delivery $delivery,
public readonly ?DeliveryStatus $previousStatus = null,
public readonly ?array $metadata = null
) {}
/**
* Get the channels the event should broadcast on.
*/
public function broadcastOn(): array
{
$channels = [
new Channel("delivery.{$this->delivery->tracking_code}"),
new PrivateChannel("restaurant.{$this->delivery->restaurant_id}.deliveries"),
];
if ($this->delivery->rider_id) {
$channels[] = new PrivateChannel("rider.{$this->delivery->rider_id}.deliveries");
}
return $channels;
}
/**
* Get the data to broadcast.
*/
public function broadcastWith(): array
{
return [
'delivery_id' => $this->delivery->id,
'tracking_code' => $this->delivery->tracking_code,
'status' => $this->delivery->status->value,
'status_label' => $this->delivery->status->label(),
'status_description' => $this->delivery->status->description(),
'status_color' => $this->delivery->status->color(),
'previous_status' => $this->previousStatus?->value,
'rider_id' => $this->delivery->rider_id,
'changed_at' => now()->toIso8601String(),
'metadata' => $this->metadata,
];
}
/**
* The event's broadcast name.
*/
public function broadcastAs(): string
{
return 'delivery.status.changed';
}
}

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Modules\RestaurantDelivery\Models\Rider;
class RiderLocationUpdated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public readonly Rider $rider,
public readonly float $latitude,
public readonly float $longitude,
public readonly ?float $speed = null,
public readonly ?float $bearing = null
) {}
/**
* Get the channels the event should broadcast on.
*/
public function broadcastOn(): array
{
$channels = [
new PrivateChannel("rider.{$this->rider->id}.location"),
];
// Broadcast to all active delivery channels for this rider
foreach ($this->rider->activeDeliveries as $delivery) {
$channels[] = new Channel("delivery.{$delivery->tracking_code}");
}
return $channels;
}
/**
* Get the data to broadcast.
*/
public function broadcastWith(): array
{
return [
'rider_id' => $this->rider->id,
'location' => [
'latitude' => $this->latitude,
'longitude' => $this->longitude,
'speed' => $this->speed,
'bearing' => $this->bearing,
],
'timestamp' => now()->toIso8601String(),
];
}
/**
* The event's broadcast name.
*/
public function broadcastAs(): string
{
return 'rider.location.updated';
}
}

View File

@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Modules\RestaurantDelivery\Models\DeliveryRating;
class RiderRated implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public readonly DeliveryRating $rating
) {}
/**
* Get the channels the event should broadcast on.
*/
public function broadcastOn(): array
{
return [
new PrivateChannel("rider.{$this->rating->rider_id}.ratings"),
];
}
/**
* Get the data to broadcast.
*/
public function broadcastWith(): array
{
return [
'rating_id' => $this->rating->id,
'delivery_id' => $this->rating->delivery_id,
'rider_id' => $this->rating->rider_id,
'overall_rating' => $this->rating->overall_rating,
'has_review' => ! empty($this->rating->review),
'created_at' => $this->rating->created_at->toIso8601String(),
];
}
/**
* The event's broadcast name.
*/
public function broadcastAs(): string
{
return 'rider.rated';
}
}

View File

@@ -0,0 +1,56 @@
<?php
declare(strict_types=1);
namespace Modules\RestaurantDelivery\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
use Modules\RestaurantDelivery\Models\DeliveryTip;
class TipReceived implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public function __construct(
public readonly DeliveryTip $tip
) {}
/**
* Get the channels the event should broadcast on.
*/
public function broadcastOn(): array
{
return [
new PrivateChannel("rider.{$this->tip->rider_id}.tips"),
];
}
/**
* Get the data to broadcast.
*/
public function broadcastWith(): array
{
return [
'tip_id' => $this->tip->id,
'delivery_id' => $this->tip->delivery_id,
'rider_id' => $this->tip->rider_id,
'amount' => $this->tip->amount,
'rider_amount' => $this->tip->rider_amount,
'currency' => $this->tip->currency,
'message' => $this->tip->message,
'created_at' => $this->tip->created_at->toIso8601String(),
];
}
/**
* The event's broadcast name.
*/
public function broadcastAs(): string
{
return 'tip.received';
}
}