Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| WebhookEvent | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| casts | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| integration | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use App\Enums\WebhookStatus; |
| 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 7 | use Illuminate\Database\Eloquent\Model; |
| 8 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 9 | |
| 10 | class WebhookEvent extends Model |
| 11 | { |
| 12 | use HasFactory; |
| 13 | |
| 14 | protected $fillable = [ |
| 15 | 'store_integration_id', 'provider_slug', 'event', 'external_id', 'headers', 'payload', |
| 16 | 'status', 'processed_at', 'error_message', |
| 17 | ]; |
| 18 | |
| 19 | protected function casts(): array |
| 20 | { |
| 21 | return [ |
| 22 | 'headers' => 'array', |
| 23 | 'payload' => 'array', |
| 24 | 'status' => WebhookStatus::class, |
| 25 | 'processed_at' => 'datetime', |
| 26 | ]; |
| 27 | } |
| 28 | |
| 29 | public function integration(): BelongsTo { return $this->belongsTo(StoreIntegration::class, 'store_integration_id'); } |
| 30 | } |