Add (post manage)
Add (post country viewing)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
/**
|
||||
* Class Author
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $avatar
|
||||
@@ -21,30 +21,27 @@
|
||||
* @property bool $public
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Collection|Post[] $posts
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Author extends Model
|
||||
{
|
||||
protected $table = 'authors';
|
||||
protected $table = 'authors';
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'bool',
|
||||
'public' => 'bool'
|
||||
];
|
||||
protected $casts = [
|
||||
'enabled' => 'bool',
|
||||
'public' => 'bool',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'avatar',
|
||||
'bio',
|
||||
'enabled',
|
||||
'public'
|
||||
];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'avatar',
|
||||
'bio',
|
||||
'enabled',
|
||||
'public',
|
||||
];
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(Post::class);
|
||||
}
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(Post::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
|
||||
/**
|
||||
* Class Category
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||
|
||||
/**
|
||||
* Class CountryLocale
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use AlAminFirdows\LaravelEditorJs\Facades\LaravelEditorJs;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Post
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property string|null $title
|
||||
* @property string|null $slug
|
||||
@@ -27,44 +28,60 @@
|
||||
* @property string $status
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Author|null $author
|
||||
* @property Collection|PostCategory[] $post_categories
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class Post extends Model
|
||||
{
|
||||
protected $table = 'posts';
|
||||
protected $table = 'posts';
|
||||
|
||||
protected $casts = [
|
||||
'author_id' => 'int',
|
||||
'body' => 'json',
|
||||
'comment_count' => 'int',
|
||||
'likes_count' => 'int'
|
||||
];
|
||||
protected $casts = [
|
||||
'author_id' => 'int',
|
||||
'body' => 'json',
|
||||
'comment_count' => 'int',
|
||||
'likes_count' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'excerpt',
|
||||
'author_id',
|
||||
'featured_image',
|
||||
'editor',
|
||||
'body',
|
||||
'post_format',
|
||||
'comment_count',
|
||||
'likes_count',
|
||||
'status'
|
||||
];
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'slug',
|
||||
'excerpt',
|
||||
'author_id',
|
||||
'featured_image',
|
||||
'editor',
|
||||
'body',
|
||||
'post_format',
|
||||
'comment_count',
|
||||
'likes_count',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function author()
|
||||
{
|
||||
return $this->belongsTo(Author::class);
|
||||
}
|
||||
protected $appends = [
|
||||
'html_body',
|
||||
];
|
||||
|
||||
public function post_categories()
|
||||
{
|
||||
return $this->hasMany(PostCategory::class);
|
||||
}
|
||||
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)) {
|
||||
return LaravelEditorJs::render($this->body);
|
||||
}
|
||||
|
||||
return '';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,39 +11,36 @@
|
||||
|
||||
/**
|
||||
* Class PostCategory
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $post_id
|
||||
* @property int $category_id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
*
|
||||
* @property Category $category
|
||||
* @property Post $post
|
||||
*
|
||||
* @package App\Models
|
||||
*/
|
||||
class PostCategory extends Model
|
||||
{
|
||||
protected $table = 'post_categories';
|
||||
protected $table = 'post_categories';
|
||||
|
||||
protected $casts = [
|
||||
'post_id' => 'int',
|
||||
'category_id' => 'int'
|
||||
];
|
||||
protected $casts = [
|
||||
'post_id' => 'int',
|
||||
'category_id' => 'int',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'post_id',
|
||||
'category_id'
|
||||
];
|
||||
protected $fillable = [
|
||||
'post_id',
|
||||
'category_id',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class);
|
||||
}
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(Post::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user