You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.3 KiB
60 lines
1.3 KiB
|
2 weeks ago
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
|
|
||
|
|
/** @property-read CrawlSource|null $crawlSource */
|
||
|
|
|
||
|
|
class CrawlJob extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'target_type',
|
||
|
|
'request_url',
|
||
|
|
'platform_url',
|
||
|
|
'keyword',
|
||
|
|
'params',
|
||
|
|
'crawl_source_id',
|
||
|
|
'adapter_code',
|
||
|
|
'admin_user_id',
|
||
|
|
'status',
|
||
|
|
'papers_created',
|
||
|
|
'items_fetched',
|
||
|
|
'items_imported',
|
||
|
|
'result_summary',
|
||
|
|
'completed_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'admin_user_id' => 'integer',
|
||
|
|
'crawl_source_id' => 'integer',
|
||
|
|
'params' => 'array',
|
||
|
|
'papers_created' => 'integer',
|
||
|
|
'items_fetched' => 'integer',
|
||
|
|
'items_imported' => 'integer',
|
||
|
|
'completed_at' => 'datetime',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function adminUser(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(AdminUser::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function crawlSource(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(CrawlSource::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function items(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(CrawlJobItem::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function papers(): HasMany
|
||
|
|
{
|
||
|
|
return $this->hasMany(Paper::class);
|
||
|
|
}
|
||
|
|
}
|