182 lines
4.4 KiB
PHP
182 lines
4.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Department;
|
|
use App\Models\Vehicle;
|
|
use App\Models\Tag;
|
|
use App\Helpers\StringHelper;
|
|
|
|
class VehicleController extends PostController
|
|
{
|
|
public function __construct()
|
|
{
|
|
$this->middleware(['auth' => 'vehiclePermissions'])->except('index', 'show');
|
|
|
|
// Model
|
|
$this->modelType = StringHelper::toURL(__('models.vehicle'));
|
|
$this->modelData = [
|
|
'departments' => [
|
|
'type' => 'inputSelect',
|
|
'label' => __('models.department'),
|
|
'foreign' => [
|
|
'class' => Tag::class,
|
|
'model' => 'tags',
|
|
'column' => 'name',
|
|
'order' => [
|
|
'column' => 'name',
|
|
'direction' => 'ASC'
|
|
],
|
|
'conditions' => [
|
|
[
|
|
'column' => 'type',
|
|
'value' => 'abteilung',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
'content.kurzbezeichnung' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.short designation'),
|
|
'placeholder' => 'LF-16/12',
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'title' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.name'),
|
|
'placeholder' => __('models.fire truck'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.funkrufname' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.radio call'),
|
|
'placeholder' => __('models.radio call example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.mannschaft' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.crew'),
|
|
'placeholder' => __('models.crew example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.hersteller' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.manufacturer'),
|
|
'placeholder' => __('models.manufacturer example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.aufbau' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.composition'),
|
|
'placeholder' => __('models.composition example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.baujahr' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.construction year'),
|
|
'placeholder' => __('models.construction year example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.leistung' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.power'),
|
|
'placeholder' => __('models.power example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.gewicht' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.weight'),
|
|
'placeholder' => __('models.weight example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
'content.einsatz' => [
|
|
'type' => 'inputText',
|
|
'label' => __('models.operation'),
|
|
'placeholder' => __('models.operation example'),
|
|
'validation' => [
|
|
'rules' => 'required|min:3',
|
|
]
|
|
],
|
|
];
|
|
|
|
// URL options
|
|
$this->url = 'vehicle';
|
|
$this->route = StringHelper::toURL(__('models.vehicle'));
|
|
|
|
$this->adminIndexOptions = [
|
|
'orderBy' => 'updated_at',
|
|
'orderDirection' => 'DESC',
|
|
'paginate' => 10,
|
|
'listdata' => [
|
|
'title' => [],
|
|
'departments' => [],
|
|
'user' => [
|
|
'label' => __('general.author'),
|
|
'foreign' => [
|
|
'model' => 'audits',
|
|
'column' => 'name',
|
|
'index' => 'last'
|
|
],
|
|
],
|
|
'updated_at' => [
|
|
'label' => __('admin.last modified')
|
|
],
|
|
'published' => [
|
|
'label' => __('admin.published'),
|
|
]
|
|
]
|
|
];
|
|
|
|
$this->indexOptions = [
|
|
'orderBy' => 'title',
|
|
'orderDirection' => 'ASC',
|
|
'paginate' => 9,
|
|
'view' => 'inc.views.cardPreviewContainer',
|
|
'filter' => [
|
|
'departments'=> [
|
|
'type' => 'select',
|
|
]
|
|
]
|
|
];
|
|
|
|
$this->detailsOptions = [
|
|
'view' => 'inc.views.details',
|
|
'similar' => [
|
|
'tag' => 'departments',
|
|
'label' => __('models.further vehicles from department')
|
|
],
|
|
'further' => [
|
|
'type' => 'einsatz',
|
|
'limit' => 3,
|
|
'label' => __('models.operations with this vehicle')
|
|
],
|
|
];
|
|
|
|
// Publishing
|
|
$this->publishOptions = [
|
|
'date' => 'now'
|
|
];
|
|
|
|
parent::__construct();
|
|
}
|
|
}
|