first commit
This commit is contained in:
27
app/Console/Kernel.php
Normal file
27
app/Console/Kernel.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*/
|
||||
protected function commands(): void
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
30
app/Exceptions/Handler.php
Normal file
30
app/Exceptions/Handler.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
13
app/Http/Controllers/AboutController.php
Normal file
13
app/Http/Controllers/AboutController.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AboutController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('about');
|
||||
}
|
||||
}
|
93
app/Http/Controllers/Admin/EventCatalogCrudController.php
Normal file
93
app/Http/Controllers/Admin/EventCatalogCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
156
app/Http/Controllers/Admin/EventCrudController.php
Normal file
156
app/Http/Controllers/Admin/EventCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
123
app/Http/Controllers/Admin/HomeCarouselCrudController.php
Normal file
123
app/Http/Controllers/Admin/HomeCarouselCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
93
app/Http/Controllers/Admin/NewsCatalogCrudController.php
Normal file
93
app/Http/Controllers/Admin/NewsCatalogCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
155
app/Http/Controllers/Admin/NewsCrudController.php
Normal file
155
app/Http/Controllers/Admin/NewsCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
75
app/Http/Controllers/Admin/PermissionCrudController.php
Normal file
75
app/Http/Controllers/Admin/PermissionCrudController.php
Normal 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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
99
app/Http/Controllers/Admin/ProductCatalogCrudController.php
Normal file
99
app/Http/Controllers/Admin/ProductCatalogCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
233
app/Http/Controllers/Admin/ProductCrudController.php
Normal file
233
app/Http/Controllers/Admin/ProductCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
85
app/Http/Controllers/Admin/RoleCrudController.php
Normal file
85
app/Http/Controllers/Admin/RoleCrudController.php
Normal 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;
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
77
app/Http/Controllers/Admin/SupportSaleCrudController.php
Normal file
77
app/Http/Controllers/Admin/SupportSaleCrudController.php
Normal 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();
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
77
app/Http/Controllers/Admin/UserCrudController.php
Normal file
77
app/Http/Controllers/Admin/UserCrudController.php
Normal 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);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
13
app/Http/Controllers/ContactController.php
Normal file
13
app/Http/Controllers/ContactController.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('contact');
|
||||
}
|
||||
}
|
12
app/Http/Controllers/Controller.php
Normal file
12
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
}
|
37
app/Http/Controllers/EventsController.php
Normal file
37
app/Http/Controllers/EventsController.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class EventsController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$perPageItems = 12;
|
||||
$page = $request->get("p");
|
||||
$page = (!$page || $page < 1) ? 1 : $page;
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$dataRows = \App\Models\Event::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->select('id', 'title', 'venue', 'contact', 'photos', 'post_at');
|
||||
|
||||
return view('events', [
|
||||
'dataRows' => $dataRows->skip($pageOffset)->take($perPageItems)->get(),
|
||||
'dataCurrentPage' => $page,
|
||||
'dataPerPageItems' => $perPageItems,
|
||||
'dataTotalCount' => $dataRows->count(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail(Request $request, $id)
|
||||
{
|
||||
$dataRow = \App\Models\Event::where('id', '=', $id)
|
||||
->where('is_front_show', '=', true);
|
||||
|
||||
return view('events_detail', [
|
||||
'dataRow' => $dataRow->first(),
|
||||
]);
|
||||
}
|
||||
}
|
26
app/Http/Controllers/HomeController.php
Normal file
26
app/Http/Controllers/HomeController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$carouselRows = \App\Models\HomeCarousel::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
->orderBy('id', 'desc');
|
||||
$newsRows = \App\Models\News::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->take('3');
|
||||
$eventRows = \App\Models\News::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->take('3');
|
||||
return view('home', [
|
||||
'carouselRows' => $carouselRows->get(),
|
||||
'newsRows' => $newsRows->get(),
|
||||
'eventRows' => $eventRows->get(),
|
||||
]);
|
||||
}
|
||||
}
|
37
app/Http/Controllers/NewsController.php
Normal file
37
app/Http/Controllers/NewsController.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$perPageItems = 12;
|
||||
$page = $request->get("p");
|
||||
$page = (!$page || $page < 1) ? 1 : $page;
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$dataRows = \App\Models\News::where('is_front_show', '=', true)
|
||||
->orderBy('post_at', 'desc')
|
||||
->select('id', 'title', 'description', 'photos', 'post_at');
|
||||
|
||||
return view('news', [
|
||||
'dataRows' => $dataRows->skip($pageOffset)->take($perPageItems)->get(),
|
||||
'dataCurrentPage' => $page,
|
||||
'dataPerPageItems' => $perPageItems,
|
||||
'dataTotalCount' => $dataRows->count(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function detail(Request $request, $id)
|
||||
{
|
||||
$dataRow = \App\Models\News::where('id', '=', $id)
|
||||
->where('is_front_show', '=', true);
|
||||
|
||||
return view('news_detail', [
|
||||
'dataRow' => $dataRow->first(),
|
||||
]);
|
||||
}
|
||||
}
|
111
app/Http/Controllers/ProductsController.php
Normal file
111
app/Http/Controllers/ProductsController.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ProductsController extends Controller
|
||||
{
|
||||
public function index(Request $request, $catalogs = null)
|
||||
{
|
||||
$catalogs = explode('/', $catalogs);
|
||||
$catalogSlug = array_pop($catalogs);
|
||||
$applications = $request->get('tags');
|
||||
$currentApplications = explode(',', $applications);
|
||||
$currentApplications = array_values(array_filter($currentApplications));
|
||||
$perPageItems = 10;
|
||||
$page = $request->get("p");
|
||||
$page = (!$page || $page < 1) ? 1 : $page;
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$productRows = \App\Models\Product::where('is_front_show', '=', true)
|
||||
->orderByRaw("CASE
|
||||
WHEN tip = 'none' THEN 1
|
||||
WHEN tip = 'new' THEN 2
|
||||
WHEN tip = 'on_sale' THEN 3
|
||||
END DESC")
|
||||
->orderBy('id', 'DESC');
|
||||
|
||||
$dataCatalogs = \App\Models\ProductCatalog::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
->select('id', 'slug', 'name', \DB::raw('(
|
||||
SELECT COUNT(id) FROM products
|
||||
WHERE products.product_catalog_id = product_catalogs.id AND products.is_front_show = true
|
||||
) as qty'));
|
||||
|
||||
$dataApplications = \App\Models\ProductApplication::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
->select('id', 'slug', 'name');
|
||||
|
||||
$currentCatalogName = \App\Models\ProductCatalog::where('slug', 'like', $catalogSlug)->first();
|
||||
if ($currentCatalogName)
|
||||
{
|
||||
$currentCatalogName = $currentCatalogName->name;
|
||||
}
|
||||
|
||||
if (count($currentApplications) > 0)
|
||||
{
|
||||
$productRows = $productRows->whereHas('productApplications',
|
||||
function($query) use ($currentApplications) {
|
||||
$query->whereIn('slug', $currentApplications);
|
||||
});
|
||||
}
|
||||
|
||||
if ($catalogSlug)
|
||||
{
|
||||
$productRows = $productRows->whereHas('productCatalog',
|
||||
function($query) use ($catalogSlug) {
|
||||
$query->where('slug', 'like', $catalogSlug);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$productCount = $productRows->count();
|
||||
$productRows = $productRows->skip($pageOffset)->take($perPageItems)->get();
|
||||
foreach ($productRows as $row)
|
||||
{
|
||||
$row->{'applications'} = \App\Models\Product::find($row->id)->productApplications()->get();
|
||||
|
||||
}
|
||||
|
||||
return view('products', [
|
||||
'dataCatalogs' => $dataCatalogs->get(),
|
||||
'currentCatalogName' => $currentCatalogName,
|
||||
'dataApplications' => $dataApplications->get(),
|
||||
'currentApplications' => $currentApplications,
|
||||
'dataRows' => $productRows,
|
||||
'dataCurrentPage' => $page,
|
||||
'dataPerPageItems' => $perPageItems,
|
||||
'dataTotalCount' => $productCount,
|
||||
]);
|
||||
}
|
||||
|
||||
public function catalogs($catalogs, Request $request)
|
||||
{
|
||||
return $this->index($request, $catalogs);
|
||||
}
|
||||
|
||||
public function detail($product, Request $request)
|
||||
{
|
||||
$dataRow = \App\Models\Product::where('slug', 'like', $product)
|
||||
->where('is_front_show', '=', true)
|
||||
->first();
|
||||
|
||||
$catalogName = '';
|
||||
$catalogSlug = '';
|
||||
$catalog = $dataRow->productCatalog()->first();
|
||||
if ($catalog)
|
||||
{
|
||||
$catalogName = $catalog->name;
|
||||
$catalogSlug = $catalog->slug;
|
||||
}
|
||||
|
||||
return view('products_detail', [
|
||||
'dataRow' => $dataRow,
|
||||
'catalogName' => $catalogName,
|
||||
'catalogSlug' => $catalogSlug,
|
||||
'productApplications' => $dataRow->productApplications()->get(),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupportDistributionPartnersController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$catalogId = $request->get('cid');
|
||||
$catalogId = (!$catalogId || $catalogId < 1) ? 0 : $catalogId;
|
||||
$perPageItems = 20;
|
||||
$page = $request->get("p");
|
||||
$page = (!$page || $page < 1) ? 1 : $page;
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$catalogRows = \App\Models\SupportDistributionPartnerCatalog::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
->orderBy('id', 'desc')
|
||||
->select('id', 'name');
|
||||
if ($catalogId == 0)
|
||||
{
|
||||
$catalogRowsGet = $catalogRows->get();
|
||||
foreach ($catalogRowsGet as $row)
|
||||
{
|
||||
$catalogId = $row->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$dataRows = \App\Models\SupportDistributionPartner::where('support_distribution_partner_catalog_id', '=', $catalogId)
|
||||
->where('is_front_show', '=', true)
|
||||
->orderBy('title', 'desc')
|
||||
->select('id', 'title', 'description', 'photos', 'website');
|
||||
|
||||
return view('support-distribution-partners', [
|
||||
'catalogRows' => $catalogRows->get(),
|
||||
'catalogCurrentId' => $catalogId,
|
||||
'dataRows' => $dataRows->skip($pageOffset)->take($perPageItems)->get(),
|
||||
'dataCurrentPage' => $page,
|
||||
'dataPerPageItems' => $perPageItems,
|
||||
'dataTotalCount' => $dataRows->count()
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
40
app/Http/Controllers/SupportEcosystemPartnersController.php
Normal file
40
app/Http/Controllers/SupportEcosystemPartnersController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SupportEcosystemPartnersController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$catalogId = $request->get('cid');
|
||||
$catalogId = (!$catalogId || $catalogId < 1) ? 0 : $catalogId;
|
||||
$appclitionId = $request->get('aid');
|
||||
$appclitionId = (!$appclitionId || $appclitionId < 1) ? 0 : $appclitionId;
|
||||
$perPageItems = 20;
|
||||
$page = $request->get("p");
|
||||
$page = (!$page || $page < 1) ? 1 : $page;
|
||||
$pageOffset = $perPageItems * ($page - 1);
|
||||
|
||||
$catalogRows = \App\Models\SupportEcosystemPartnerCatalog::where('is_front_show', '=', true)
|
||||
->orderBy('lft', 'asc')
|
||||
->orderBy('id', 'desc')
|
||||
->select('id', 'name');
|
||||
|
||||
$dataRows = \App\Models\SupportEcosystemPartner::where('support_ecosystem_partner_catalog_id', '=', $catalogId)
|
||||
->where('is_front_show', '=', true)
|
||||
->orderBy('title', 'desc')
|
||||
->select('id', 'title', 'description', 'photos', 'website');
|
||||
|
||||
return view('support-ecosystem-partners', [
|
||||
'catalogRows' => $catalogRows->get(),
|
||||
'catalogCurrentId' => $catalogId,
|
||||
'dataRows' => $dataRows->skip($pageOffset)->take($perPageItems)->get(),
|
||||
'dataCurrentPage' => $page,
|
||||
'dataPerPageItems' => $perPageItems,
|
||||
'dataTotalCount' => $dataRows->count()
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
39
app/Http/Controllers/SupportSalesInquiryController.php
Normal file
39
app/Http/Controllers/SupportSalesInquiryController.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Http\Requests\SupportSaleRequest;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SupportSalesInquiryController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$pid = $request->get('pid');
|
||||
$product = \App\Models\Product::where('id', '=', $pid)->where('is_front_show', '=', true)->first();
|
||||
if ($product)
|
||||
{
|
||||
$product = 'I am interested in ' . $product->title;
|
||||
}
|
||||
return view('support-sales-inquiry',[
|
||||
'productName' => $product,
|
||||
]);
|
||||
}
|
||||
|
||||
public function indexPost(SupportSaleRequest $request)
|
||||
{
|
||||
\App\Models\SupportSale::insert([
|
||||
'name_first' => $request->input('name_first'),
|
||||
'name_last' => $request->input('name_last'),
|
||||
'company_name' => $request->input('company_name'),
|
||||
'job_title' => $request->input('job_title'),
|
||||
'email' => $request->input('email'),
|
||||
'phone' => $request->input('phone'),
|
||||
'contry' => $request->input('contry'),
|
||||
'comments' => $request->input('comments'),
|
||||
'created_at' => Carbon::now(),
|
||||
]);
|
||||
return redirect()->back()->with('success', 'We have received your sales inquiry!');
|
||||
}
|
||||
}
|
31
app/Http/Controllers/SupportTechnicalController.php
Normal file
31
app/Http/Controllers/SupportTechnicalController.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \App\Http\Requests\SupportTechnicalRequest;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class SupportTechnicalController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('support-technical');
|
||||
}
|
||||
|
||||
public function indexPost(SupportTechnicalRequest $request)
|
||||
{
|
||||
\App\Models\SupportTechnical::insert([
|
||||
'name_first' => $request->input('name_first'),
|
||||
'name_last' => $request->input('name_last'),
|
||||
'company_name' => $request->input('company_name'),
|
||||
'job_title' => $request->input('job_title'),
|
||||
'email' => $request->input('email'),
|
||||
'phone' => $request->input('phone'),
|
||||
'contry' => $request->input('contry'),
|
||||
'comments' => $request->input('comments'),
|
||||
'created_at' => Carbon::now(),
|
||||
]);
|
||||
return redirect()->back()->with('success', 'We have received your technical inquiry!');
|
||||
}
|
||||
}
|
69
app/Http/Kernel.php
Normal file
69
app/Http/Kernel.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
\Spatie\CookieConsent\CookieConsentMiddleware::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's middleware aliases.
|
||||
*
|
||||
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
17
app/Http/Middleware/Authenticate.php
Normal file
17
app/Http/Middleware/Authenticate.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*/
|
||||
protected function redirectTo(Request $request): ?string
|
||||
{
|
||||
return $request->expectsJson() ? null : route('login');
|
||||
}
|
||||
}
|
68
app/Http/Middleware/CheckIfAdmin.php
Normal file
68
app/Http/Middleware/CheckIfAdmin.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
class CheckIfAdmin
|
||||
{
|
||||
/**
|
||||
* Checked that the logged in user is an administrator.
|
||||
*
|
||||
* --------------
|
||||
* VERY IMPORTANT
|
||||
* --------------
|
||||
* If you have both regular users and admins inside the same table, change
|
||||
* the contents of this method to check that the logged in user
|
||||
* is an admin, and not a regular user.
|
||||
*
|
||||
* Additionally, in Laravel 7+, you should change app/Providers/RouteServiceProvider::HOME
|
||||
* which defines the route where a logged in user (but not admin) gets redirected
|
||||
* when trying to access an admin route. By default it's '/home' but Backpack
|
||||
* does not have a '/home' route, use something you've built for your users
|
||||
* (again - users, not admins).
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable|null $user
|
||||
* @return bool
|
||||
*/
|
||||
private function checkIfUserIsAdmin($user)
|
||||
{
|
||||
// return ($user->is_admin == 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer to unauthorized access request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
private function respondToUnauthorizedRequest($request)
|
||||
{
|
||||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response(trans('backpack::base.unauthorized'), 401);
|
||||
} else {
|
||||
return redirect()->guest(backpack_url('login'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (backpack_auth()->guest()) {
|
||||
return $this->respondToUnauthorizedRequest($request);
|
||||
}
|
||||
|
||||
if (! $this->checkIfUserIsAdmin(backpack_user())) {
|
||||
return $this->respondToUnauthorizedRequest($request);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts(): array
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
55
app/Http/Requests/EventCatalogRequest.php
Normal file
55
app/Http/Requests/EventCatalogRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EventCatalogRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/EventRequest.php
Normal file
55
app/Http/Requests/EventRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EventRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/HomeCarouselRequest.php
Normal file
55
app/Http/Requests/HomeCarouselRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class HomeCarouselRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/NewsCatalogRequest.php
Normal file
55
app/Http/Requests/NewsCatalogRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class NewsCatalogRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/NewsRequest.php
Normal file
55
app/Http/Requests/NewsRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class NewsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/ProductApplicationRequest.php
Normal file
55
app/Http/Requests/ProductApplicationRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ProductApplicationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'slug' => 'required|unique:product_applications,slug',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/ProductCatalogRequest.php
Normal file
55
app/Http/Requests/ProductCatalogRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ProductCatalogRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'slug' => 'required|unique:product_catalogs,slug',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/ProductRequest.php
Normal file
55
app/Http/Requests/ProductRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ProductRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'slug' => 'required|unique:products,slug',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportDistributionPartnerCatalogRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/SupportDistributionPartnerRequest.php
Normal file
55
app/Http/Requests/SupportDistributionPartnerRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportDistributionPartnerRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/SupportEcosystemPartnerCatalogRequest.php
Normal file
55
app/Http/Requests/SupportEcosystemPartnerCatalogRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportEcosystemPartnerCatalogRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/SupportEcosystemPartnerRequest.php
Normal file
55
app/Http/Requests/SupportEcosystemPartnerRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportEcosystemPartnerRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
62
app/Http/Requests/SupportSaleRequest.php
Normal file
62
app/Http/Requests/SupportSaleRequest.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportSaleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name_first' => 'required',
|
||||
'name_last' => 'required',
|
||||
'company_name' => 'required',
|
||||
//'job_title' => 'required',
|
||||
'email' => 'nullable|email',
|
||||
'phone' => 'required',
|
||||
'contry' => 'required',
|
||||
'comments' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
62
app/Http/Requests/SupportTechnicalRequest.php
Normal file
62
app/Http/Requests/SupportTechnicalRequest.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SupportTechnicalRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name_first' => 'required',
|
||||
'name_last' => 'required',
|
||||
'company_name' => 'required',
|
||||
//'job_title' => 'required',
|
||||
'email' => 'nullable|email',
|
||||
'phone' => 'required',
|
||||
'contry' => 'required',
|
||||
'comments' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
55
app/Http/Requests/UserRequest.php
Normal file
55
app/Http/Requests/UserRequest.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
85
app/Models/Event.php
Normal file
85
app/Models/Event.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'events';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title', 'body', 'venue', 'contact', 'seo_keyword', 'seo_description'];
|
||||
protected $casts = [
|
||||
'post_at' => 'datetime',
|
||||
'photos' => 'array',
|
||||
];
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function eventCatalog()
|
||||
{
|
||||
return $this->belongsTo(EventCatalog::class, 'event_catalog_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "events";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
67
app/Models/EventCatalog.php
Normal file
67
app/Models/EventCatalog.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class EventCatalog extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'event_catalogs';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(EventCatalog::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(EventCatalog::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
90
app/Models/HomeCarousel.php
Normal file
90
app/Models/HomeCarousel.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class HomeCarousel extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'home_carousel';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title','body'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(HomeCarousel::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(HomeCarousel::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "home_carousel";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
86
app/Models/News.php
Normal file
86
app/Models/News.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class News extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'news';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title','description', 'body', 'seo_keyword', 'seo_description'];
|
||||
protected $casts = [
|
||||
'post_at' => 'datetime',
|
||||
'photos' => 'array',
|
||||
];
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function newsCatalog()
|
||||
{
|
||||
return $this->belongsTo(NewsCatalog::class, 'news_catalog_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "news";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
|
||||
}
|
67
app/Models/NewsCatalog.php
Normal file
67
app/Models/NewsCatalog.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class NewsCatalog extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'news_catalogs';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(NewsCatalog::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(NewsCatalog::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
30
app/Models/Permission.php
Normal file
30
app/Models/Permission.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\PermissionManager\app\Models\Permission as OriginalPermission;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\Sluggable;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\SluggableScopeHelpers;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class Permission extends OriginalPermission
|
||||
{
|
||||
use HasTranslations;
|
||||
use Sluggable, SluggableScopeHelpers;
|
||||
public $translatable = ['name'];
|
||||
protected $fillable = ['slug', 'name', 'guard_name', 'updated_at', 'created_at'];
|
||||
|
||||
/**
|
||||
* Return the sluggable configuration array for this model.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'slug_or_name',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
90
app/Models/Product.php
Normal file
90
app/Models/Product.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class Product extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'products';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title', 'tip', 'description', 'body', 'feature_overview', 'feature_spec', 'seo_keyword', 'seo_description'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function productCatalog()
|
||||
{
|
||||
return $this->belongsTo(ProductCatalog::class, 'product_catalog_id');
|
||||
}
|
||||
|
||||
public function productApplications()
|
||||
{
|
||||
return $this->belongsToMany(ProductApplication::class, 'product_product_application');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "products";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
62
app/Models/ProductApplication.php
Normal file
62
app/Models/ProductApplication.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class ProductApplication extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'product_applications';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'product_product_application');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
67
app/Models/ProductCatalog.php
Normal file
67
app/Models/ProductCatalog.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class ProductCatalog extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'product_catalogs';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(ProductCatalog::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(ProductCatalog::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
30
app/Models/Role.php
Normal file
30
app/Models/Role.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\PermissionManager\app\Models\Role as OriginalRole;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\Sluggable;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\SluggableScopeHelpers;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class Role extends OriginalRole
|
||||
{
|
||||
use HasTranslations;
|
||||
use Sluggable, SluggableScopeHelpers;
|
||||
public $translatable = ['name'];
|
||||
protected $fillable = ['slug', 'name', 'guard_name', 'updated_at', 'created_at'];
|
||||
|
||||
/**
|
||||
* Return the sluggable configuration array for this model.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sluggable(): array
|
||||
{
|
||||
return [
|
||||
'slug' => [
|
||||
'source' => 'slug_or_name',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
85
app/Models/SupportDistributionPartner.php
Normal file
85
app/Models/SupportDistributionPartner.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class SupportDistributionPartner extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_distribution_partners';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title', 'description', 'website'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function supportDistributionPartnerCatalog()
|
||||
{
|
||||
return $this->belongsTo(SupportDistributionPartnerCatalog::class, 'support_distribution_partner_catalog_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "support_distribution_partners";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
67
app/Models/SupportDistributionPartnerCatalog.php
Normal file
67
app/Models/SupportDistributionPartnerCatalog.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class SupportDistributionPartnerCatalog extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_distribution_partner_catalogs';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(SupportDistributionPartnerCatalog::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(SupportDistributionPartnerCatalog::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
84
app/Models/SupportEcosystemPartner.php
Normal file
84
app/Models/SupportEcosystemPartner.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Ericli1018\AwesomeFieldsForBackpack\Models\Traits\HasUploadImgFields;
|
||||
|
||||
class SupportEcosystemPartner extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
use HasUploadImgFields;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_ecosystem_partners';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title', 'description', 'website'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
];
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function supportEcosystemPartnerCatalog()
|
||||
{
|
||||
return $this->belongsTo(SupportEcosystemPartnerCatalog::class, 'support_ecosystem_partner_catalog_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "photos";
|
||||
$disk = "public";
|
||||
$destination_path = "support_ecosystem_partners";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
67
app/Models/SupportEcosystemPartnerCatalog.php
Normal file
67
app/Models/SupportEcosystemPartnerCatalog.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
|
||||
class SupportEcosystemPartnerCatalog extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_ecosystem_partner_catalogs';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(SupportEcosystemPartnerCatalog::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany(SupportEcosystemPartnerCatalog::class, 'parent_id');
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
56
app/Models/SupportSale.php
Normal file
56
app/Models/SupportSale.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupportSale extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_sales';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
56
app/Models/SupportTechnical.php
Normal file
56
app/Models/SupportTechnical.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SupportTechnical extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasFactory;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'support_technicals';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
48
app/Models/User.php
Normal file
48
app/Models/User.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasApiTokens, HasFactory, Notifiable, HasRoles;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
405
app/Overrides/backpack/crud/src/helpers.php
Normal file
405
app/Overrides/backpack/crud/src/helpers.php
Normal file
@ -0,0 +1,405 @@
|
||||
<?php
|
||||
|
||||
use Backpack\Basset\Facades\Basset;
|
||||
use Creativeorange\Gravatar\Facades\Gravatar;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
if (! function_exists('backpack_url')) {
|
||||
/**
|
||||
* Appends the configured backpack prefix and returns
|
||||
* the URL using the standard Laravel helpers.
|
||||
*
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
function backpack_url($path = null, $parameters = [], $secure = null)
|
||||
{
|
||||
$path = ! $path || (substr($path, 0, 1) == '/') ? $path : '/'.$path;
|
||||
|
||||
return url(config('backpack.base.route_prefix', 'admin').$path, $parameters, $secure);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_authentication_column')) {
|
||||
/**
|
||||
* Return the username column name.
|
||||
* The Laravel default (and Backpack default) is 'email'.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function backpack_authentication_column()
|
||||
{
|
||||
return config('backpack.base.authentication_column', 'email');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_email_column')) {
|
||||
/**
|
||||
* Return the email column name.
|
||||
* The Laravel default (and Backpack default) is 'email'.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function backpack_email_column()
|
||||
{
|
||||
return config('backpack.base.email_column', 'email');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_form_input')) {
|
||||
/**
|
||||
* Parse the submitted input in request('form') to an usable array.
|
||||
* Joins the multiple[] fields in a single key and transform the dot notation fields into arrayed ones.
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function backpack_form_input()
|
||||
{
|
||||
$input = request('form') ?? [];
|
||||
$result = [];
|
||||
|
||||
foreach ($input as $row) {
|
||||
$repeatableRowKey = null;
|
||||
|
||||
// regular fields don't need any aditional parsing
|
||||
if (strpos($row['name'], '[') === false) {
|
||||
$result[$row['name']] = $row['value'];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$isMultiple = substr($row['name'], -2, 2) === '[]';
|
||||
|
||||
if ($isMultiple && substr_count($row['name'], '[') === 1) {
|
||||
$result[substr($row['name'], 0, -2)][] = $row['value'];
|
||||
continue;
|
||||
}
|
||||
|
||||
// dot notation fields
|
||||
if (substr_count($row['name'], '[') === 1) {
|
||||
// start in the first occurence since it's HasOne/MorphOne with dot notation (address[street] in request) to get the input name (address)
|
||||
$inputNameStart = strpos($row['name'], '[') + 1;
|
||||
} else {
|
||||
// repeatable fields, we need to get the input name and the row number
|
||||
// start on the second occurence since it's a repeatable and we want to bypass the row number (repeatableName[rowNumber][inputName])
|
||||
$inputNameStart = strpos($row['name'], '[', strpos($row['name'], '[') + 1) + 1;
|
||||
|
||||
// get the array key (aka repeatable row) from field name
|
||||
$startKey = strpos($row['name'], '[') + 1;
|
||||
$endKey = strpos($row['name'], ']', $startKey);
|
||||
$lengthKey = $endKey - $startKey;
|
||||
$repeatableRowKey = substr($row['name'], $startKey, $lengthKey);
|
||||
}
|
||||
|
||||
$inputNameEnd = strpos($row['name'], ']', $inputNameStart);
|
||||
$inputNameLength = $inputNameEnd - $inputNameStart;
|
||||
$inputName = substr($row['name'], $inputNameStart, $inputNameLength);
|
||||
$parentInputName = substr($row['name'], 0, strpos($row['name'], '['));
|
||||
|
||||
if (isset($repeatableRowKey)) {
|
||||
if ($isMultiple) {
|
||||
$result[$parentInputName][$repeatableRowKey][$inputName][] = $row['value'];
|
||||
continue;
|
||||
}
|
||||
|
||||
$result[$parentInputName][$repeatableRowKey][$inputName] = $row['value'];
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($isMultiple) {
|
||||
$result[$parentInputName][$inputName][] = $row['value'];
|
||||
continue;
|
||||
}
|
||||
$result[$parentInputName][$inputName] = $row['value'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_users_have_email')) {
|
||||
/**
|
||||
* Check if the email column is present on the user table.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function backpack_users_have_email()
|
||||
{
|
||||
$user_model_fqn = config('backpack.base.user_model_fqn');
|
||||
$user = new $user_model_fqn();
|
||||
|
||||
return \Schema::hasColumn($user->getTable(), config('backpack.base.email_column') ?? 'email');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_avatar_url')) {
|
||||
/**
|
||||
* Returns the avatar URL of a user.
|
||||
*
|
||||
* @param $user
|
||||
* @return string
|
||||
*/
|
||||
function backpack_avatar_url($user)
|
||||
{
|
||||
switch (config('backpack.base.avatar_type')) {
|
||||
case 'gravatar':
|
||||
if (backpack_users_have_email() && ! empty($user->email)) {
|
||||
$avatarLink = Gravatar::fallback(config('backpack.base.gravatar_fallback'))->get($user->email, ['size' => 80]);
|
||||
|
||||
// if we can save it locally, for safer loading, let's do it
|
||||
if (in_array(Basset::basset($avatarLink, false)->name, ['INTERNALIZED', 'IN_CACHE', 'LOADED'])) {
|
||||
return Basset::getUrl($avatarLink);
|
||||
}
|
||||
|
||||
return $avatarLink;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return method_exists($user, config('backpack.base.avatar_type')) ? $user->{config('backpack.base.avatar_type')}() : $user->{config('backpack.base.avatar_type')};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_middleware')) {
|
||||
/**
|
||||
* Return the key of the middleware used across Backpack.
|
||||
* That middleware checks if the visitor is an admin.
|
||||
*
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
function backpack_middleware()
|
||||
{
|
||||
return config('backpack.base.middleware_key', 'admin');
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_guard_name')) {
|
||||
/*
|
||||
* Returns the name of the guard defined
|
||||
* by the application config
|
||||
*/
|
||||
function backpack_guard_name()
|
||||
{
|
||||
return config('backpack.base.guard', config('auth.defaults.guard'));
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_auth')) {
|
||||
/*
|
||||
* Returns the user instance if it exists
|
||||
* of the currently authenticated admin
|
||||
* based off the defined guard.
|
||||
*/
|
||||
function backpack_auth()
|
||||
{
|
||||
return \Auth::guard(backpack_guard_name());
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_user')) {
|
||||
/*
|
||||
* Returns back a user instance without
|
||||
* the admin guard, however allows you
|
||||
* to pass in a custom guard if you like.
|
||||
*/
|
||||
function backpack_user()
|
||||
{
|
||||
return backpack_auth()->user();
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('mb_ucfirst')) {
|
||||
/**
|
||||
* Capitalize the first letter of a string,
|
||||
* even if that string is multi-byte (non-latin alphabet).
|
||||
*
|
||||
* @param string $string String to have its first letter capitalized.
|
||||
* @param encoding $encoding Character encoding
|
||||
* @return string String with first letter capitalized.
|
||||
*/
|
||||
function mb_ucfirst($string, $encoding = false)
|
||||
{
|
||||
$encoding = $encoding ? $encoding : mb_internal_encoding();
|
||||
|
||||
$strlen = mb_strlen($string, $encoding);
|
||||
$firstChar = mb_substr($string, 0, 1, $encoding);
|
||||
$then = mb_substr($string, 1, $strlen - 1, $encoding);
|
||||
|
||||
return mb_strtoupper($firstChar, $encoding).$then;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_view')) {
|
||||
/**
|
||||
* Returns a new displayable view path, based on the configured backpack view namespace.
|
||||
* If that view doesn't exist, it falls back to the fallback namespace.
|
||||
* If that view doesn't exist, it falls back to the one from the Backpack UI directory.
|
||||
*
|
||||
* @param string (see config/backpack/base.php)
|
||||
* @return string
|
||||
*/
|
||||
function backpack_view($view)
|
||||
{
|
||||
$viewPaths = [
|
||||
config('backpack.ui.view_namespace').$view,
|
||||
backpack_theme_config('view_namespace_fallback').$view,
|
||||
'backpack.ui::'.$view,
|
||||
];
|
||||
|
||||
foreach ($viewPaths as $view) {
|
||||
if (view()->exists($view)) {
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
||||
$errorMessage = 'The view: ['.$view.'] was not found in any of the following view paths: ['.implode(' ], [ ', $viewPaths).']';
|
||||
|
||||
$errorDetails = (function () {
|
||||
if (env('APP_ENV') === 'production' || ! env('APP_DEBUG')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2) ?? [];
|
||||
$functionCaller = $backtrace[1] ?? [];
|
||||
$functionLine = $functionCaller['line'] ?? 'N/A';
|
||||
$functionFile = $functionCaller['file'] ?? 'N/A';
|
||||
|
||||
return '- Called in: '.Str::after($functionFile, base_path()).' on line: '.$functionLine;
|
||||
})();
|
||||
|
||||
abort(500, $errorMessage.$errorDetails);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_theme_config')) {
|
||||
/**
|
||||
* Returns a config value from the current theme's config file.
|
||||
* It assumes the theme's config namespace is the same as the view namespace.
|
||||
*
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function backpack_theme_config($key)
|
||||
{
|
||||
$namespacedKey = config('backpack.ui.view_namespace').$key;
|
||||
$namespacedKey = str_replace('::', '.', $namespacedKey);
|
||||
|
||||
// if the config exists in the theme config file, use it
|
||||
if (config()->has($namespacedKey)) {
|
||||
return config($namespacedKey);
|
||||
}
|
||||
|
||||
// if not, fall back to a general the config in the fallback theme
|
||||
$namespacedKey = config('backpack.ui.view_namespace_fallback').$key;
|
||||
$namespacedKey = str_replace('::', '.', $namespacedKey);
|
||||
|
||||
if (config()->has($namespacedKey)) {
|
||||
return config($namespacedKey);
|
||||
}
|
||||
|
||||
// if not, fall back to the config in ui
|
||||
$namespacedKey = 'backpack.ui.'.$key;
|
||||
|
||||
if (config()->has($namespacedKey)) {
|
||||
return config($namespacedKey);
|
||||
}
|
||||
|
||||
Log::error('Could not find config key: '.$key.'. Neither in the Backpack theme, nor in the fallback theme, nor in ui.');
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('square_brackets_to_dots')) {
|
||||
/**
|
||||
* Turns a string from bracket-type array to dot-notation array.
|
||||
* Ex: array[0][property] turns into array.0.property.
|
||||
*
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
function square_brackets_to_dots($string)
|
||||
{
|
||||
$string = str_replace(['[', ']'], ['.', ''], $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('old_empty_or_null')) {
|
||||
/**
|
||||
* This method is an alternative to Laravel's old() helper, which mistakenly
|
||||
* returns NULL it two cases:
|
||||
* - if there is an old value, and it was empty or null
|
||||
* - if there is no old value
|
||||
* (this is because of the ConvertsEmptyStringsToNull middleware).
|
||||
*
|
||||
* In contrast, this method will return:
|
||||
* - the old value, if there actually is an old value for that key;
|
||||
* - the second parameter, if there is no old value for that key, but it was empty string or null;
|
||||
* - null, if there is no old value at all for that key;
|
||||
*
|
||||
* @param string $key
|
||||
* @param array|string $empty_value
|
||||
* @return mixed
|
||||
*/
|
||||
function old_empty_or_null($key, $empty_value = '')
|
||||
{
|
||||
$key = square_brackets_to_dots($key);
|
||||
$old_inputs = session()->getOldInput();
|
||||
|
||||
// if the input name is present in the old inputs we need to return earlier and not in a coalescing chain
|
||||
// otherwise `null` aka empty will not pass the condition and the field value would be returned.
|
||||
if (\Arr::has($old_inputs, $key)) {
|
||||
return \Arr::get($old_inputs, $key) ?? $empty_value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('is_multidimensional_array')) {
|
||||
/**
|
||||
* Check if the array is multidimensional.
|
||||
*
|
||||
* If $strict is enabled, the array is considered multidimensional only if all elements of the array are arrays.
|
||||
*/
|
||||
function is_multidimensional_array(array $array, bool $strict = false): bool
|
||||
{
|
||||
foreach ($array as $item) {
|
||||
if ($strict && ! is_array($item)) {
|
||||
return false;
|
||||
}
|
||||
if (! $strict && is_array($item)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return $strict;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('backpack_pro')) {
|
||||
/**
|
||||
* Check if the backpack/pro package is installed.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function backpack_pro()
|
||||
{
|
||||
return true;
|
||||
if (app()->runningUnitTests()) {
|
||||
return true;
|
||||
}
|
||||
if (! \Composer\InstalledVersions::isInstalled('backpack/pro')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return \Composer\InstalledVersions::getVersion('backpack/pro');
|
||||
}
|
||||
}
|
29
app/Providers/AppServiceProvider.php
Normal file
29
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
public $bindings = [
|
||||
\Backpack\PermissionManager\app\Http\Controllers\PermissionCrudController::class => \App\Http\Controllers\Admin\PermissionCrudController::class,
|
||||
\Backpack\PermissionManager\app\Http\Controllers\RoleCrudController::class => \App\Http\Controllers\Admin\RoleCrudController::class,
|
||||
\Backpack\PermissionManager\app\Http\Controllers\UserCrudController::class => \App\Http\Controllers\Admin\UserCrudController::class,
|
||||
];
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
26
app/Providers/AuthServiceProvider.php
Normal file
26
app/Providers/AuthServiceProvider.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
19
app/Providers/BroadcastServiceProvider.php
Normal file
19
app/Providers/BroadcastServiceProvider.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
38
app/Providers/EventServiceProvider.php
Normal file
38
app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*/
|
||||
public function shouldDiscoverEvents(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
40
app/Providers/RouteServiceProvider.php
Normal file
40
app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to your application's "home" route.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/home';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user