138 lines
4.7 KiB
PHP
138 lines
4.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Requests\SupportEcosystemPartnerRequest;
|
|
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
|
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
|
|
|
/**
|
|
* Class SupportEcosystemPartnerCrudController
|
|
* @package App\Http\Controllers\Admin
|
|
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
|
|
*/
|
|
class SupportEcosystemPartnerCrudController extends CrudController
|
|
{
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
|
|
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
|
// use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
|
|
|
|
/**
|
|
* Configure the CrudPanel object. Apply settings to all operations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function setup()
|
|
{
|
|
CRUD::setModel(\App\Models\SupportEcosystemPartner::class);
|
|
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-ecosystem-partner');
|
|
CRUD::setEntityNameStrings(trans('backend.support.ecosystem_partner.content.item'), trans('backend.support.ecosystem_partner.content.items'));
|
|
}
|
|
|
|
/**
|
|
* Define what happens when the List operation is loaded.
|
|
*
|
|
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
|
|
* @return void
|
|
*/
|
|
protected function setupListOperation()
|
|
{
|
|
$this->crud->addColumns([
|
|
[
|
|
'name' => 'support_ecosystem_partner_catalog_id',
|
|
'label' => trans('backend.columnName.catalog'),
|
|
'type' => 'select',
|
|
'entity' => 'supportEcosystemPartnerCatalog',
|
|
'attribute' => 'name',
|
|
'model' => 'App\Models\SupportEcosystemPartnerCatalog',
|
|
],
|
|
[
|
|
'name' => 'title',
|
|
'label' => trans('backend.columnName.title'),
|
|
'type' => 'text'
|
|
],
|
|
[
|
|
'name' => 'is_front_show',
|
|
'label' => trans('backend.columnName.is_front_show'),
|
|
'type' => 'checkbox'
|
|
],
|
|
[
|
|
'name' => 'description',
|
|
'label' => trans('backend.columnName.description'),
|
|
'type' => 'text'
|
|
],
|
|
[
|
|
'name' => 'website',
|
|
'label' => trans('backend.columnName.website'),
|
|
'type' => 'text'
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Define what happens when the Create operation is loaded.
|
|
*
|
|
* @see https://backpackforlaravel.com/docs/crud-operation-create
|
|
* @return void
|
|
*/
|
|
protected function setupCreateOperation()
|
|
{
|
|
CRUD::setValidation(SupportEcosystemPartnerRequest::class);
|
|
$this->crud->addFields([
|
|
[
|
|
'name' => 'support_ecosystem_partner_catalog_id',
|
|
'label' => trans('backend.columnName.catalog'),
|
|
'type' => 'select2_nested',
|
|
'entity' => 'supportEcosystemPartnerCatalog',
|
|
'attribute' => 'name',
|
|
'model' => 'App\Models\SupportEcosystemPartnerCatalog',
|
|
],
|
|
[
|
|
'name' => 'title',
|
|
'label' => trans('backend.columnName.title'),
|
|
'type' => 'text'
|
|
],
|
|
[
|
|
'name' => 'is_front_show',
|
|
'label' => trans('backend.columnName.is_front_show'),
|
|
'type' => 'boolean',
|
|
'default' => true,
|
|
],
|
|
[
|
|
'name' => 'photos',
|
|
'label' => trans('backend.columnName.cover'),
|
|
'type' => 'upload_img_multiple',
|
|
'upload' => true,
|
|
'disk' => 'public',
|
|
'hint' => '',
|
|
'qty' => 1, // 0=no limit, >0=limit
|
|
'showSingleChoise' => '0', // 0=hidden, 1=show(default)
|
|
'showComment' => '0', // 0=hidden, 1=show(default)
|
|
],
|
|
[
|
|
'name' => 'description',
|
|
'label' => trans('backend.columnName.description'),
|
|
'type' => 'textarea'
|
|
],
|
|
[
|
|
'name' => 'website',
|
|
'label' => trans('backend.columnName.website'),
|
|
'type' => 'text'
|
|
],
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Define what happens when the Update operation is loaded.
|
|
*
|
|
* @see https://backpackforlaravel.com/docs/crud-operation-update
|
|
* @return void
|
|
*/
|
|
protected function setupUpdateOperation()
|
|
{
|
|
$this->setupCreateOperation();
|
|
}
|
|
}
|