Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
60.00% |
3 / 5 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| PropertyImportSourceModel | |
60.00% |
3 / 5 |
|
33.33% |
1 / 3 |
3.58 | |
0.00% |
0 / 1 |
| casts | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| newFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| property | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace ImovelZapAi\Importing\Infrastructure\Persistence\Eloquent; |
| 6 | |
| 7 | use Database\Factories\PropertyImportSourceFactory; |
| 8 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 9 | use Illuminate\Database\Eloquent\Model; |
| 10 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 11 | use ImovelZapAi\Properties\Infrastructure\Persistence\Eloquent\PropertyModel; |
| 12 | use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\BelongsToTenant; |
| 13 | use ImovelZapAi\Shared\Infrastructure\Persistence\Concerns\HasUuidPrimaryKey; |
| 14 | |
| 15 | class PropertyImportSourceModel extends Model |
| 16 | { |
| 17 | use BelongsToTenant; |
| 18 | use HasFactory; |
| 19 | use HasUuidPrimaryKey; |
| 20 | |
| 21 | protected $table = 'property_import_sources'; |
| 22 | |
| 23 | protected $fillable = [ |
| 24 | 'tenant_id', |
| 25 | 'property_id', |
| 26 | 'source', |
| 27 | 'external_id', |
| 28 | 'payload_hash', |
| 29 | 'last_seen_at', |
| 30 | ]; |
| 31 | |
| 32 | protected function casts(): array |
| 33 | { |
| 34 | return [ |
| 35 | 'last_seen_at' => 'datetime', |
| 36 | ]; |
| 37 | } |
| 38 | |
| 39 | protected static function newFactory(): PropertyImportSourceFactory |
| 40 | { |
| 41 | return PropertyImportSourceFactory::new(); |
| 42 | } |
| 43 | |
| 44 | public function property(): BelongsTo |
| 45 | { |
| 46 | return $this->belongsTo(PropertyModel::class, 'property_id'); |
| 47 | } |
| 48 | } |