This commit is contained in:
2023-11-24 20:49:19 +08:00
parent ca5219cb93
commit be14f5fdb1
65 changed files with 1991 additions and 2214 deletions

View File

@@ -11,25 +11,23 @@
/**
* Class DailyTaskSchedule
*
*
* @property int $id
* @property string $task
* @property Carbon $next_run_time
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @package App\Models
*/
class DailyTaskSchedule extends Model
{
protected $table = 'daily_task_schedules';
protected $table = 'daily_task_schedules';
protected $casts = [
'next_run_time' => 'datetime'
];
protected $casts = [
'next_run_time' => 'datetime',
];
protected $fillable = [
'task',
'next_run_time'
];
protected $fillable = [
'task',
'next_run_time',
];
}

View File

@@ -36,4 +36,3 @@ class FailedJob extends Model
'failed_at' => 'datetime',
];
}

View File

@@ -152,36 +152,35 @@ public function getHtmlBodyAttribute()
}
});
// Modify the DOM by wrapping the <img> tags inside a <figure> and adding the desired structure
$crawler->filter('img')->each(function (Crawler $node) {
$imgElement = $node->getNode(0);
// Update the class of the <img>
$existingClasses = $imgElement->getAttribute('class');
$newClasses = 'img-fluid rounded-2 shadow-sm mb-2';
$updatedClasses = ($existingClasses ? $existingClasses.' ' : '').$newClasses;
$imgElement->setAttribute('class', $updatedClasses);
// Create a new <figure> element
$figureElement = new \DOMElement('figure');
$imgElement->parentNode->insertBefore($figureElement, $imgElement);
// Move the <img> inside the <figure>
$figureElement->appendChild($imgElement);
$figureElement->setAttribute('class', 'image');
// Create a new <footer> element inside <figure> without directly setting its content
$footerElement = $imgElement->ownerDocument->createElement('footer');
$figureElement->appendChild($footerElement);
// Add the content to <footer> using createTextNode to ensure special characters are handled
$footerText = $imgElement->ownerDocument->createTextNode($imgElement->getAttribute('alt'));
$footerElement->appendChild($footerText);
// Set the class attribute for <footer>
$footerElement->setAttribute('class', 'image-caption');
});
// Modify the DOM by wrapping the <img> tags inside a <figure> and adding the desired structure
$crawler->filter('img')->each(function (Crawler $node) {
$imgElement = $node->getNode(0);
// Update the class of the <img>
$existingClasses = $imgElement->getAttribute('class');
$newClasses = 'img-fluid rounded-2 shadow-sm mb-2';
$updatedClasses = ($existingClasses ? $existingClasses.' ' : '').$newClasses;
$imgElement->setAttribute('class', $updatedClasses);
// Create a new <figure> element
$figureElement = new \DOMElement('figure');
$imgElement->parentNode->insertBefore($figureElement, $imgElement);
// Move the <img> inside the <figure>
$figureElement->appendChild($imgElement);
$figureElement->setAttribute('class', 'image');
// Create a new <footer> element inside <figure> without directly setting its content
$footerElement = $imgElement->ownerDocument->createElement('footer');
$figureElement->appendChild($footerElement);
// Add the content to <footer> using createTextNode to ensure special characters are handled
$footerText = $imgElement->ownerDocument->createTextNode($imgElement->getAttribute('alt'));
$footerElement->appendChild($footerText);
// Set the class attribute for <footer>
$footerElement->setAttribute('class', 'image-caption');
});
// Add Bootstrap 5 styling to tables
$crawler->filter('table')->each(function (Crawler $node) {

View File

@@ -11,7 +11,7 @@
/**
* Class ShopeeSellerCategory
*
*
* @property int $id
* @property string $seller
* @property int $category_id
@@ -19,30 +19,27 @@
* @property int $write_counts
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Category $category
*
* @package App\Models
*/
class ShopeeSellerCategory extends Model
{
protected $table = 'shopee_seller_categories';
protected $table = 'shopee_seller_categories';
protected $casts = [
'category_id' => 'int',
'last_ai_written_at' => 'datetime',
'write_counts' => 'int'
];
protected $casts = [
'category_id' => 'int',
'last_ai_written_at' => 'datetime',
'write_counts' => 'int',
];
protected $fillable = [
'seller',
'category_id',
'last_ai_written_at',
'write_counts'
];
protected $fillable = [
'seller',
'category_id',
'last_ai_written_at',
'write_counts',
];
public function category()
{
return $this->belongsTo(Category::class);
}
public function category()
{
return $this->belongsTo(Category::class);
}
}

View File

@@ -42,7 +42,7 @@ class ShopeeSellerScrape extends Model
'epoch',
'filename',
'last_ai_written_at',
'write_counts'
'write_counts',
];
public function category()