Added blog, pages, menu, category
This commit is contained in:
32
app/Models/Blog.php
Normal file
32
app/Models/Blog.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Blog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'post',
|
||||
'slug',
|
||||
'content',
|
||||
'meta',
|
||||
'custom_header',
|
||||
'post_image',
|
||||
'is_published',
|
||||
'category_id',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'meta' => 'json'
|
||||
];
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
}
|
||||
22
app/Models/Category.php
Normal file
22
app/Models/Category.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Category extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'is_active'
|
||||
];
|
||||
|
||||
public function blogs(): HasMany {
|
||||
return $this->hasMany(Blog::class);
|
||||
}
|
||||
}
|
||||
@@ -72,15 +72,9 @@ class Email extends Model
|
||||
$allowed = explode(',', 'doc,docx,xls,xlsx,ppt,pptx,xps,pdf,dxf,ai,psd,eps,ps,svg,ttf,zip,rar,tar,gzip,mp3,mpeg,wav,ogg,jpeg,jpg,png,gif,bmp,tif,webm,mpeg4,3gpp,mov,avi,mpegs,wmv,flx,txt');
|
||||
$connection = \App\Models\Email::connectMailBox();
|
||||
$mailbox = $connection->getMailbox('INBOX');
|
||||
// $search = new SearchExpression();
|
||||
// $email = "gegsaf@e-pool.co.uk";
|
||||
// $search->addCondition(new To($email));
|
||||
|
||||
$messages = $mailbox->getMessages();
|
||||
//$messages = $mailbox->getMessages($search, \SORTDATE, true);
|
||||
|
||||
$result = '';
|
||||
|
||||
foreach ($messages as $message) {
|
||||
|
||||
$sender = $message->getFrom();
|
||||
@@ -360,8 +354,6 @@ class Email extends Model
|
||||
|
||||
public static function deleteBulkMailboxes()
|
||||
{
|
||||
|
||||
|
||||
$foldersToClean = ['Trash', 'ZDUMP', 'INBOX'];
|
||||
$cutoff = (new \DateTime())->modify('-3 hours');
|
||||
$totalDeleted = 0;
|
||||
@@ -413,7 +405,6 @@ class Email extends Model
|
||||
public static function mailToDBStatus(): bool
|
||||
{
|
||||
$latestRecord = self::orderBy('timestamp', 'desc')->first();
|
||||
|
||||
if (!$latestRecord) {
|
||||
return false;
|
||||
}
|
||||
@@ -421,7 +412,6 @@ class Email extends Model
|
||||
$currentTime = Carbon::now('UTC');
|
||||
$lastRecordTime = Carbon::parse($latestRecord->timestamp);
|
||||
|
||||
// Check if the last record was added within the last 1 hour
|
||||
if ($lastRecordTime->diffInMinutes($currentTime) < 5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
23
app/Models/Menu.php
Normal file
23
app/Models/Menu.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Menu extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'url',
|
||||
'new_tab',
|
||||
'parent'
|
||||
];
|
||||
|
||||
public function parentname()
|
||||
{
|
||||
return $this->belongsTo(Menu::class, 'parent');
|
||||
}
|
||||
}
|
||||
26
app/Models/Page.php
Normal file
26
app/Models/Page.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'content',
|
||||
'parent',
|
||||
'meta',
|
||||
'custom_header',
|
||||
'page_image',
|
||||
'is_published'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'meta' => 'json'
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user