91 lines
1.8 KiB
PHP
91 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\Tag;
|
|
use App\Models\BreakingNews;
|
|
use App\Helpers\StringHelper;
|
|
use Spatie\Permission\Models\Permission;
|
|
|
|
class BreakingNewsController extends PostController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware(['auth' => 'breakingNewsPermissions'])->except('index', 'show');
|
|
|
|
// Model
|
|
$this->modelHasFiles = false;
|
|
$this->modelHasPublications = false;
|
|
$this->modelType = StringHelper::toURL(__('models.breaking_news'));
|
|
$this->modelData = [
|
|
'title' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.title'),
|
|
'placeholder' => __('models.title'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content' => [
|
|
'type' => 'inputTextarea',
|
|
'label' => __('models.text'),
|
|
'placeholder' => __('models.text'),
|
|
'toolbar' => [
|
|
[
|
|
'insertfile',
|
|
'undo',
|
|
'redo',
|
|
],
|
|
[
|
|
'bold',
|
|
'italic',
|
|
'strikethrough'
|
|
],
|
|
[
|
|
'link',
|
|
]
|
|
],
|
|
'plugins' =>
|
|
[
|
|
'paste',
|
|
'link'
|
|
],
|
|
'validation' => [
|
|
'rules' => 'required',
|
|
]
|
|
],
|
|
];
|
|
|
|
// URL options
|
|
$this->url = 'breaking_news';
|
|
$this->route = StringHelper::toURL(__('models.breaking_news'));
|
|
|
|
$this->adminIndexOptions = [
|
|
'orderBy' => 'datetime',
|
|
'orderDirection' => 'DESC',
|
|
'paginate' => 10,
|
|
'listdata' => [
|
|
'title' => [],
|
|
'user' => [
|
|
'label' => __('general.author'),
|
|
'foreign' => [
|
|
'model' => 'audits',
|
|
'column' => 'name',
|
|
'index' => 'last'
|
|
],
|
|
],
|
|
'datetime' => [
|
|
'label' => __('general.datetime'),
|
|
],
|
|
'published' => [
|
|
'label' => __('admin.published'),
|
|
]
|
|
]
|
|
];
|
|
|
|
parent::__construct();
|
|
}
|
|
}
|