* Add public/private pages #641 * Cleanup the form requests
This commit is contained in:
11
app/Models/Enums/PageType.php
Normal file
11
app/Models/Enums/PageType.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Enums;
|
||||
|
||||
use App\Contracts\Enum;
|
||||
|
||||
class PageType extends Enum
|
||||
{
|
||||
public const HTML = 0;
|
||||
public const MARKDOWN = 1;
|
||||
}
|
||||
@@ -4,6 +4,8 @@ namespace App\Models\Observers;
|
||||
|
||||
/**
|
||||
* Create a slug from a name
|
||||
*
|
||||
* @property object attributes
|
||||
*/
|
||||
class Sluggable
|
||||
{
|
||||
|
||||
41
app/Models/Page.php
Normal file
41
app/Models/Page.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* @property int id
|
||||
* @property string name
|
||||
* @property string slug
|
||||
* @property string icon
|
||||
* @property int type
|
||||
* @property bool public
|
||||
* @property bool enabled
|
||||
* @property string body
|
||||
*/
|
||||
class Page extends Model
|
||||
{
|
||||
public $table = 'pages';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'slug',
|
||||
'type',
|
||||
'icon',
|
||||
'public',
|
||||
'body',
|
||||
'enabled',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'type' => 'integer',
|
||||
'public' => 'boolean',
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
public static $rules = [
|
||||
'name' => 'required|unique:pages,name',
|
||||
'body' => 'required',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user