first commit

This commit is contained in:
ericli1018
2024-03-13 10:43:39 +08:00
commit 1caae33c43
677 changed files with 105611 additions and 0 deletions

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\EventCatalogRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class EventCatalogCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class EventCatalogCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\EventCatalog::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/event-catalog');
CRUD::setEntityNameStrings(trans('backend.event.catalog.item'), trans('backend.event.catalog.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(EventCatalogRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'name',
'lable' => 'Name',
'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();
}
}

View File

@ -0,0 +1,156 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\EventRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class EventCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class EventCrudController 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\Event::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/event');
CRUD::setEntityNameStrings(trans('backend.event.content.item'), trans('backend.event.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' => 'post_at',
'label' => trans('backend.columnName.post_at'),
'type' => 'datetime',
'format' => 'YYYY/MM/DD HH:mm:SS',
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'checkbox'
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'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(EventRequest::class);
$this->crud->addFields([
[
'name' => 'event_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select2_nested',
'entity' => 'eventCatalog',
'attribute' => 'name',
'model' => 'App\Models\EventCatalog',
],
[
'name' => 'post_at',
'label' => trans('backend.columnName.post_at'),
'type' => 'datetime',
'format' => 'YYYY/MM/DD HH:mm:SS',
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean'
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'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' => 'venue',
'label' => trans('backend.columnName.venue'),
'type' => 'text'
],
[
'name' => 'contact',
'label' => trans('backend.columnName.contact'),
'type' => 'text'
],
[
'name' => 'body',
'lable' => trans('backend.columnName.body'),
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
//'selector' => 'textarea.tinymce',
//'skin' => 'dick-light',
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
'menubar' => 'edit insert view format help',
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
'language' => str_replace('-', '_', app()->getLocale()),
'height' => '500px',
],
],
[
'name' => 'seo_keyword',
'label' => trans('backend.columnName.seo_keyword'),
'type' => 'text'
],
[
'name' => 'seo_description',
'label' => trans('backend.columnName.seo_description'),
'type' => 'textarea'
],
]);
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\HomeCarouselRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class HomeCarouselCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class HomeCarouselCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\HomeCarousel::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/home-carousel');
CRUD::setEntityNameStrings(trans('backend.home_carousel.content.item'), trans('backend.home_carousel.content.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'title');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
$this->crud->addColumns([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'checkbox'
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'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(HomeCarouselRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'name' => 'body',
'label' => trans('backend.columnName.body'),
'type' => 'textarea'
],
[
'name' => 'link',
'label' => trans('backend.columnName.link'),
'type' => 'text'
],
[
'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)
],
]);
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\NewsCatalogRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class NewsCatalogCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class NewsCatalogCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\NewsCatalog::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/news-catalog');
CRUD::setEntityNameStrings(trans('backend.news.catalog.item'), trans('backend.news.catalog.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(NewsCatalogRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'name',
'lable' => 'Name',
'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();
}
}

View File

@ -0,0 +1,155 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\NewsRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class NewsCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class NewsCrudController 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\News::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/news');
CRUD::setEntityNameStrings(trans('backend.news.content.item'), trans('backend.news.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' => 'post_at',
'label' => trans('backend.columnName.post_at'),
'type' => 'datetime',
'format' => 'YYYY/MM/DD HH:mm:SS',
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'checkbox'
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'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(NewsRequest::class);
$this->crud->addFields([
[
'name' => 'news_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select2_nested',
'entity' => 'newsCatalog',
'attribute' => 'name',
'model' => 'App\Models\NewsCatalog',
],
[
'name' => 'post_at',
'label' => trans('backend.columnName.post_at'),
'type' => 'datetime',
'format' => 'YYYY/MM/DD HH:mm:SS',
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean'
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'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' => 'body',
'lable' => trans('backend.columnName.body'),
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
//'selector' => 'textarea.tinymce',
//'skin' => 'dick-light',
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
'menubar' => 'edit insert view format help',
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
'language' => str_replace('-', '_', app()->getLocale()),
'height' => '500px',
],
],
[
'name' => 'source_links',
'lable' => 'Source Links',
'type' => 'key_val_multiple',
],
[
'name' => 'seo_keyword',
'label' => trans('backend.columnName.seo_keyword'),
'type' => 'text'
],
[
'name' => 'seo_description',
'label' => trans('backend.columnName.seo_description'),
'type' => 'textarea'
],
]);
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace App\Http\Controllers\Admin;
use Backpack\PermissionManager\app\Http\Controllers\PermissionCrudController as OrgController;
use Backpack\PermissionManager\app\Http\Requests\PermissionStoreCrudRequest as StoreRequest;
use Backpack\PermissionManager\app\Http\Requests\PermissionUpdateCrudRequest as UpdateRequest;
/**
* Class PermissionCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class PermissionCrudController extends OrgController
{
public function setupCreateOperation()
{
$this->addFields();
$this->crud->setValidation(StoreRequest::class);
//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
}
public function setupUpdateOperation()
{
$this->addFields();
$this->crud->setValidation(UpdateRequest::class);
//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
}
private function addFields()
{
$this->crud->addField([
'name' => 'slug',
'label' => 'Slug',
'type' => 'text',
]);
$this->crud->addField([
'name' => 'name',
'label' => trans('backpack::permissionmanager.name'),
'type' => 'text',
]);
if (config('backpack.permissionmanager.multiple_guards')) {
$this->crud->addField([
'name' => 'guard_name',
'label' => trans('backpack::permissionmanager.guard_type'),
'type' => 'select_from_array',
'options' => $this->getGuardTypes(),
]);
}
}
/*
* Get an array list of all available guard types
* that have been defined in app/config/auth.php
*
* @return array
**/
private function getGuardTypes()
{
$guards = config('auth.guards');
$returnable = [];
foreach ($guards as $key => $details) {
$returnable[$key] = $key;
}
return $returnable;
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ProductApplicationRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class ProductApplicationCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ProductApplicationCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\ProductApplication::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/product-application');
CRUD::setEntityNameStrings(trans('backend.product.application.item'), trans('backend.product.application.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('slug')->label(trans('backend.columnName.slug'))->type('textarea_nl2br')->escaped(false)->searchLogic('text');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(ProductApplicationRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'slug',
'lable' => trans('backend.columnName.slug'),
'type' => 'text',
],
[
'name' => 'name',
'lable' => trans('backend.columnName.name'),
'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();
}
}

View File

@ -0,0 +1,99 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ProductCatalogRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class ProductCatalogCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ProductCatalogCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\ProductCatalog::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/product-catalog');
CRUD::setEntityNameStrings(trans('backend.product.catalog.item'), trans('backend.product.catalog.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('slug')->label(trans('backend.columnName.slug'))->type('textarea_nl2br')->escaped(false)->searchLogic('text');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(ProductCatalogRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'slug',
'lable' => trans('backend.columnName.slug'),
'type' => 'text',
],
[
'name' => 'name',
'lable' => trans('backend.columnName.name'),
'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();
}
}

View File

@ -0,0 +1,233 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ProductRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class ProductCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ProductCrudController 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\Product::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/product');
CRUD::setEntityNameStrings(trans('backend.product.content.item'), trans('backend.product.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' => 'product_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select',
'entity' => 'productCatalog',
'attribute' => 'name',
'model' => 'App\Models\ProductCatalog',
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'checkbox'
],
[
'name' => 'tip',
'label' => trans('backend.columnName.tip'),
'type' => 'select_from_array',
'options' => [
'none' => trans('backend.product.tip_options.none'),
'new' => trans('backend.product.tip_options.new'),
'on_sale' => trans('backend.product.tip_options.on_sale'),
],
],
[
'name' => 'description',
'label' => trans('backend.columnName.description'),
'type' => 'text'
],
]);
$this->crud->addFilter(
[
'name' => 'product_catalog_id',
'type' => 'dropdown',
'label' => trans('backend.columnName.catalog'),
],
\App\Models\ProductCatalog::all()->pluck('name', 'id')->toArray(),
function ($value) { // if the filter is active
$this->crud->addClause('whereHas', 'productCatalog', function ($query) use ($value) {
$query->where('product_catalog_id', '=', $value);
});
}
);
}
/**
* Define what happens when the Create operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(ProductRequest::class);
$this->crud->addFields([
[
'name' => 'product_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select2_nested',
'entity' => 'productCatalog',
'attribute' => 'name',
'model' => 'App\Models\ProductCatalog',
],
[
'name' => 'productApplications',
'label' => trans('backend.columnName.application'),
'type' => 'select2_multiple',
'entity' => 'productApplications',
'attribute' => 'name',
'model' => 'App\Models\ProductApplication',
'pivot' => true,
'allows_null' => true,
'select_all' => true,
],
[
'name' => 'slug',
'lable' => trans('backend.columnName.slug'),
'type' => 'text',
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean'
],
[
'name' => 'tip',
'label' => trans('backend.columnName.tip'),
'type' => 'select2_from_array',
'options' => [
'none' => trans('backend.product.tip_options.none'),
'new' => trans('backend.product.tip_options.new'),
'on_sale' => trans('backend.product.tip_options.on_sale'),
],
],
[
'name' => 'photos',
'label' => trans('backend.columnName.photos'),
'type' => 'upload_img_multiple',
'upload' => true,
'disk' => 'public',
'hint' => '',
'qty' => 0, // 0=no limit, >0=limit
'showSingleChoise' => '1', // 0=hidden, 1=show(default)
'showComment' => '1', // 0=hidden, 1=show(default)
],
[
'name' => 'description',
'label' => trans('backend.columnName.description'),
'type' => 'textarea'
],
[
'name' => 'body',
'lable' => trans('backend.columnName.body'),
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
//'selector' => 'textarea.tinymce',
//'skin' => 'dick-light',
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
'menubar' => 'edit insert view format help',
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
'language' => str_replace('-', '_', app()->getLocale()),
'height' => '500px',
],
],
[
'name' => 'feature_overview',
'lable' => trans('backend.columnName.feature_overview'),
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
//'selector' => 'textarea.tinymce',
//'skin' => 'dick-light',
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
'menubar' => 'edit insert view format help',
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
'language' => str_replace('-', '_', app()->getLocale()),
'height' => '500px',
],
],
[
'name' => 'feature_spec',
'lable' => trans('backend.columnName.feature_spec'),
'type' => 'tinymce',
// optional overwrite of the configuration array
'options' => [
//'selector' => 'textarea.tinymce',
//'skin' => 'dick-light',
'plugins' => 'lists advlist image link media anchor table hr imagetools importcss insertdatetime paste searchreplace textcolor textpattern help',
'menubar' => 'edit insert view format help',
'toolbar' => 'undo redo bold italic alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table image media link',
'language' => str_replace('-', '_', app()->getLocale()),
'height' => '500px',
],
],
[
'name' => 'seo_keyword',
'label' => trans('backend.columnName.seo_keyword'),
'type' => 'text'
],
[
'name' => 'seo_description',
'label' => trans('backend.columnName.seo_description'),
'type' => 'textarea'
],
]);
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\Http\Controllers\Admin;
use Backpack\PermissionManager\app\Http\Controllers\RoleCrudController as OrgController;
use Backpack\PermissionManager\app\Http\Requests\RoleStoreCrudRequest as StoreRequest;
use Backpack\PermissionManager\app\Http\Requests\RoleUpdateCrudRequest as UpdateRequest;
/**
* Class RoleCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class RoleCrudController extends OrgController
{
public function setupCreateOperation()
{
$this->addFields();
$this->crud->setValidation(StoreRequest::class);
//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
}
public function setupUpdateOperation()
{
$this->addFields();
$this->crud->setValidation(UpdateRequest::class);
//otherwise, changes won't have effect
\Cache::forget('spatie.permission.cache');
}
private function addFields()
{
$this->crud->addField([
'name' => 'slug',
'label' => 'Slug',
'type' => 'text',
]);
$this->crud->addField([
'name' => 'name',
'label' => trans('backpack::permissionmanager.name'),
'type' => 'text',
]);
if (config('backpack.permissionmanager.multiple_guards')) {
$this->crud->addField([
'name' => 'guard_name',
'label' => trans('backpack::permissionmanager.guard_type'),
'type' => 'select_from_array',
'options' => $this->getGuardTypes(),
]);
}
$this->crud->addField([
'label' => mb_ucfirst(trans('backpack::permissionmanager.permission_plural')),
'type' => 'checklist',
'name' => 'permissions',
'entity' => 'permissions',
'attribute' => 'name',
'model' => $this->permission_model,
'pivot' => true,
]);
}
/*
* Get an array list of all available guard types
* that have been defined in app/config/auth.php
*
* @return array
**/
private function getGuardTypes()
{
$guards = config('auth.guards');
$returnable = [];
foreach ($guards as $key => $details) {
$returnable[$key] = $key;
}
return $returnable;
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SupportDistributionPartnerCatalogRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SupportDistributionPartnerCatalogCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SupportDistributionPartnerCatalogCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\SupportDistributionPartnerCatalog::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-distribution-partner-catalog');
CRUD::setEntityNameStrings(trans('backend.support.distribution_partner.catalog.item'), trans('backend.support.distribution_partner.catalog.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(SupportDistributionPartnerCatalogRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'name',
'lable' => 'Name',
'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();
}
}

View File

@ -0,0 +1,136 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SupportDistributionPartnerRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SupportDistributionPartnerCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SupportDistributionPartnerCrudController 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\SupportDistributionPartner::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-distribution-partner');
CRUD::setEntityNameStrings(trans('backend.support.distribution_partner.content.item'), trans('backend.support.distribution_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_distribution_partner_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select',
'entity' => 'supportDistributionPartnerCatalog',
'attribute' => 'name',
'model' => 'App\Models\SupportDistributionPartnerCatalog',
],
[
'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(SupportDistributionPartnerRequest::class);
$this->crud->addFields([
[
'name' => 'support_distribution_partner_catalog_id',
'label' => trans('backend.columnName.catalog'),
'type' => 'select2_nested',
'entity' => 'supportDistributionPartnerCatalog',
'attribute' => 'name',
'model' => 'App\Models\SupportDistributionPartnerCatalog',
],
[
'name' => 'title',
'label' => trans('backend.columnName.title'),
'type' => 'text'
],
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean'
],
[
'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();
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SupportEcosystemPartnerCatalogRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SupportEcosystemPartnerCatalogCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SupportEcosystemPartnerCatalogCrudController 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;
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
/**
* Configure the CrudPanel object. Apply settings to all operations.
*
* @return void
*/
public function setup()
{
CRUD::setModel(\App\Models\SupportEcosystemPartnerCatalog::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-ecosystem-partner-catalog');
CRUD::setEntityNameStrings(trans('backend.support.ecosystem_partner.catalog.item'), trans('backend.support.ecosystem_partner.catalog.items'));
}
protected function setupReorderOperation()
{
CRUD::set('reorder.label', 'name');
CRUD::set('reorder.max_level', 1);
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
if (! $this->crud->getRequest()->has('order')){
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
}
CRUD::addColumn('#');
CRUD::column('is_front_show')->label(trans('backend.columnName.is_front_show'))->type('checkbox');
CRUD::column('name')->label(trans('backend.columnName.name'))->type('textarea_nl2br')->escaped(false)->searchLogic('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(SupportEcosystemPartnerCatalogRequest::class);
CRUD::addFields([
[
'name' => 'is_front_show',
'label' => trans('backend.columnName.is_front_show'),
'type' => 'boolean',
'default' => true,
],
[
'name' => 'name',
'lable' => 'Name',
'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();
}
}

View File

@ -0,0 +1,136 @@
<?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'
],
[
'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();
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SupportSaleRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SupportSaleCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SupportSaleCrudController 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\SupportSale::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-sale');
CRUD::setEntityNameStrings('support sale', 'support sales');
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::setFromDb(); // set columns from db columns.
/**
* Columns can be defined using the fluent syntax:
* - CRUD::column('price')->type('number');
*/
}
/**
* Define what happens when the Create operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(SupportSaleRequest::class);
CRUD::setFromDb(); // set fields from db columns.
/**
* Fields can be defined using the fluent syntax:
* - CRUD::field('price')->type('number');
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SupportTechnicalRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SupportTechnicalCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SupportTechnicalCrudController 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\SupportTechnical::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/support-technical');
CRUD::setEntityNameStrings('support technical', 'support technicals');
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::setFromDb(); // set columns from db columns.
/**
* Columns can be defined using the fluent syntax:
* - CRUD::column('price')->type('number');
*/
}
/**
* Define what happens when the Create operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-create
* @return void
*/
protected function setupCreateOperation()
{
CRUD::setValidation(SupportTechnicalRequest::class);
CRUD::setFromDb(); // set fields from db columns.
/**
* Fields can be defined using the fluent syntax:
* - CRUD::field('price')->type('number');
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace App\Http\Controllers\Admin;
use Backpack\PermissionManager\app\Http\Controllers\UserCrudController as OrgController;
/**
* Class UserCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class UserCrudController extends OrgController
{
public function setupListOperation()
{
$this->crud->addColumns([
[
'name' => 'name',
'label' => trans('backpack::permissionmanager.name'),
'type' => 'text',
],
[
'name' => 'email',
'label' => trans('backpack::permissionmanager.email'),
'type' => 'email',
],
[ // n-n relationship (with pivot table)
'label' => trans('backpack::permissionmanager.roles'), // Table column heading
'type' => 'select_multiple',
'name' => 'roles', // the method that defines the relationship in your Model
'entity' => 'roles', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'model' => config('permission.models.role'), // foreign key model
],
[ // n-n relationship (with pivot table)
'label' => trans('backpack::permissionmanager.extra_permissions'), // Table column heading
'type' => 'select_multiple',
'name' => 'permissions', // the method that defines the relationship in your Model
'entity' => 'permissions', // the method that defines the relationship in your Model
'attribute' => 'name', // foreign key attribute that is shown to user
'model' => config('permission.models.permission'), // foreign key model
],
]);
if (backpack_pro()) {
// Role Filter
$this->crud->addFilter(
[
'name' => 'role',
'type' => 'dropdown',
'label' => trans('backpack::permissionmanager.role'),
],
config('permission.models.role')::all()->pluck('name', 'id')->toArray(),
function ($value) { // if the filter is active
$this->crud->addClause('whereHas', 'roles', function ($query) use ($value) {
$query->where('role_id', '=', $value);
});
}
);
// Extra Permission Filter
$this->crud->addFilter(
[
'name' => 'permissions',
'type' => 'select2',
'label' => trans('backpack::permissionmanager.extra_permissions'),
],
config('permission.models.permission')::all()->pluck('name', 'id')->toArray(),
function ($value) { // if the filter is active
$this->crud->addClause('whereHas', 'permissions', function ($query) use ($value) {
$query->where('permission_id', '=', $value);
});
}
);
}
}
}