Feuerwehr-eppingen/app/Http/Controllers/DepartmentController.php

73 lines
1.5 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\Models\Tag;
use App\Helpers\StringHelper;
class DepartmentController extends TagController
{
public function __construct()
{
$this->middleware(['auth' => 'departmentPermissions'])->except('index', 'show');
// Model
$this->modelType = StringHelper::toURL(__('models.department'));
$this->modelData = [
'name' => [
'label' => __('models.name'),
'type' => 'inputText',
'placeholder' => __('models.department'),
'validation' => [
'rules' => 'required|min:3',
]
],
'instances' => [
'label' => __('models.instances'),
'type' => 'checkboxSelection',
'foreign'=> [
'class' => Tag::class,
'model' => 'tags',
'column' => 'name',
'order' => [
'column' => 'name',
'direction' => 'ASC'
],
'conditions' => [
[
'column' => 'type',
'value' => 'instanz',
],
],
],
],
'order' => [
'type' => 'inputHidden',
]
];
// URL options
$this->url = 'department';
$this->route = StringHelper::toURL(__('models.department'));
$this->adminIndexOptions = [
'orderBy' => 'order',
'orderDirection' => 'ASC',
'paginate' => 10,
'listdata' => [
'name' => [],
'instances' => [],
'order' => [
'label' => __('admin.priority')
],
'updated' => [
'label' => __('admin.last modified')
]
]
];
parent::__construct();
}
}