release
This commit is contained in:
@ -19,7 +19,17 @@ class HomeCarouselCrudController extends CrudController
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
//use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ReorderOperation;
|
||||
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation { destroy as traitDestroy; }
|
||||
public function destroy($id)
|
||||
{
|
||||
//CRUD::hasAccessOrFail('delete');
|
||||
if (\App\Models\HomeCarousel::count() <= 7)
|
||||
{
|
||||
$this->crud->allowAccess('create');
|
||||
}
|
||||
|
||||
return CRUD::delete($id);
|
||||
}
|
||||
/**
|
||||
* Configure the CrudPanel object. Apply settings to all operations.
|
||||
*
|
||||
@ -31,6 +41,7 @@ class HomeCarouselCrudController extends CrudController
|
||||
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()
|
||||
@ -51,6 +62,15 @@ class HomeCarouselCrudController extends CrudController
|
||||
$this->crud->orderBy('lft', 'asc')->orderBy('id', 'desc');
|
||||
}
|
||||
|
||||
if (\App\Models\HomeCarousel::count() >= 6)
|
||||
{
|
||||
$this->crud->denyAccess('create');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->crud->allowAccess('create');
|
||||
}
|
||||
|
||||
$this->crud->addColumns([
|
||||
[
|
||||
'name' => 'is_front_show',
|
||||
@ -96,6 +116,17 @@ class HomeCarouselCrudController extends CrudController
|
||||
'label' => trans('backend.columnName.link'),
|
||||
'type' => 'text'
|
||||
],
|
||||
[
|
||||
'name' => 'featured_photos',
|
||||
'label' => trans('backend.columnName.featured_img'),
|
||||
'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' => 'photos',
|
||||
'label' => trans('backend.columnName.cover'),
|
||||
|
Reference in New Issue
Block a user