Compare commits

..

No commits in common. "master" and "dev" have entirely different histories.
master ... dev

3861 changed files with 371694 additions and 438107 deletions

6
.gitignore vendored
View File

@ -1,13 +1,9 @@
/node_modules
/bootstrap
/public/hot
/public/storage
/public/uploads
/storage/*.key
/storage/framework/cache/data
/storage/framework/laravel-excel
/storage/framework/sessions
/storage/framework/views
/storage/app/public
/storage/app/temp
/storage/app/uploads
@ -52,4 +48,4 @@ Homestead.json
### Vuejs ###
# Recommended template: Node.gitignore
dist/
dist/

View File

@ -1,91 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\CategoryRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class CategoryCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class CategoryCrudController 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\Category::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/category');
CRUD::setEntityNameStrings(trans('backpack::model.category'), trans('backpack::model.categories'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('id');
CRUD::column('title');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(CategoryRequest::class);
CRUD::field('title');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => '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();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'title');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,97 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\ContactRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class ContactCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class ContactCrudController 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\Contact::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/contact');
CRUD::setEntityNameStrings(trans('backpack::model.contact'), trans('backpack::model.contacts'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('name');
CRUD::column('contacts');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(ContactRequest::class);
CRUD::field('name');
CRUD::field('contacts')->type('table')->columns([
'title' => 'Title',
'phone' => 'Phone',
'mail' => 'Mail',
'fax' => 'Fax'
])->entity_singular('contact')->max(2)->min(1)->new_item_label("Add contact");
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => '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();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'name');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,90 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\DocumentCategoryRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class DocumentCategoryCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class DocumentCategoryCrudController 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\DocumentCategory::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/document-category');
CRUD::setEntityNameStrings(trans('backpack::model.category'), trans('backpack::model.categories'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('title');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(DocumentCategoryRequest::class);
CRUD::field('title');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => '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();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'title');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,63 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\DocumentRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class DocumentCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class DocumentCrudController 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;
public function setup()
{
$this->crud->setModel('App\Models\Document');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/document');
$this->crud->setEntityNameStrings(trans('backpack::model.document'), trans('backpack::model.documents'));
}
protected function setupListOperation()
{
// TODO: remove setFromDb() and manually define Columns, maybe Filters
CRUD::column('document_category_id')->type('select')->entity('documentCategory')->model('App\Models\DocumentCategory')->attribute('title');
CRUD::column('title');
CRUD::column('file');
CRUD::column('page');
}
protected function setupCreateOperation()
{
$this->crud->setValidation(DocumentRequest::class);
// TODO: remove setFromDb() and manually define Fields
CRUD::field('document_category_id')->type('select')->entity('documentCategory')->model('App\Models\DocumentCategory')->attribute('title');
CRUD::field('title');
CRUD::field('file')->type('upload')->upload(true);
CRUD::field('page');
}
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'title');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\App;
class LocalizationController extends Controller
{
public function setLang($lang){
if($lang == 'ru'){
session()->put('locale', $lang);
App::setLocale('ru');
}
elseif($lang == 'tm'){
session()->put('locale', $lang);
App::setLocale('tm');
}
else{
session()->put('locale', $lang);
App::setLocale('en');
}
return redirect()->back();
}
}

View File

@ -1,92 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\MultimediaCategoryRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class MultimediaCategoryCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class MultimediaCategoryCrudController 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\MultimediaCategory::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/multimedia-category');
CRUD::setEntityNameStrings(trans('backpack::model.category'), trans('backpack::model.categories'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('title');
CRUD::column('type')->type('select_from_array')->options(['image' => 'Image', 'video' => 'Video']);
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(MultimediaCategoryRequest::class);
CRUD::field('title');
CRUD::field('type')->type('select_from_array')->options(['image' => 'Image', 'video' => 'Video']);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => '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();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'title');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,84 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\MultimediaRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class MultimediaCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class MultimediaCrudController 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\Multimedia::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/multimedia');
CRUD::setEntityNameStrings(trans('backpack::model.multimedia'), trans('backpack::model.multimedia'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('multimedia_category_id')->type('select')->entity('multimediaCategory')->model('App\Models\MultimediaCategory')->attribute('title');
CRUD::column('title');
CRUD::column('media');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(MultimediaRequest::class);
CRUD::field('multimedia_category_id')->type('select')->entity('multimediaCategory')->model('App\Models\MultimediaCategory')->attribute('title');
CRUD::field('title');
CRUD::field('media')->type('upload')->upload(true);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -1,88 +0,0 @@
<?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('backpack::model.news'), trans('backpack::model.news'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('title');
CRUD::column('short_description');
CRUD::column('description');
CRUD::column('image')->type('image');
CRUD::column('date');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(NewsRequest::class);
CRUD::field('title');
CRUD::field('short_description');
CRUD::field('description');
CRUD::field('image')->type('image');
CRUD::field('date');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -1,82 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\PageRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class PageCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class PageCrudController 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\Page::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/page');
CRUD::setEntityNameStrings(trans('backpack::model.page'), trans('backpack::model.pages'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('title');
CRUD::column('content');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(PageRequest::class);
CRUD::field('title');
CRUD::field('content')->type('ckeditor');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -1,86 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\SelectedTradingRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class SelectedTradingCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class SelectedTradingCrudController 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\SelectedTrading::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/selected-trading');
CRUD::setEntityNameStrings(trans('backpack::model.selected_trading'), trans('backpack::model.selected_tradings'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('category_id');
CRUD::column('title');
CRUD::column('currency')->type('select_from_array')->options(['TMT' => 'TMT', 'USD' => 'USD']);
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(SelectedTradingRequest::class);
CRUD::field('category_id');
CRUD::field('title');
CRUD::field('currency')->type('select2_from_array')->options(['TMT' => 'TMT', 'USD' => 'USD']);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -1,101 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\TarifRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class TarifCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class TarifCrudController 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\Tarif::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/tarif');
CRUD::setEntityNameStrings(trans('backpack::model.tariff'), trans('backpack::model.tariffs'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('type')->type('select_from_array')->options(['resident' => 'Для резидентов', 'non_resident' => 'Для не резидентов'])->allows_null(false);
CRUD::column('title');
CRUD::column('prices');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(TarifRequest::class);
CRUD::field('type')->type('select_from_array')->options(['resident' => 'Для резидентов', 'non_resident' => 'Для не резидентов'])->allows_null(false);
CRUD::field('title');
CRUD::field('prices')->type('repeatable')->fields([
[
'name' => 'price',
'type' => 'text',
'label' => 'Price',
'wrapper' => ['class' => 'form-group col-md-12'],
],
])->new_item_label("Add price");
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => '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();
}
protected function setupReorderOperation()
{
// define which model attribute will be shown on draggable elements
$this->crud->set('reorder.label', 'title');
// define how deep the admin is allowed to nest the items
// for infinite levels, set it to 0
$this->crud->set('reorder.max_level', 1);
}
}

View File

@ -1,107 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\TradingRequest;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class TradingCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class TradingCrudController 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\Trading::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/trading');
CRUD::setEntityNameStrings(trans('backpack::model.trading'), trans('backpack::model.tradings'));
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('group_id');
CRUD::column('subgroup_id');
CRUD::column('category_id');
CRUD::column('title');
CRUD::column('price');
CRUD::column('unit');
CRUD::column('amount');
CRUD::column('currency');
CRUD::column('seller_country');
CRUD::column('buyer_country');
CRUD::column('point');
CRUD::column('is_line');
CRUD::column('locale');
CRUD::column('created_at');
CRUD::column('updated_at');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(TradingRequest::class);
CRUD::field('group_id');
CRUD::field('subgroup_id');
CRUD::field('category_id');
CRUD::field('type');
CRUD::field('title');
CRUD::field('unit');
CRUD::field('amount');
CRUD::field('currency');
CRUD::field('seller_country');
CRUD::field('buyer_country');
CRUD::field('point');
CRUD::field('price');
CRUD::field('is_line');
CRUD::field('locale');
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -1,88 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Requests\VideoRequest;
use App\Models\Video;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
/**
* Class VideoCrudController
* @package App\Http\Controllers\Admin
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
*/
class VideoCrudController 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\Video::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/video');
CRUD::setEntityNameStrings(trans('backpack::model.video'), trans('backpack::model.videos'));
if(count(\App\Models\Video::all()) > 0){
$this->crud->denyAccess('create');
}
}
/**
* Define what happens when the List operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
* @return void
*/
protected function setupListOperation()
{
CRUD::column('title');
CRUD::column('image')->type('image');
CRUD::column('video');
/**
* Columns can be defined using the fluent syntax or array syntax:
* - CRUD::column('price')->type('number');
* - CRUD::addColumn(['name' => '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(VideoRequest::class);
CRUD::field('title');
CRUD::field('image')->type('image');
CRUD::field('video')->type('upload')->upload(true);
/**
* Fields can be defined using the fluent syntax or array syntax:
* - CRUD::field('price')->type('number');
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
*/
}
/**
* Define what happens when the Update operation is loaded.
*
* @see https://backpackforlaravel.com/docs/crud-operation-update
* @return void
*/
protected function setupUpdateOperation()
{
$this->setupCreateOperation();
}
}

View File

@ -3,6 +3,8 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class ApiBaseController extends Controller
{

View File

@ -1,235 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use League\Fractal\Resource\Collection;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
class ApiController extends Controller
{
/**
* @var int $statusCode
*/
protected $statusCode = 200;
const CODE_WRONG_ARGS = 'GEN-FUBARGS';
const CODE_NOT_FOUND = 'GEN-LIKETHEWIND';
const CODE_INTERNAL_ERROR = 'GEN-AAAGGH';
const CODE_UNAUTHORIZED = 'GEN-MAYBGTFO';
const CODE_FORBIDDEN = 'GEN-GTFO';
const CODE_INVALID_MIME_TYPE = 'GEN-UMWUT';
/**
* @var Manager $fractal
*/
protected $fractal;
public $locale;
public function __construct(Request $request)
{
$this->fractal = new Manager;
$this->locale = $request->header('X-Localization') ?? 'ru';
}
/**
* Get the status code.
*
* @return int $statusCode
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* Set the status code.
*
* @param $statusCode
* @return $this
*/
public function setStatusCode($statusCode)
{
$this->statusCode = $statusCode;
return $this;
}
/**
* Repond a no content response.
*
* @return response
*/
public function noContent()
{
return response()->json(null, 204);
}
/**
* Respond the item data.
*
* @param $item
* @param $callback
* @return mixed
*/
public function respondWithItem($item, $callback, $message = 'Successfully')
{
$resource = new Item($item, $callback);
$data = $this->fractal->createData($resource)->toArray();
$data['message'] = $message;
return $this->respondWithArray($data);
}
/**
* Respond the collection data.
*
* @param $collection
* @param $callback
* @return mixed
*/
public function respondWithCollection($collection, $callback, $message = 'Successfully')
{
$resource = new Collection($collection, $callback);
$data = $this->fractal->createData($resource)->toArray();
$data['message'] = $message;
return $this->respondWithArray($data);
}
/**
* Respond the collection data with pagination.
*
* @param $paginator
* @param $callback
* @return mixed
*/
public function respondWithPaginator($paginator, $callback, $message = 'Successfully')
{
$resource = new Collection($paginator->getCollection(), $callback);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
$data = $this->fractal->createData($resource)->toArray();
$data['message'] = $message;
return $this->respondWithArray($data);
}
/**
* Respond the data.
*
* @param array $array
* @param array $headers
* @return mixed
*/
public function respondWithArray(array $array, array $headers = [])
{
return response()->json($array, $this->statusCode, $headers);
}
/**
* Respond the message.
*
* @param string $message
* @return json
*/
public function respondWithMessage ($message) {
return $this->setStatusCode(200)
->respondWithArray([
'message' => $message,
]);
}
/**
* Respond the error message.
*
* @param string $message
* @param string $errorCode
* @return json
*/
protected function respondWithError($message, $errorCode, $errors = [])
{
if ($this->statusCode === 200) {
trigger_error(
"You better have a really good reason for erroring on a 200...",
E_USER_WARNING
);
}
return $this->respondWithArray([
'errors' => $errors,
'code' => $errorCode,
'message' => $message,
]);
}
/**
* Respond the error of 'Forbidden'
*
* @param string $message
* @return json
*/
public function errorForbidden($message = 'Forbidden', $errors = [])
{
return $this->setStatusCode(500)
->respondWithError($message, self::CODE_FORBIDDEN, $errors);
}
/**
* Respond the error of 'Internal Error'.
*
* @param string $message
* @return json
*/
public function errorInternalError($message = 'Internal Error', $errors = [])
{
return $this->setStatusCode(500)
->respondWithError($message, self::CODE_INTERNAL_ERROR, $errors);
}
/**
* Respond the error of 'Resource Not Found'
*
* @param string $message
* @return json
*/
public function errorNotFound($message = 'Resource Not Found', $errors = [])
{
return $this->setStatusCode(404)
->respondWithError($message, self::CODE_NOT_FOUND, $errors);
}
/**
* Respond the error of 'Unauthorized'.
*
* @param string $message
* @return json
*/
public function errorUnauthorized($message = 'Unauthorized', $errors = [])
{
return $this->setStatusCode(401)
->respondWithError($message, self::CODE_UNAUTHORIZED, $errors);
}
/**
* Respond the error of 'Wrong Arguments'.
*
* @param string $message
* @return json
*/
public function errorWrongArgs($message = 'Wrong Arguments', $errors = [])
{
return $this->setStatusCode(400)
->respondWithError($message, self::CODE_WRONG_ARGS, $errors);
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\ApiController;
use App\Models\Category;
use App\Transformers\CategoryTransformer;
class CategoryController extends ApiController
{
public function index()
{
$categories = Category::orderBy('lft', 'asc')->limit(2)->get();
return $this->respondWithCollection($categories, new CategoryTransformer($this->locale, 'trading'));
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Contact;
use App\Transformers\ContactTransformer;
class ContactController extends ApiController
{
public function index()
{
$contacts = Contact::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($contacts, new ContactTransformer($this->locale));
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\DocumentCategory;
use App\Transformers\CategoryTransformer;
class DocumentCategoryController extends ApiController
{
public function index()
{
$categories = DocumentCategory::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($categories, new CategoryTransformer($this->locale, 'trading'));
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Document;
use App\Transformers\DocumentTransformer;
use Illuminate\Http\Request;
class DocumentController extends ApiController
{
public function index(Request $request)
{
$page = $request->page ?? null;
$category = $request->category ?? null;
if($page){
$documents = Document::where('page', $page)->orderBy('lft', 'asc');
if(count($documents->get()) < 1){
return $this->errorNotFound();
}
}else{
$documents = Document::orderBy('lft', 'asc');
}
if($category){
$documents = $documents->where('document_category_id', $category);
}
return $this->respondWithCollection($documents->get(), new DocumentTransformer($this->locale));
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\ApiController;
use App\Models\MultimediaCategory;
use App\Transformers\CategoryTransformer;
class MultimediaCategoryController extends ApiController
{
public function index()
{
$categories = MultimediaCategory::orderBy('lft', 'asc')->get();
return $this->respondWithCollection($categories, new CategoryTransformer($this->locale, 'media'));
}
}

View File

@ -1,18 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\MultimediaCategory;
use App\Transformers\MediaTransformer;
class MultimediaController extends ApiController
{
public function index($category)
{
$medias = MultimediaCategory::where('id', $category)->with('medias')->get()->first();
if($medias){
return $this->respondWithCollection($medias->medias, new MediaTransformer());
}
return $this->errorNotFound();
}
}

View File

@ -1,16 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\ApiController;
use App\Models\News;
use App\Transformers\NewsTransformer;
class NewsController extends ApiController
{
public function index()
{
$news = News::latest('date')->paginate(9);
return $this->respondWithPaginator($news, new NewsTransformer($this->locale));
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Page;
use App\Transformers\PageTransformer;
use Illuminate\Http\Request;
class PageController extends ApiController
{
public function index(Request $request)
{
$page_title = $request->page;
if(!$page_title){
return $this->errorWrongArgs();
}
$page = Page::where('title', $page_title)->get()->first();
if($page){
return $this->respondWithItem($page, new PageTransformer($this->locale));
}
return $this->errorNotFound();
}
}

View File

@ -1,24 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Tarif;
use App\Transformers\TarifTransformer;
use Illuminate\Http\Request;
class TarifController extends ApiController
{
public function index(Request $request)
{
$type = $request->type ?? null;
if($type){
$tarifs = Tarif::where('type', $type)->orderBy('lft', 'asc')->get();
if(count($tarifs) < 1){
return $this->errorNotFound();
}
}else{
$tarifs = Tarif::orderBy('lft', 'asc')->get();
}
return $this->respondWithCollection($tarifs, new TarifTransformer($this->locale));
}
}

View File

@ -1,96 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Category;
use App\Models\Group;
use App\Models\Trading;
use App\Transformers\TradingTransformer;
class TradingsController extends ApiController
{
public function index()
{
$last_tradings = Group::where("type", "trading")->with("tradings")->latest()->first()->tradings;
$last_tradings = $last_tradings->unique('title');
$tradings = $this->getTradingsStatistics($last_tradings);
$extra_tradings = $this->getExtraTradings($last_tradings->values()[0]["group_id"]);
$tradings = array_merge($tradings, $extra_tradings);
$tradings = Trading::hydrate($tradings);
$tradings = $tradings->unique('title')->values()->slice(0, 15);
return $this->respondWithCollection($tradings, new TradingTransformer);
}
public function getExtraTradings($group_id){
$tradings = Trading::where('group_id', '!=', $group_id)->limit(150)->latest()->get();
return $this->getTradingsStatistics($tradings->unique('title'));
}
public function getTradingsStatistics($tradings){
$myTradings = [];
foreach($tradings as $trading){
$before_last_trading = Trading::where("title",'LIKE', "%{$trading->title}%")->where('group_id', '!=', $trading->group_id)->latest()->first();
$difference = !$before_last_trading ? 0 : $this->getPercentageDifference($trading->price ?? 0, $before_last_trading->price ?? 0);
array_push($myTradings, (object)[
'id' => $trading->id,
'title' => trim(strtok($trading->title, '(')),
'price' => $trading->price,
'old_price' => !$before_last_trading ? 0 : $before_last_trading->price,
'price_change' => number_format($difference, 1, ".", "")."%",
'currency' => $trading->currency,
]);
}
return $myTradings;
}
public function selectedTradings($id){
if($id){
$category = Category::with('selectedTradings')->find($id);
if($category){
$selectedTradings = $category->selectedTradings;
$myTradings = array();
foreach ($selectedTradings as $item) {
$tradings = Trading::where("title", 'LIKE', "%{$item->title}%")->where('currency', $item->currency)->orderBy('created_at', 'DESC')->get();
$tradings = $tradings->unique('group_id')->slice(0, 10)->values();
$prices = array();
foreach ($tradings as $trading) {
array_push($prices, (object)[
'price' => $trading->price,
'date' => $trading->created_at->todatetimestring(),
]);
}
$last_trading = $tradings[0];
$before_last_trading = count($tradings) > 1 ? $tradings[1] : null;
$difference = !$before_last_trading ? 0 : $this->getPercentageDifference($last_trading->price ?? 0, $before_last_trading->price ?? 0);
array_push($myTradings, (object)[
'id' => $last_trading->id,
'title' => trim(strtok($last_trading->title, '(')),
'price' => $last_trading->price,
'old_price' => !$before_last_trading ? 0 : $before_last_trading->price,
'price_change' => !$before_last_trading ? '100%' : number_format($difference, 1, ".", "")."%",
'currency' => $last_trading->currency,
'all_prices' => $prices
]);
}
$tradings = Trading::hydrate($myTradings);
return $this->respondWithCollection($tradings, new TradingTransformer('selected'));
}
return $this->errorNotFound();
}
return $this->errorWrongArgs();
}
function getPercentageDifference($new, $old){
return (($new - $old) / abs($old)) * 100;
}
}

View File

@ -1,15 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Models\Video;
use App\Transformers\VideoTransformer;
class VideoController extends ApiController
{
public function index()
{
$video = Video::latest()->first();
return $this->respondWithItem($video, new VideoTransformer($this->locale));
}
}

View File

@ -57,7 +57,7 @@ class GroupController extends Controller
'is_default' => $request->is_default
]);
return redirect('groups?type=' . request('type', 'import'));
return redirect()->back();
}
/**
@ -85,7 +85,7 @@ class GroupController extends Controller
$group->update($validated);
return redirect('groups?type=' . request('type', 'import'));
return redirect()->back();
}
/**
@ -94,11 +94,11 @@ class GroupController extends Controller
* @param \App\Models\Export $export
* @return \Illuminate\Http\Response
*/
public function destroy(Group $group, Request $request)
public function destroy(Group $group)
{
$group->delete();
return redirect('groups?type=' . $group->type)->with('success', 'Group deleted');
return redirect()->back()->with('success', 'Group deleted');
}
/**

View File

@ -26,7 +26,7 @@ class HomeController extends Controller
{
session()->put('locale', $lang);
return redirect(url()->previous());
return redirect()->back();
}
/**
@ -53,15 +53,4 @@ class HomeController extends Controller
{
return view('logout');
}
/**
* Redirect to a definite resource, if no access
*/
public function needAuthFirst()
{
return Inertia::render('NeedAuthFirst', [
'text' => settings('text')[app()->getLocale()],
'parent_app' => env('PARENT_APP')
]);
}
}

View File

@ -58,7 +58,7 @@ class RequestController extends Controller
], 400);
}
$loginResponse = Http::post('https://tmex.gov.tm/api/auth-for-make-requests', [
$loginResponse = Http::post('http://127.0.0.1:8000/api/auth-for-make-requests', [
'username' => $input['phone'],
'password' => $input['password'],
]);
@ -89,7 +89,7 @@ class RequestController extends Controller
}
// try to withdraw fee from the balance for creating a request
$balanceResponse = Http::post('https://tmex.gov.tm/api/v1/withdraw-from-balance?token=' . $loginResponse['token'], [
$balanceResponse = Http::post('http://127.0.0.1:8000/api/v1/withdraw-from-balance?token=' . $loginResponse['token'], [
// 'token' => $loginResponse['token'],
'total_price' => $input['totalPrice'], // USD or TMT
'currency' => $input['currency'],

View File

@ -66,7 +66,7 @@ class TradingController extends Controller
{
request()->validate([
'group' => ['exists:groups,id'],
'file' => ['required', 'mimes:xlsx, csv, xls'],
'file' => ['required', 'mimes:xlsx'],
]);
if (!$group = Group::find(request('group'))) {

View File

@ -21,7 +21,6 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
];
/**
@ -39,8 +38,7 @@ class Kernel extends HttpKernel
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\HandleInertiaRequests::class,
// \App\Http\Middleware\SetLocale::class,
'web_localization',
\App\Http\Middleware\SetLocale::class,
],
'api' => [
@ -67,6 +65,5 @@ class Kernel extends HttpKernel
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'check_october_session' => \App\Http\Middleware\CheckOctoberSession::class,
'web_localization' => \App\Http\Middleware\WebLocalization::class
];
}

View File

@ -1,68 +0,0 @@
<?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);
}
}

View File

@ -34,16 +34,16 @@ class CheckOctoberSession
$user = BirzhaUser::find($userId);
if(is_null($user)) {
return redirect()->route('need_auth_first');
return redirect()->away(env('PARENT_APP'));
} else {
return $next($request);
}
} else {
return redirect()->route('need_auth_first');
return redirect()->away(env('PARENT_APP'));
}
} catch(Throwable $th) {
\Log::info($th);
return redirect()->route('need_auth_first');
return redirect()->away(env('PARENT_APP'));
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
class WebLocalization
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
*/
public function handle(Request $request, Closure $next)
{
$raw_locale = $request->session()->get('locale');
if (in_array($raw_locale, Config::get('app.locales'))) {
$locale = $raw_locale;
}
else $locale = Config::get('app.locale');
$request->session()->put('locale', $locale ?? 'en');
app()->setLocale($locale);
return $next($request);
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CategoryRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class ContactRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class DocumentCategoryRequest 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 [
//
];
}
}

View File

@ -1,56 +0,0 @@
<?php
namespace App\Http\Requests;
use App\Http\Requests\Request;
use Illuminate\Foundation\Http\FormRequest;
class DocumentRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class MultimediaCategoryRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class MultimediaRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class PageRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class SelectedTradingRequest 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 [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreContactRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreMultimediaCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreMultimediaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreNewsRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreSelectedTradingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreTarifRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreVideoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoredocumentCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TarifRequest 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 [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class TradingRequest 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 [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateContactRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateMultimediaCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateMultimediaRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateNewsRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatePageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateSelectedTradingRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateTarifRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdateVideoRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class UpdatedocumentCategoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return false;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class VideoRequest 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 [
//
];
}
}

View File

@ -4,11 +4,10 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Spatie\Translatable\HasTranslations;
class Category extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
@ -31,9 +30,4 @@ class Category extends Model
{
return $this->hasMany(Trading::class);
}
public function selectedTradings()
{
return $this->hasMany(SelectedTrading::class);
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class Contact extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = ['id'];
public $translatable = ['name', 'contacts'];
}

View File

@ -1,43 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class Document extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title', 'file'];
public static function boot()
{
parent::boot();
static::deleting(function($obj) {
\Storage::disk('uploads')->delete($obj->image);
});
}
public function setFileAttribute($value)
{
$attribute_name = "file";
$disk = config('backpack.base.root_disk_name');
$destination_path = "public/uploads/documents";
$this->uploadFileToDisk($value, $attribute_name, $disk, $destination_path, $fileName = null);
return $this->attributes[$attribute_name]; // uncomment if this is a translatable field
}
public function documentCategory()
{
return $this->belongsTo(DocumentCategory::class);
}
}

View File

@ -1,22 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class DocumentCategory extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title'];
public function documents()
{
return $this->hasMany(Document::class);
}
}

View File

@ -1,31 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Multimedia extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
protected $guarded = [''];
public function multimediaCategory()
{
return $this->belongsTo(MultimediaCategory::class);
}
public function setMediaAttribute($value)
{
$attribute_name = "media";
$disk = config('backpack.base.root_disk_name');
$destination_path = "public/uploads/media";
$this->uploadFileToDisk($value, $attribute_name, $disk, $destination_path, $fileName = null);
// return $this->attributes[$attribute_name]; // uncomment if this is a translatable field
}
}

View File

@ -1,22 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class MultimediaCategory extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title'];
public function medias()
{
return $this->hasMany(Multimedia::class);
}
}

View File

@ -1,77 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Support\Str;
use Intervention\Image\ImageManagerStatic as Image;
class News extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title', 'short_description', 'description'];
public static function boot()
{
parent::boot();
static::deleted(function($obj) {
\Storage::disk('uploads')->delete($obj->image);
});
}
public function setImageAttribute($value)
{
$attribute_name = "image";
// or use your own disk, defined in config/filesystems.php
$disk = config('backpack.base.root_disk_name');
// destination path relative to the disk above
$destination_path = "public/uploads/news";
// if the image was erased
if (empty($value)) {
// delete the image from disk
if (isset($this->{$attribute_name}) && !empty($this->{$attribute_name})) {
\Storage::disk($disk)->delete($this->{$attribute_name});
}
// set null on database column
$this->attributes[$attribute_name] = null;
}
// if a base64 was sent, store it in the db
if (Str::startsWith($value, 'data:image'))
{
// 0. Make the image
$image = \Image::make($value)->encode('jpg', 90);
// 1. Generate a filename.
$filename = md5($value.time()).'.jpg';
// 2. Store the image on disk.
\Storage::disk($disk)->put($destination_path.'/'.$filename, $image->stream());
// 3. Delete the previous image, if there was one.
if (isset($this->{$attribute_name}) && !empty($this->{$attribute_name})) {
\Storage::disk($disk)->delete($this->{$attribute_name});
}
// 4. Save the public path to the database
// but first, remove "public/" from the path, since we're pointing to it
// from the root folder; that way, what gets saved in the db
// is the public URL (everything that comes after the domain name)
$public_destination_path = Str::replaceFirst('public/', '', $destination_path);
$this->attributes[$attribute_name] = $public_destination_path.'/'.$filename;
// TODO
// crop image to 300x300
} elseif (!empty($value)) {
// if value isn't empty, but it's not an image, assume it's the model value for that attribute.
$this->attributes[$attribute_name] = $this->{$attribute_name};
}
}
}

View File

@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class Page extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['content'];
}

View File

@ -1,19 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class SelectedTrading extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
protected $guarded = [''];
public function category()
{
return $this->belongsTo(Category::class);
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
class Tarif extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title', 'prices'];
protected $casts = [
'prices' => 'json',
];
}

View File

@ -8,7 +8,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Trading extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
protected $guarded = ['id'];

View File

@ -1,90 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
use Illuminate\Support\Str;
use Intervention\Image\ImageManagerStatic as Image;
class Video extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use HasTranslations;
protected $guarded = [''];
public $translatable = ['title', 'video'];
public static function boot()
{
parent::boot();
static::deleting(function($obj) {
\Storage::disk('uploads')->delete($obj->image);
});
}
public function setImageAttribute($value)
{
$attribute_name = "image";
// or use your own disk, defined in config/filesystems.php
$disk = config('backpack.base.root_disk_name');
// destination path relative to the disk above
$destination_path = "public/uploads/videos/images";
// if the image was erased
if (empty($value)) {
// delete the image from disk
if (isset($this->{$attribute_name}) && !empty($this->{$attribute_name})) {
\Storage::disk($disk)->delete($this->{$attribute_name});
}
// set null on database column
$this->attributes[$attribute_name] = null;
}
// if a base64 was sent, store it in the db
if (Str::startsWith($value, 'data:image'))
{
// 0. Make the image
$image = \Image::make($value)->encode('jpg', 90);
// 1. Generate a filename.
$filename = md5($value.time()).'.jpg';
// 2. Store the image on disk.
\Storage::disk($disk)->put($destination_path.'/'.$filename, $image->stream());
// 3. Delete the previous image, if there was one.
if (isset($this->{$attribute_name}) && !empty($this->{$attribute_name})) {
\Storage::disk($disk)->delete($this->{$attribute_name});
}
// 4. Save the public path to the database
// but first, remove "public/" from the path, since we're pointing to it
// from the root folder; that way, what gets saved in the db
// is the public URL (everything that comes after the domain name)
$public_destination_path = Str::replaceFirst('public/', '', $destination_path);
$this->attributes[$attribute_name] = $public_destination_path.'/'.$filename;
// TODO
// crop image to 300x300
} elseif (!empty($value)) {
// if value isn't empty, but it's not an image, assume it's the model value for that attribute.
$this->attributes[$attribute_name] = $this->{$attribute_name};
}
}
public function setVideoAttribute($value)
{
$attribute_name = "video";
$disk = config('backpack.base.root_disk_name');
$destination_path = "public/uploads/videos";
$this->uploadFileToDisk($value, $attribute_name, $disk, $destination_path, $fileName = null);
return $this->attributes[$attribute_name]; // uncomment if this is a translatable field
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Contact;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class ContactPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Contact $contact
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Contact $contact)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Contact $contact
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Contact $contact)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Contact $contact
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Contact $contact)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Contact $contact
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Contact $contact)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Contact $contact
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Contact $contact)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\documentCategory;
use Illuminate\Auth\Access\HandlesAuthorization;
class DocumentCategoryPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\documentCategory $documentCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, documentCategory $documentCategory)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\documentCategory $documentCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, documentCategory $documentCategory)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\documentCategory $documentCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, documentCategory $documentCategory)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\documentCategory $documentCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, documentCategory $documentCategory)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\documentCategory $documentCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, documentCategory $documentCategory)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Document;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class DocumentPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Document $document
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Document $document)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Document $document
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Document $document)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Document $document
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Document $document)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Document $document
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Document $document)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Document $document
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Document $document)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\MultimediaCategory;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MultimediaCategoryPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\MultimediaCategory $multimediaCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, MultimediaCategory $multimediaCategory)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\MultimediaCategory $multimediaCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, MultimediaCategory $multimediaCategory)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\MultimediaCategory $multimediaCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, MultimediaCategory $multimediaCategory)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\MultimediaCategory $multimediaCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, MultimediaCategory $multimediaCategory)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\MultimediaCategory $multimediaCategory
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, MultimediaCategory $multimediaCategory)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Multimedia;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class MultimediaPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Multimedia $multimedia
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Multimedia $multimedia)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Multimedia $multimedia
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Multimedia $multimedia)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Multimedia $multimedia
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Multimedia $multimedia)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Multimedia $multimedia
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Multimedia $multimedia)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Multimedia $multimedia
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Multimedia $multimedia)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\News;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class NewsPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\News $news
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, News $news)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\News $news
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, News $news)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\News $news
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, News $news)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\News $news
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, News $news)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\News $news
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, News $news)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Page;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class PagePolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Page $page
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Page $page)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Page $page
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Page $page)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Page $page
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Page $page)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Page $page
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Page $page)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Page $page
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Page $page)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\SelectedTrading;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class SelectedTradingPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\SelectedTrading $selectedTrading
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, SelectedTrading $selectedTrading)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\SelectedTrading $selectedTrading
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, SelectedTrading $selectedTrading)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\SelectedTrading $selectedTrading
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, SelectedTrading $selectedTrading)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\SelectedTrading $selectedTrading
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, SelectedTrading $selectedTrading)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\SelectedTrading $selectedTrading
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, SelectedTrading $selectedTrading)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\Tarif;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class TarifPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Tarif $tarif
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Tarif $tarif)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Tarif $tarif
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Tarif $tarif)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Tarif $tarif
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Tarif $tarif)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Tarif $tarif
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Tarif $tarif)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Tarif $tarif
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Tarif $tarif)
{
//
}
}

View File

@ -1,94 +0,0 @@
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Video;
use Illuminate\Auth\Access\HandlesAuthorization;
class VideoPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function viewAny(User $user)
{
//
}
/**
* Determine whether the user can view the model.
*
* @param \App\Models\User $user
* @param \App\Models\Video $video
* @return \Illuminate\Auth\Access\Response|bool
*/
public function view(User $user, Video $video)
{
//
}
/**
* Determine whether the user can create models.
*
* @param \App\Models\User $user
* @return \Illuminate\Auth\Access\Response|bool
*/
public function create(User $user)
{
//
}
/**
* Determine whether the user can update the model.
*
* @param \App\Models\User $user
* @param \App\Models\Video $video
* @return \Illuminate\Auth\Access\Response|bool
*/
public function update(User $user, Video $video)
{
//
}
/**
* Determine whether the user can delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Video $video
* @return \Illuminate\Auth\Access\Response|bool
*/
public function delete(User $user, Video $video)
{
//
}
/**
* Determine whether the user can restore the model.
*
* @param \App\Models\User $user
* @param \App\Models\Video $video
* @return \Illuminate\Auth\Access\Response|bool
*/
public function restore(User $user, Video $video)
{
//
}
/**
* Determine whether the user can permanently delete the model.
*
* @param \App\Models\User $user
* @param \App\Models\Video $video
* @return \Illuminate\Auth\Access\Response|bool
*/
public function forceDelete(User $user, Video $video)
{
//
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Transformers;
use League\Fractal\TransformerAbstract;
class CategoryTransformer extends TransformerAbstract
{
private $locale;
private $type;
public function __construct($locale, $type)
{
$this->locale = $locale;
$this->type = $type;
}
public function transform($category)
{
return $this->type == 'trading' ? [
'id' => $category->id,
'title' => $category->getTranslations('title', [$this->locale])[$this->locale] ?? '-',
] : [
'id' => $category->id,
'title' => $category->getTranslations('title', [$this->locale])[$this->locale] ?? '-',
'type' => $category->type,
];
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Contact;
use League\Fractal\TransformerAbstract;
class ContactTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(Contact $contact)
{
$translatedContact = $contact->getTranslations('contacts',[$this->locale]);
$contacts = $translatedContact ? json_decode($translatedContact[$this->locale], true) : [];
return [
'id' => $contact->id,
'name' => $contact->getTranslations('name',[$this->locale])[$this->locale] ?? '-',
'contacts' => $contacts,
];
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Document;
use Illuminate\Support\Str;
use League\Fractal\TransformerAbstract;
class DocumentTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(Document $document)
{
$translatedFile = $document->getTranslations('file',[$this->locale]);
$file = $translatedFile ? url(Str::replaceFirst('public/', '', $translatedFile[$this->locale])) : '-';
return [
'id' => $document->id,
'title' => $document->getTranslations('title',[$this->locale])[$this->locale] ?? '-',
'page' => $document->page,
'file' => $file,
];
}
}

View File

@ -1,20 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Multimedia;
use Illuminate\Support\Str;
use League\Fractal\TransformerAbstract;
class MediaTransformer extends TransformerAbstract
{
public function transform(Multimedia $multimedia)
{
$media = Str::replaceFirst('public/', '', $multimedia->media);
return [
'id' => $multimedia->id,
'title' => $multimedia->title,
'media' => url($media),
];
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\News;
use League\Fractal\TransformerAbstract;
class NewsTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(News $news)
{
return [
'id' => $news->id,
'title' => $news->getTranslations('title', [$this->locale])[$this->locale] ?? '-',
'short_description' => $news->getTranslations('short_description', [$this->locale])[$this->locale] ?? '-',
'description' => $news->getTranslations('description', [$this->locale])[$this->locale] ?? '-',
'date' => $news->date,
'image' => url($news->image),
];
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Page;
use League\Fractal\TransformerAbstract;
class PageTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(Page $page)
{
return [
'id' => $page->id,
'title' => $page->title,
'content' => html_entity_decode($page->getTranslations('content', [$this->locale])[$this->locale]) ?? '-',
];
}
}

View File

@ -1,26 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Tarif;
use League\Fractal\TransformerAbstract;
class TarifTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(Tarif $tarif)
{
return [
'id' => $tarif->id,
'type' => $tarif->type,
'title' => $tarif->getTranslations('title', [$this->locale])[$this->locale] ?? '-',
'prices' => $tarif->getTranslations('prices', [$this->locale])[$this->locale] ?? [],
];
}
}

View File

@ -1,36 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Trading;
use League\Fractal\TransformerAbstract;
class TradingTransformer extends TransformerAbstract
{
private $type;
public function __construct($type = '')
{
$this->type = $type;
}
public function transform(Trading $trading)
{
return $this->type == 'selected' ? [
'id' => $trading->id,
'title' => $trading->title,
'price' => $trading->price,
'old_price' => $trading->old_price,
'price_change' => $trading->price_change,
'currency' => $trading->currency,
'all_prices' => $trading->all_prices,
] : [
'id' => $trading->id,
'title' => $trading->title,
'price' => $trading->price,
'old_price' => $trading->old_price,
'price_change' => $trading->price_change,
'currency' => $trading->currency,
];
}
}

View File

@ -1,29 +0,0 @@
<?php
namespace App\Transformers;
use App\Models\Video;
use Illuminate\Support\Str;
use League\Fractal\TransformerAbstract;
class VideoTransformer extends TransformerAbstract
{
private $locale;
public function __construct($locale)
{
$this->locale = $locale;
}
public function transform(Video $video)
{
$translatedFile = $video->getTranslations('video',[$this->locale]);
$file = $translatedFile ? url(Str::replaceFirst('public/', '', $translatedFile[$this->locale])) : '-';
return [
'id' => $video->id,
'title' => $video->title,
'image' => url($video->image),
'video' => $file,
];
}
}

View File

@ -1,45 +1,4 @@
<?php return array (
'backpack/crud' =>
array (
'providers' =>
array (
0 => 'Backpack\\CRUD\\BackpackServiceProvider',
),
'aliases' =>
array (
'CRUD' => 'Backpack\\CRUD\\app\\Library\\CrudPanel\\CrudPanelFacade',
'Widget' => 'Backpack\\CRUD\\app\\Library\\Widget',
),
),
'backpack/generators' =>
array (
'providers' =>
array (
0 => 'Backpack\\Generators\\GeneratorsServiceProvider',
),
),
'creativeorange/gravatar' =>
array (
'providers' =>
array (
0 => 'Creativeorange\\Gravatar\\GravatarServiceProvider',
),
'aliases' =>
array (
'Gravatar' => 'Creativeorange\\Gravatar\\Facades\\Gravatar',
),
),
'digitallyhappy/assets' =>
array (
'providers' =>
array (
0 => 'DigitallyHappy\\Assets\\AssetsServiceProvider',
),
'aliases' =>
array (
'Assets' => 'DigitallyHappy\\Assets\\Facades\\Assets',
),
),
'facade/ignition' =>
array (
'providers' =>
@ -72,17 +31,6 @@
0 => 'Inertia\\ServiceProvider',
),
),
'intervention/image' =>
array (
'providers' =>
array (
0 => 'Intervention\\Image\\ImageServiceProvider',
),
'aliases' =>
array (
'Image' => 'Intervention\\Image\\Facades\\Image',
),
),
'jenssegers/agent' =>
array (
'providers' =>
@ -161,17 +109,6 @@
0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
),
),
'prologue/alerts' =>
array (
'providers' =>
array (
0 => 'Prologue\\Alerts\\AlertsServiceProvider',
),
'aliases' =>
array (
'Alert' => 'Prologue\\Alerts\\Facades\\Alert',
),
),
'spatie/laravel-translatable' =>
array (
'providers' =>

View File

@ -23,36 +23,30 @@
19 => 'Illuminate\\Translation\\TranslationServiceProvider',
20 => 'Illuminate\\Validation\\ValidationServiceProvider',
21 => 'Illuminate\\View\\ViewServiceProvider',
22 => 'Backpack\\CRUD\\BackpackServiceProvider',
23 => 'Backpack\\Generators\\GeneratorsServiceProvider',
24 => 'Creativeorange\\Gravatar\\GravatarServiceProvider',
25 => 'DigitallyHappy\\Assets\\AssetsServiceProvider',
26 => 'Facade\\Ignition\\IgnitionServiceProvider',
27 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
28 => 'Fruitcake\\Cors\\CorsServiceProvider',
29 => 'Inertia\\ServiceProvider',
30 => 'Intervention\\Image\\ImageServiceProvider',
31 => 'Jenssegers\\Agent\\AgentServiceProvider',
32 => 'Laravel\\Fortify\\FortifyServiceProvider',
33 => 'Laravel\\Jetstream\\JetstreamServiceProvider',
34 => 'Laravel\\Sail\\SailServiceProvider',
35 => 'Laravel\\Sanctum\\SanctumServiceProvider',
36 => 'Laravel\\Scout\\ScoutServiceProvider',
37 => 'Laravel\\Tinker\\TinkerServiceProvider',
38 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
39 => 'Carbon\\Laravel\\ServiceProvider',
40 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
41 => 'Prologue\\Alerts\\AlertsServiceProvider',
42 => 'Spatie\\Translatable\\TranslatableServiceProvider',
43 => 'Tightenco\\Ziggy\\ZiggyServiceProvider',
44 => 'TimeHunter\\LaravelGoogleReCaptchaV3\\Providers\\GoogleReCaptchaV3ServiceProvider',
45 => 'Vinkla\\Hashids\\HashidsServiceProvider',
46 => 'App\\Providers\\AppServiceProvider',
47 => 'App\\Providers\\AuthServiceProvider',
48 => 'App\\Providers\\EventServiceProvider',
49 => 'App\\Providers\\RouteServiceProvider',
50 => 'App\\Providers\\FortifyServiceProvider',
51 => 'App\\Providers\\JetstreamServiceProvider',
22 => 'Facade\\Ignition\\IgnitionServiceProvider',
23 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
24 => 'Fruitcake\\Cors\\CorsServiceProvider',
25 => 'Inertia\\ServiceProvider',
26 => 'Jenssegers\\Agent\\AgentServiceProvider',
27 => 'Laravel\\Fortify\\FortifyServiceProvider',
28 => 'Laravel\\Jetstream\\JetstreamServiceProvider',
29 => 'Laravel\\Sail\\SailServiceProvider',
30 => 'Laravel\\Sanctum\\SanctumServiceProvider',
31 => 'Laravel\\Scout\\ScoutServiceProvider',
32 => 'Laravel\\Tinker\\TinkerServiceProvider',
33 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
34 => 'Carbon\\Laravel\\ServiceProvider',
35 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
36 => 'Spatie\\Translatable\\TranslatableServiceProvider',
37 => 'Tightenco\\Ziggy\\ZiggyServiceProvider',
38 => 'TimeHunter\\LaravelGoogleReCaptchaV3\\Providers\\GoogleReCaptchaV3ServiceProvider',
39 => 'Vinkla\\Hashids\\HashidsServiceProvider',
40 => 'App\\Providers\\AppServiceProvider',
41 => 'App\\Providers\\AuthServiceProvider',
42 => 'App\\Providers\\EventServiceProvider',
43 => 'App\\Providers\\RouteServiceProvider',
44 => 'App\\Providers\\FortifyServiceProvider',
45 => 'App\\Providers\\JetstreamServiceProvider',
),
'eager' =>
array (
@ -66,34 +60,28 @@
7 => 'Illuminate\\Pagination\\PaginationServiceProvider',
8 => 'Illuminate\\Session\\SessionServiceProvider',
9 => 'Illuminate\\View\\ViewServiceProvider',
10 => 'Backpack\\CRUD\\BackpackServiceProvider',
11 => 'Backpack\\Generators\\GeneratorsServiceProvider',
12 => 'Creativeorange\\Gravatar\\GravatarServiceProvider',
13 => 'DigitallyHappy\\Assets\\AssetsServiceProvider',
14 => 'Facade\\Ignition\\IgnitionServiceProvider',
15 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
16 => 'Fruitcake\\Cors\\CorsServiceProvider',
17 => 'Inertia\\ServiceProvider',
18 => 'Intervention\\Image\\ImageServiceProvider',
19 => 'Jenssegers\\Agent\\AgentServiceProvider',
20 => 'Laravel\\Fortify\\FortifyServiceProvider',
21 => 'Laravel\\Jetstream\\JetstreamServiceProvider',
22 => 'Laravel\\Sanctum\\SanctumServiceProvider',
23 => 'Laravel\\Scout\\ScoutServiceProvider',
24 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
25 => 'Carbon\\Laravel\\ServiceProvider',
26 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
27 => 'Prologue\\Alerts\\AlertsServiceProvider',
28 => 'Spatie\\Translatable\\TranslatableServiceProvider',
29 => 'Tightenco\\Ziggy\\ZiggyServiceProvider',
30 => 'TimeHunter\\LaravelGoogleReCaptchaV3\\Providers\\GoogleReCaptchaV3ServiceProvider',
31 => 'Vinkla\\Hashids\\HashidsServiceProvider',
32 => 'App\\Providers\\AppServiceProvider',
33 => 'App\\Providers\\AuthServiceProvider',
34 => 'App\\Providers\\EventServiceProvider',
35 => 'App\\Providers\\RouteServiceProvider',
36 => 'App\\Providers\\FortifyServiceProvider',
37 => 'App\\Providers\\JetstreamServiceProvider',
10 => 'Facade\\Ignition\\IgnitionServiceProvider',
11 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
12 => 'Fruitcake\\Cors\\CorsServiceProvider',
13 => 'Inertia\\ServiceProvider',
14 => 'Jenssegers\\Agent\\AgentServiceProvider',
15 => 'Laravel\\Fortify\\FortifyServiceProvider',
16 => 'Laravel\\Jetstream\\JetstreamServiceProvider',
17 => 'Laravel\\Sanctum\\SanctumServiceProvider',
18 => 'Laravel\\Scout\\ScoutServiceProvider',
19 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
20 => 'Carbon\\Laravel\\ServiceProvider',
21 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
22 => 'Spatie\\Translatable\\TranslatableServiceProvider',
23 => 'Tightenco\\Ziggy\\ZiggyServiceProvider',
24 => 'TimeHunter\\LaravelGoogleReCaptchaV3\\Providers\\GoogleReCaptchaV3ServiceProvider',
25 => 'Vinkla\\Hashids\\HashidsServiceProvider',
26 => 'App\\Providers\\AppServiceProvider',
27 => 'App\\Providers\\AuthServiceProvider',
28 => 'App\\Providers\\EventServiceProvider',
29 => 'App\\Providers\\RouteServiceProvider',
30 => 'App\\Providers\\FortifyServiceProvider',
31 => 'App\\Providers\\JetstreamServiceProvider',
),
'deferred' =>
array (
@ -116,7 +104,6 @@
'command.config.cache' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.config.clear' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DbCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.db.prune' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.db.wipe' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.down' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.environment' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
@ -132,9 +119,7 @@
'command.queue.flush' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.forget' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.listen' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.monitor' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.prune-batches' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.prune-failed-jobs' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.restart' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.retry' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.queue.retry-batch' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
@ -147,7 +132,6 @@
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',
'command.storage.link' => 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider',

Some files were not shown because too many files have changed in this diff Show More