Sync
This commit is contained in:
82
app/Models/AiTool.php
Normal file
82
app/Models/AiTool.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AiTool
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $category_id
|
||||
* @property int $url_to_crawl_id
|
||||
* @property string|null $screenshot_img
|
||||
* @property bool $is_ai_tool
|
||||
* @property string $tool_name
|
||||
* @property string $is_app_web_both
|
||||
* @property string|null $tagline
|
||||
* @property string|null $summary
|
||||
* @property string $pricing_type
|
||||
* @property string|null $keyword_string
|
||||
* @property string|null $qna
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Category $category
|
||||
* @property UrlToCrawl $url_to_crawl
|
||||
* @property Collection|SearchEmbedding[] $search_embeddings
|
||||
* @property Collection|AiToolKeyword[] $ai_tool_keywords
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class AiTool extends Model
|
||||
{
|
||||
protected $table = 'ai_tools';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'url_to_crawl_id' => 'int',
|
||||
'is_ai_tool' => 'bool',
|
||||
'qna' => 'object'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'url_to_crawl_id',
|
||||
'screenshot_img',
|
||||
'is_ai_tool',
|
||||
'tool_name',
|
||||
'is_app_web_both',
|
||||
'tagline',
|
||||
'summary',
|
||||
'pricing_type',
|
||||
'keyword_string',
|
||||
'qna'
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function url_to_crawl()
|
||||
{
|
||||
return $this->belongsTo(UrlToCrawl::class);
|
||||
}
|
||||
|
||||
public function search_embeddings()
|
||||
{
|
||||
return $this->hasMany(SearchEmbedding::class);
|
||||
}
|
||||
|
||||
public function ai_tool_keywords()
|
||||
{
|
||||
return $this->hasMany(AiToolKeyword::class);
|
||||
}
|
||||
}
|
||||
@@ -10,28 +10,32 @@
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PostCategory
|
||||
* Class AiToolKeyword
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $post_id
|
||||
* @property int $category_id
|
||||
* @property int $ai_tool_id
|
||||
* @property string $value
|
||||
* @property string $value_lowercased
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category $category
|
||||
* @property Post $post
|
||||
* @property AiTool $ai_tool
|
||||
*/
|
||||
class PostCategory extends Model
|
||||
class AiToolKeyword extends Model
|
||||
{
|
||||
protected $table = 'post_categories';
|
||||
protected $table = 'ai_tool_keywords';
|
||||
|
||||
protected $casts = [
|
||||
'post_id' => 'int',
|
||||
'category_id' => 'int',
|
||||
'ai_tool_id' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'post_id',
|
||||
'category_id',
|
||||
'ai_tool_id',
|
||||
'value',
|
||||
'value_lowercased',
|
||||
];
|
||||
|
||||
public function category()
|
||||
@@ -39,8 +43,8 @@ public function category()
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function post()
|
||||
public function ai_tool()
|
||||
{
|
||||
return $this->belongsTo(Post::class);
|
||||
return $this->belongsTo(AiTool::class);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AiWriteup
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $source
|
||||
* @property string $source_url
|
||||
* @property int $category_id
|
||||
* @property string $title
|
||||
* @property string $editor_format
|
||||
* @property string|null $excerpt
|
||||
* @property string|null $featured_image
|
||||
* @property array|null $body
|
||||
* @property float $cost
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category $category
|
||||
*/
|
||||
class AiWriteup extends Model
|
||||
{
|
||||
protected $table = 'ai_writeups';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'body' => 'json',
|
||||
'cost' => 'float',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'source',
|
||||
'source_url',
|
||||
'category_id',
|
||||
'title',
|
||||
'editor_format',
|
||||
'excerpt',
|
||||
'featured_image',
|
||||
'body',
|
||||
'cost',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Author
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $avatar
|
||||
* @property string $bio
|
||||
* @property bool $enabled
|
||||
* @property bool $public
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Collection|Post[] $posts
|
||||
*/
|
||||
class Author extends Model
|
||||
{
|
||||
protected $table = 'authors';
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'bool',
|
||||
'public' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'avatar',
|
||||
'bio',
|
||||
'enabled',
|
||||
'public',
|
||||
];
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(Post::class);
|
||||
}
|
||||
}
|
||||
@@ -7,18 +7,18 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kalnoy\Nestedset\NodeTrait;
|
||||
|
||||
/**
|
||||
* Class Category
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $country_locale_id
|
||||
* @property string|null $name
|
||||
* @property string $short_name
|
||||
* @property string $name
|
||||
* @property string|null $emoji
|
||||
* @property string|null $slug
|
||||
* @property string|null $description
|
||||
* @property bool $enabled
|
||||
* @property bool $is_top
|
||||
* @property int $_lft
|
||||
@@ -27,16 +27,14 @@
|
||||
* @property string|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property CountryLocale $country_locale
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
use Cachable, SoftDeletes;
|
||||
use NodeTrait, SoftDeletes;
|
||||
|
||||
protected $table = 'categories';
|
||||
|
||||
protected $casts = [
|
||||
'country_locale_id' => 'int',
|
||||
'enabled' => 'bool',
|
||||
'is_top' => 'bool',
|
||||
'_lft' => 'int',
|
||||
@@ -45,10 +43,8 @@ class Category extends Model
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'country_locale_id',
|
||||
'name',
|
||||
'short_name',
|
||||
'emoji',
|
||||
'slug',
|
||||
'description',
|
||||
'enabled',
|
||||
@@ -57,9 +53,4 @@ class Category extends Model
|
||||
'_rgt',
|
||||
'parent_id',
|
||||
];
|
||||
|
||||
public function country_locale()
|
||||
{
|
||||
return $this->belongsTo(CountryLocale::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class CountryLocale
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $slug
|
||||
* @property string $i18n
|
||||
* @property bool $enabled
|
||||
* @property string|null $deleted_at
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*/
|
||||
class CountryLocale extends Model
|
||||
{
|
||||
use Cachable, SoftDeletes;
|
||||
|
||||
protected $table = 'country_locales';
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'i18n',
|
||||
'lang',
|
||||
'country_iso',
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class DailyTaskSchedule
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $task
|
||||
* @property Carbon $next_run_time
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*/
|
||||
class DailyTaskSchedule extends Model
|
||||
{
|
||||
protected $table = 'daily_task_schedules';
|
||||
|
||||
protected $casts = [
|
||||
'next_run_time' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'task',
|
||||
'next_run_time',
|
||||
];
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DraftPost extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FailedJob extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'failed_jobs';
|
||||
|
||||
/**
|
||||
* The attributes that aren't mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* Indicates if the model should be timestamped.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Casts attributes to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'failed_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
@@ -1,236 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use AlAminFirdows\LaravelEditorJs\Facades\LaravelEditorJs;
|
||||
use Carbon\Carbon;
|
||||
use GrahamCampbell\Markdown\Facades\Markdown;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Feed\Feedable;
|
||||
use Spatie\Feed\FeedItem;
|
||||
use Symfony\Component\DomCrawler\Crawler;
|
||||
|
||||
/**
|
||||
* Class Post
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $title
|
||||
* @property string|null $slug
|
||||
* @property string|null $excerpt
|
||||
* @property int|null $author_id
|
||||
* @property string $featured_image
|
||||
* @property string $editor
|
||||
* @property array|null $body
|
||||
* @property string $post_format
|
||||
* @property int $comment_count
|
||||
* @property int $likes_count
|
||||
* @property string $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Author|null $author
|
||||
* @property Collection|PostCategory[] $post_categories
|
||||
*/
|
||||
class Post extends Model implements Feedable
|
||||
{
|
||||
protected $table = 'posts';
|
||||
|
||||
protected $casts = [
|
||||
'author_id' => 'int',
|
||||
'body' => 'json',
|
||||
'comment_count' => 'int',
|
||||
'likes_count' => 'int',
|
||||
'featured' => 'bool',
|
||||
'publish_date' => 'datetime',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'cliffhanger',
|
||||
'excerpt',
|
||||
'author_id',
|
||||
'featured_image',
|
||||
'editor',
|
||||
'body',
|
||||
'post_format',
|
||||
'comment_count',
|
||||
'likes_count',
|
||||
'status',
|
||||
'featured',
|
||||
'publish_date',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
//'html_body',
|
||||
];
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->belongsTo(Author::class);
|
||||
}
|
||||
|
||||
public function post_categories()
|
||||
{
|
||||
return $this->hasMany(PostCategory::class);
|
||||
}
|
||||
|
||||
public function post_category()
|
||||
{
|
||||
return $this->hasOne(PostCategory::class);
|
||||
}
|
||||
|
||||
public function getHtmlBodyAttribute()
|
||||
{
|
||||
if (! is_empty($this->body)) {
|
||||
if ($this->editor == 'editorjs') {
|
||||
return LaravelEditorJs::render(json_encode($this->body));
|
||||
} elseif ($this->editor == 'markdown') {
|
||||
//dd($this->body);
|
||||
|
||||
$html = Markdown::convert($this->body)->getContent();
|
||||
|
||||
//dd($html);
|
||||
|
||||
$html = str_replace('\\n', "\n", $html);
|
||||
|
||||
$crawler = new Crawler($html);
|
||||
|
||||
$firstHeaderProcessed = false;
|
||||
|
||||
$crawler->filter('h1, h2, h3, h4, h5, h6')->each(function (Crawler $node) use (&$firstHeaderProcessed) {
|
||||
$element = $node->getNode(0);
|
||||
|
||||
// Create a new h3 element
|
||||
$newElement = $element->ownerDocument->createElement('h3');
|
||||
|
||||
// Copy attributes from the old header element to the new h3 element
|
||||
foreach ($element->attributes as $attribute) {
|
||||
$newElement->setAttribute($attribute->name, $attribute->value);
|
||||
}
|
||||
|
||||
// Add the 'fw-bold' class to the new h3 element
|
||||
$existingClasses = $element->getAttribute('class');
|
||||
$newClass = 'fw-bold';
|
||||
$updatedClasses = ($existingClasses ? $existingClasses.' ' : '').$newClass;
|
||||
$newElement->setAttribute('class', $updatedClasses);
|
||||
|
||||
// Move child nodes from the old header element to the new h3 element
|
||||
while ($element->firstChild) {
|
||||
$newElement->appendChild($element->firstChild);
|
||||
}
|
||||
|
||||
// Replace the old header element with the new h3 element in the DOM
|
||||
$element->parentNode->replaceChild($newElement, $element);
|
||||
|
||||
// Only for the first header
|
||||
if (! $firstHeaderProcessed) {
|
||||
$firstHeaderProcessed = true;
|
||||
|
||||
$nextSibling = $newElement->nextSibling;
|
||||
while ($nextSibling) {
|
||||
if ($nextSibling->nodeType === XML_ELEMENT_NODE) {
|
||||
if ($nextSibling->nodeName === 'p' && ($nextSibling->getElementsByTagName('img')->length > 0 || $nextSibling->getElementsByTagName('figure')->length > 0)) {
|
||||
// Remove <p> if it contains an <img> or <figure> directly
|
||||
$nextSibling->parentNode->removeChild($nextSibling);
|
||||
break;
|
||||
} elseif ($nextSibling->nodeName === 'img' || $nextSibling->nodeName === 'figure') {
|
||||
// Direct <img> or <figure> without wrapping <p>
|
||||
$newElement->parentNode->removeChild($nextSibling);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$nextSibling = $nextSibling->nextSibling;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 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) {
|
||||
$tableElement = $node->getNode(0);
|
||||
$existingClasses = $tableElement->getAttribute('class');
|
||||
$newClass = 'table';
|
||||
$updatedClasses = ($existingClasses ? $existingClasses.' ' : '').$newClass;
|
||||
$tableElement->setAttribute('class', $updatedClasses);
|
||||
});
|
||||
|
||||
// Convert the modified DOM back to HTML
|
||||
$updatedHtml = '';
|
||||
foreach ($crawler as $domElement) {
|
||||
$updatedHtml .= $domElement->ownerDocument->saveHTML($domElement);
|
||||
}
|
||||
|
||||
return $updatedHtml;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
public function getFeaturedImageLqipAttribute()
|
||||
{
|
||||
$featuredImage = $this->featured_image;
|
||||
|
||||
// Get the extension of the original featured image
|
||||
$extension = pathinfo($featuredImage, PATHINFO_EXTENSION);
|
||||
|
||||
// Append "_lqip" before the extension to create the LQIP image URL
|
||||
return str_replace(".{$extension}", "_lqip.{$extension}", $featuredImage);
|
||||
}
|
||||
|
||||
public function toFeedItem(): FeedItem
|
||||
{
|
||||
return FeedItem::create()
|
||||
->id($this->id)
|
||||
->title($this->title)
|
||||
->summary($this->excerpt)
|
||||
->updated($this->publish_date)
|
||||
->link(route('home.country.post', ['country' => $this->post_category?->category?->country_locale_slug, 'post_slug' => $this->slug]))
|
||||
->authorName($this->author->name);
|
||||
}
|
||||
|
||||
public static function getFeedItems()
|
||||
{
|
||||
return Post::where('status', 'publish')->latest()->get();
|
||||
}
|
||||
}
|
||||
54
app/Models/SearchEmbedding.php
Normal file
54
app/Models/SearchEmbedding.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Pgvector\Laravel\Vector;
|
||||
|
||||
/**
|
||||
* Class SearchEmbedding
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $type
|
||||
* @property int|null $category_id
|
||||
* @property int|null $ai_tool_id
|
||||
* @property string $query
|
||||
* @property USER-DEFINED|null $embedding
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category|null $category
|
||||
* @property AiTool|null $ai_tool
|
||||
*/
|
||||
class SearchEmbedding extends Model
|
||||
{
|
||||
protected $table = 'search_embeddings';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'ai_tool_id' => 'int',
|
||||
'embedding' => Vector::class,
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'category_id',
|
||||
'ai_tool_id',
|
||||
'query',
|
||||
'embedding',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function ai_tool()
|
||||
{
|
||||
return $this->belongsTo(AiTool::class);
|
||||
}
|
||||
}
|
||||
44
app/Models/ServiceCostUsage.php
Normal file
44
app/Models/ServiceCostUsage.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ServiceCostUsage
|
||||
*
|
||||
* @property int $id
|
||||
* @property float $cost
|
||||
* @property string $name
|
||||
* @property string|null $reference_1
|
||||
* @property string|null $reference_2
|
||||
* @property string $output
|
||||
* @property string|null $input_1
|
||||
* @property string|null $input_2
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*/
|
||||
class ServiceCostUsage extends Model
|
||||
{
|
||||
protected $table = 'service_cost_usages';
|
||||
|
||||
protected $casts = [
|
||||
'cost' => 'float',
|
||||
'output' => 'binary',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'cost',
|
||||
'name',
|
||||
'reference_1',
|
||||
'reference_2',
|
||||
'output',
|
||||
'input_1',
|
||||
'input_2',
|
||||
];
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ShopeeSellerCategory
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $seller
|
||||
* @property int $category_id
|
||||
* @property Carbon|null $last_ai_written_at
|
||||
* @property int $write_counts
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category $category
|
||||
*/
|
||||
class ShopeeSellerCategory extends Model
|
||||
{
|
||||
protected $table = 'shopee_seller_categories';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'last_ai_written_at' => 'datetime',
|
||||
'write_counts' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'seller',
|
||||
'category_id',
|
||||
'last_ai_written_at',
|
||||
'write_counts',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ShopeeSellerScrape
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $category_id
|
||||
* @property string $seller
|
||||
* @property string $country_iso
|
||||
* @property int $epoch
|
||||
* @property string $filename
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Category|null $category
|
||||
* @property Collection|ShopeeSellerScrapedImage[] $shopee_seller_scraped_images
|
||||
*/
|
||||
class ShopeeSellerScrape extends Model
|
||||
{
|
||||
protected $table = 'shopee_seller_scrapes';
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'int',
|
||||
'epoch' => 'int',
|
||||
'last_ai_written_at' => 'datetime',
|
||||
'write_counts' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'category_id',
|
||||
'seller',
|
||||
'country_iso',
|
||||
'epoch',
|
||||
'filename',
|
||||
'last_ai_written_at',
|
||||
'write_counts',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function shopee_seller_scraped_images()
|
||||
{
|
||||
return $this->hasMany(ShopeeSellerScrapedImage::class);
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ShopeeSellerScrapedImage
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $shopee_seller_scrape_id
|
||||
* @property string $original_name
|
||||
* @property string|null $image
|
||||
* @property bool $featured
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property ShopeeSellerScrape $shopee_seller_scrape
|
||||
*/
|
||||
class ShopeeSellerScrapedImage extends Model
|
||||
{
|
||||
protected $table = 'shopee_seller_scraped_images';
|
||||
|
||||
protected $casts = [
|
||||
'shopee_seller_scrape_id' => 'int',
|
||||
'featured' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'shopee_seller_scrape_id',
|
||||
'original_name',
|
||||
'image',
|
||||
'featured',
|
||||
];
|
||||
|
||||
public function shopee_seller_scrape()
|
||||
{
|
||||
return $this->belongsTo(ShopeeSellerScrape::class);
|
||||
}
|
||||
}
|
||||
47
app/Models/UrlToCrawl.php
Normal file
47
app/Models/UrlToCrawl.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class UrlToCrawl
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $domain
|
||||
* @property string $url
|
||||
* @property bool $is_crawling
|
||||
* @property bool $is_crawled
|
||||
* @property string|null $output_type
|
||||
* @property string|null $output
|
||||
* @property string|null $metadata
|
||||
* @property string $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*/
|
||||
class UrlToCrawl extends Model
|
||||
{
|
||||
protected $table = 'url_to_crawls';
|
||||
|
||||
protected $casts = [
|
||||
'is_crawling' => 'bool',
|
||||
'is_crawled' => 'bool',
|
||||
'metadata' => 'object',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'domain',
|
||||
'url',
|
||||
'is_crawling',
|
||||
'is_crawled',
|
||||
'output_type',
|
||||
'output',
|
||||
'metadata',
|
||||
'status',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user