minor fixes
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Datatables\Admin\Core\Mail;
|
||||
|
||||
use App\Datatables\ParentDataTable as DataTable;
|
||||
use App\Models\Core\Mail\MailLog;
|
||||
use App\Repositories\Core\Mail\MailParser;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
|
||||
class MailLogsDataTable extends DataTable
|
||||
{
|
||||
public $model_name = 'mail_logs';
|
||||
|
||||
public $sortedColumn = 0;
|
||||
|
||||
public $sortedOrder = 'desc';
|
||||
|
||||
public $stateSave = true;
|
||||
|
||||
public function query(MailLog $model)
|
||||
{
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function modifier($datatables)
|
||||
{
|
||||
$datatables
|
||||
->editColumn('sent_to', function (MailLog $log) {
|
||||
return MailParser::getToEmail($log->event);
|
||||
})
|
||||
->editColumn('subject', function (MailLog $log) {
|
||||
return MailParser::getSubject($log->event);
|
||||
})
|
||||
->rawColumns(['action']);
|
||||
|
||||
return parent::modifier($datatables);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
return self::getButtonShow();
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('created_at')->title(__('sent')),
|
||||
Column::make('sent_to')->title(__('user')),
|
||||
Column::make('subject')->title(__('subject')),
|
||||
$this->makeColumnButtons()->width('60'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -22,22 +22,6 @@ class MailTemplatesDataTable extends DataTable
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
public function getHtmlButtons()
|
||||
{
|
||||
$buttons = '';
|
||||
if (Users::hasPermission('mail_templates_view')) {
|
||||
$buttons .= self::getButtonShow();
|
||||
}
|
||||
if (Users::hasPermission('mail_templates_update')) {
|
||||
$buttons .= self::getButtonEdit();
|
||||
}
|
||||
if (Users::hasPermission('mail_templates_delete')) {
|
||||
$buttons .= self::getButtonDel();
|
||||
}
|
||||
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core\Mail;
|
||||
|
||||
use App\Datatables\Admin\Core\Mail\MailLogsDataTable;
|
||||
use App\Repositories\Core\Mail\MailLogs;
|
||||
|
||||
class MailLogController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// $this->middleware('ability:admin');
|
||||
}
|
||||
|
||||
public function index(MailLogsDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('admin.Core.Mail.MailLog.index', $data ?? []);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['message'] = MailLogs::getParsed($id);
|
||||
|
||||
return view('admin.Core.Mail.MailLog.modal', $data);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Shop;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Shop\Dashboards;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data = Dashboards::getStats($data);
|
||||
dump($data);
|
||||
|
||||
return view('Admin.Shop.Dashboard.index', $data);
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,6 @@ class PackageController extends Controller
|
||||
return $dataTable->render('Admin.Shop.Packages.list', $data);
|
||||
}
|
||||
|
||||
public function getOptionsByFamily(Request $request)
|
||||
{
|
||||
$id = $request->input('family_id');
|
||||
|
||||
return response()->json(Packages::getSelectByFamily($id));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$data = Packages::init();
|
||||
|
||||
@@ -66,9 +66,4 @@ class ProducerController extends Controller
|
||||
|
||||
return Producers::deleteImage($id, $index);
|
||||
}
|
||||
|
||||
public function exportExcel()
|
||||
{
|
||||
return Producers::exportExcel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ class UnityController extends Controller
|
||||
{
|
||||
public function index(UnitiesDataTable $dataTable)
|
||||
{
|
||||
return $dataTable->render('Admin.Shop.Unities.list', $data ?? []);
|
||||
return $dataTable->render('Admin.Shop.Unities.list');
|
||||
}
|
||||
|
||||
public function getOptionsByPackage(Request $request)
|
||||
public function getOptionsByPackage($id)
|
||||
{
|
||||
return response()->json(Unities::getOptionsByPackage($id));
|
||||
}
|
||||
@@ -31,13 +31,6 @@ class UnityController extends Controller
|
||||
return redirect()->route('Admin.Shop.Unities.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data = Unities::get($id);
|
||||
|
||||
return view('Admin.Shop.Unities.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = [
|
||||
|
||||
@@ -87,7 +87,7 @@ class BasketController extends Controller
|
||||
ShopCart::clear();
|
||||
$data = $request->all();
|
||||
unset($data['_token']);
|
||||
$data['user_id'] = Users::getId();
|
||||
$data['user_id'] = Customers::getId();
|
||||
Orders::saveOrder($data);
|
||||
|
||||
return response()->json(['code' => '200']);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use MadWeb\Initializer\Contracts\Runner;
|
||||
|
||||
class Install
|
||||
{
|
||||
public function production(Runner $run)
|
||||
{
|
||||
$run->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
->artisan('key:generate', ['--force' => true])
|
||||
->artisan('migrate', ['--force' => true])
|
||||
->artisan('storage:link')
|
||||
// ->dispatch(new MakeCronTask)
|
||||
->external('npm', 'install', '--production')
|
||||
->external('npm', 'run', 'production')
|
||||
->artisan('route:cache')
|
||||
->artisan('config:cache')
|
||||
->artisan('event:cache');
|
||||
}
|
||||
|
||||
public function local(Runner $run)
|
||||
{
|
||||
$run->external('composer', 'install')
|
||||
->artisan('key:generate')
|
||||
->artisan('migrate')
|
||||
->artisan('storage:link')
|
||||
->external('npm', 'install')
|
||||
->external('npm', 'run', 'development');
|
||||
}
|
||||
}
|
||||
24
app/Models/Core/CartStorage.php
Normal file
24
app/Models/Core/CartStorage.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Core;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CartStorage extends Model
|
||||
{
|
||||
protected $table = 'cart_storage';
|
||||
|
||||
protected $fillable = [
|
||||
'id', 'cart_data',
|
||||
];
|
||||
|
||||
public function setCartDataAttribute($value)
|
||||
{
|
||||
$this->attributes['cart_data'] = serialize($value);
|
||||
}
|
||||
|
||||
public function getCartDataAttribute($value)
|
||||
{
|
||||
return unserialize($value);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Models\City;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Cities
|
||||
{
|
||||
public static function getCitiesByName($query)
|
||||
{
|
||||
return City::select('id', DB::raw("concat(nom,' (',code_postal,')') as text"))
|
||||
->where('nom', 'LIKE', "{$query}%")
|
||||
->orderBy('nom', 'ASC')->take(30)->get();
|
||||
}
|
||||
|
||||
public static function getCitiesByCP($query)
|
||||
{
|
||||
return City::select('id', DB::raw("concat(nom,' (',code_postal,')') as text"))
|
||||
->where('code_postal', 'LIKE', "%{$query}%")
|
||||
->orderBy('nom', 'ASC')->take(30)->get();
|
||||
}
|
||||
|
||||
public static function getCPByCity($id)
|
||||
{
|
||||
$ville = self::get($id);
|
||||
|
||||
return explode('-', $ville->code_postal);
|
||||
}
|
||||
|
||||
public static function getNomByCity($id)
|
||||
{
|
||||
$ville = self::get($id);
|
||||
|
||||
return $ville->nom;
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return City::find($id);
|
||||
}
|
||||
|
||||
public static function getCoords($adresse)
|
||||
{
|
||||
$geocode = app('geocoder')->geocode($adresse)->get();
|
||||
if (! count($geocode)) {
|
||||
return false;
|
||||
}
|
||||
$res = $geocode[0]->getCoordinates()->toArray();
|
||||
$latitude = $res[0];
|
||||
$longitude = $res[1];
|
||||
|
||||
return ['latitude' => $latitude, 'longitude' => $longitude];
|
||||
}
|
||||
|
||||
public static function getCoordsByCity($id)
|
||||
{
|
||||
$ville = City::find($id);
|
||||
|
||||
return ['latitude' => $ville->latitude, 'longitude' => $ville->longitude];
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Auth;
|
||||
|
||||
use App\Models\Core\Auth\PasswordSecurity;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class PasswordSecurities
|
||||
{
|
||||
public static function create($user_id, $delay = 90)
|
||||
{
|
||||
return PasswordSecurity::create([
|
||||
'user_id' => $user_id,
|
||||
'password_expiry_days' => $delay,
|
||||
'password_updated_at' => Carbon::now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getUserName($id)
|
||||
{
|
||||
return self::getUser($id)->username;
|
||||
}
|
||||
|
||||
public static function getUser($id)
|
||||
{
|
||||
return PasswordSecurity::with('user')->find($id)->user;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Auth;
|
||||
|
||||
class Passwords
|
||||
{
|
||||
public static function validator()
|
||||
{
|
||||
$validator = new \Password\Validator(new \Password\StringHelper());
|
||||
$validator->setMinLength(5);
|
||||
$validator->setMinLowerCaseLetters(2);
|
||||
$validator->setMinUpperCaseLetters(1);
|
||||
$validator->setMinNumbers(1);
|
||||
$validator->setMinSymbols(3);
|
||||
|
||||
if ($validator->isValid($password)) {
|
||||
printf('password %s is valid'.PHP_EOL, $password);
|
||||
} else {
|
||||
printf('password %s is invalid'.PHP_EOL, $password);
|
||||
var_dump($validator->getErrors());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Auth;
|
||||
|
||||
use App\Models\Core\Auth\Permission;
|
||||
use App\Traits\Model\Basic;
|
||||
|
||||
class Permissions
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function getModules()
|
||||
{
|
||||
return Permission::select('module')->distinct('module')->get()->pluck('module');
|
||||
}
|
||||
|
||||
public static function getByName($name)
|
||||
{
|
||||
return Permission::where('name', $name)->first();
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return Permission::query();
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Auth;
|
||||
|
||||
use App\Models\Core\Auth\Role;
|
||||
use App\Models\Core\Auth\RoleUser;
|
||||
use App\Traits\Model\Basic;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
|
||||
class Roles
|
||||
{
|
||||
use Basic, LaratrustUserTrait;
|
||||
|
||||
public static function getListByRights()
|
||||
{
|
||||
$data = ! Auth::user()->hasRole('admin') ? Role::whereNotIn('name', ['admin'])->get() : Role::all();
|
||||
|
||||
return $data->pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
$permissions = array_keys($data['permissions']);
|
||||
unset($data['permissions']);
|
||||
$data['active'] = true;
|
||||
$role = Role::create($data);
|
||||
$role->attachPermissions($permissions);
|
||||
|
||||
return $role;
|
||||
}
|
||||
|
||||
public static function update($input, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $input['id'];
|
||||
$permissions = array_keys($input['permissions']);
|
||||
$role = self::get($id);
|
||||
$role->update(['name' => $input['name']]);
|
||||
$role->syncPermissions($permissions);
|
||||
|
||||
return $role;
|
||||
}
|
||||
|
||||
public static function toggleActive($id, $active)
|
||||
{
|
||||
return Role::find($id)->update(['active' => $active]);
|
||||
}
|
||||
|
||||
public static function getWithPermissions($id)
|
||||
{
|
||||
$role = self::get($id)->toArray();
|
||||
$role['permissions'] = self::get($id)->permissions->pluck('id')->toArray();
|
||||
|
||||
return $role;
|
||||
}
|
||||
|
||||
public static function getByName($name)
|
||||
{
|
||||
return Role::where('name', $name)->first();
|
||||
}
|
||||
|
||||
public static function getRolesByUser($user_id = false)
|
||||
{
|
||||
$user_id = $user_id ? $user_id : Users::getId();
|
||||
|
||||
return RoleUser::byUser($user_id);
|
||||
}
|
||||
|
||||
public static function getUsersByRole($id)
|
||||
{
|
||||
return RoleUser::byTeam($id)->get();
|
||||
}
|
||||
|
||||
public static function getUsersIdByRole($id)
|
||||
{
|
||||
return self::getUsersByRole($id)->pluck('user_id');
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return RoleUser::query();
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Auth;
|
||||
|
||||
use App\Models\Core\Auth\Team;
|
||||
use App\Models\Core\Auth\TeamUser;
|
||||
use App\Repositories\Users;
|
||||
use App\Traits\Model\Basic;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
|
||||
class Teams
|
||||
{
|
||||
use Basic, LaratrustUserTrait;
|
||||
|
||||
public static function getTeamsByUser($user_id = false)
|
||||
{
|
||||
$user_id = $user_id ? $user_id : Users::getId();
|
||||
|
||||
return TeamUser::byUser($user_id);
|
||||
}
|
||||
|
||||
public static function getUsersByTeam($id)
|
||||
{
|
||||
return TeamUser::byTeam($id)->get();
|
||||
}
|
||||
|
||||
public static function getUsersIdByTeam($id)
|
||||
{
|
||||
return self::getUsersByTeam($id)->pluck('user_id');
|
||||
}
|
||||
|
||||
public static function getUsersByTeam2($id)
|
||||
{
|
||||
return Team::find($id)->users();
|
||||
}
|
||||
|
||||
public static function getByName($name)
|
||||
{
|
||||
return Team::where('name', $name)->first();
|
||||
}
|
||||
|
||||
public static function delete($id)
|
||||
{
|
||||
Users::destroyByUniqueTeam($id);
|
||||
|
||||
return Team::destroy($id);
|
||||
}
|
||||
|
||||
public static function destroyBySociete($id)
|
||||
{
|
||||
$teams = Team::bySociete($id)->get();
|
||||
foreach ($teams as $team) {
|
||||
self::delete($team->id);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return Team::query();
|
||||
}
|
||||
}
|
||||
@@ -9,57 +9,12 @@ use App\Traits\Model\Basic;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
use LangleyFoxall\LaravelNISTPasswordRules\PasswordRules;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
|
||||
class Users
|
||||
{
|
||||
use Basic, LaratrustUserTrait;
|
||||
|
||||
public static function isAdmin()
|
||||
{
|
||||
return self::hasRole('admin');
|
||||
}
|
||||
|
||||
public static function getInfo($id = false)
|
||||
{
|
||||
$id = $id ? $id : self::getId();
|
||||
if (! $id) {
|
||||
return false;
|
||||
}
|
||||
$user = self::get($id);
|
||||
$data = $user->toArray();
|
||||
$data['name'] = $user->name;
|
||||
$data['avatar'] = self::getAvatar($id);
|
||||
$data['roles'] = $user->roles->pluck('id')->toArray();
|
||||
$data['permissions'] = $user->allPermissions()->pluck('id')->toArray();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
if ($data['id'] ?? false) {
|
||||
unset($data['password']);
|
||||
}
|
||||
$user = $data['id'] ?? false ? self::update($data) : self::create($data);
|
||||
$user->roles()->sync(array_keys($data['roles'] ?? []));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
$data['password'] = $data['password'] ?? Hash::make($data['password']);
|
||||
$data['remember_token'] = Str::random(32);
|
||||
$data['active'] = true;
|
||||
$user = User::create($data);
|
||||
PasswordSecurities::create($user->id);
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public static function getId()
|
||||
{
|
||||
$user = self::getUser();
|
||||
@@ -94,98 +49,6 @@ class Users
|
||||
return User::orderBy('name')->pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function delete($id)
|
||||
{
|
||||
$ret = RoleUser::byUser($id)->delete();
|
||||
|
||||
return User::destroy($id);
|
||||
}
|
||||
|
||||
public static function getListByRole($role)
|
||||
{
|
||||
return self::selectOptions()->orderBy('name')->whereRoleIs($role)->get();
|
||||
}
|
||||
|
||||
public static function hasRole($role, $user = false)
|
||||
{
|
||||
$user = $user ? $user : self::getUser();
|
||||
|
||||
return $user ? $user->hasRole($role) : false;
|
||||
}
|
||||
|
||||
public static function hasPermission($permission, $user = false)
|
||||
{
|
||||
if (self::isAdmin()) {
|
||||
return true;
|
||||
}
|
||||
$user = $user ? $user : self::getUser();
|
||||
$permissions = self::getPermissions($user);
|
||||
|
||||
return $user ? self::checkPermission($permissions, $permission) : false;
|
||||
// TODO why is posing problem ???
|
||||
// return $user ? $user->hasPermission($permission) : false;
|
||||
}
|
||||
|
||||
public static function checkPermission($permissions, $permission)
|
||||
{
|
||||
if (! strpos($permission, '*')) {
|
||||
return in_array($permission, $permissions);
|
||||
}
|
||||
$permission = str_replace('*', '', $permission);
|
||||
foreach ($permissions as $item) {
|
||||
if (stripos($item, $permission) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getRoles($user = false)
|
||||
{
|
||||
$user = $user ? $user : self::getUser();
|
||||
|
||||
return $user ? $user->roles->pluck('name')->toArray() : false;
|
||||
}
|
||||
|
||||
public static function getRolesToEdit()
|
||||
{
|
||||
return Roles::getListByRights();
|
||||
}
|
||||
|
||||
public static function getPermissions($user = false)
|
||||
{
|
||||
$user = $user ? $user : self::getUser();
|
||||
|
||||
return $user ? $user->allPermissions()->pluck('name')->toArray() : false;
|
||||
}
|
||||
|
||||
public static function getByTeam($id)
|
||||
{
|
||||
return User::byTeam($id)->get();
|
||||
}
|
||||
|
||||
public static function getByUniqueTeam($id)
|
||||
{
|
||||
return User::byTeam($id)->byUniqueTeam()->get();
|
||||
}
|
||||
|
||||
public static function destroyByUniqueTeam($id)
|
||||
{
|
||||
return User::byTeam($id)->byUniqueTeam()->delete();
|
||||
}
|
||||
|
||||
public static function getAvatar($user_id)
|
||||
{
|
||||
$avatar = self::get($user_id)->avatar;
|
||||
if (! $avatar) {
|
||||
return '/assets/img/no-avatar.png';
|
||||
}
|
||||
$path = '/images/avatars/';
|
||||
|
||||
return $path.$avatar;
|
||||
}
|
||||
|
||||
public static function selectOptions()
|
||||
{
|
||||
return User::select('id', DB::raw("concat(last_name,' ',first_name) as name"));
|
||||
@@ -201,24 +64,6 @@ class Users
|
||||
return self::get($id)->update(['active' => $active]);
|
||||
}
|
||||
|
||||
public static function uploadAvatar($request)
|
||||
{
|
||||
$targetDir = 'uploads';
|
||||
$file = $request->file('avatar_file');
|
||||
$data = Upload::getData($file);
|
||||
$file_uploaded = Upload::store($file, $targetDir);
|
||||
$tab = pathinfo($file_uploaded);
|
||||
|
||||
return [
|
||||
'name' => $tab['basename'],
|
||||
];
|
||||
}
|
||||
|
||||
public static function updateAvatar($id, $avatar)
|
||||
{
|
||||
return User::find($id)->update(['avatar' => $avatar]);
|
||||
}
|
||||
|
||||
public static function updatePassword($id, $password)
|
||||
{
|
||||
$password = Hash::make($password);
|
||||
@@ -226,11 +71,6 @@ class Users
|
||||
return User::find($id)->update(['password' => $password]);
|
||||
}
|
||||
|
||||
public static function validate($username, $field = 'current_password')
|
||||
{
|
||||
return PasswordRules::changePassword($username, $field);
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return User::query();
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use Collective\Html\Eloquent\Form;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class Database
|
||||
{
|
||||
public static function getForm($model)
|
||||
{
|
||||
$form = '';
|
||||
$data = self::getTableFields($model);
|
||||
foreach ($data as $item) {
|
||||
switch ($item['type']) {
|
||||
case 'integer':
|
||||
$form .= Form::number($item['name']);
|
||||
break;
|
||||
case 'string':
|
||||
$form .= Form::number($item['name']);
|
||||
break;
|
||||
case 'date':
|
||||
$form .= Form::date($item['name']);
|
||||
break;
|
||||
case 'boolean':
|
||||
$form .= Form::checkbox($item['name']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
public static function getTableFields($model)
|
||||
{
|
||||
$table = new $model();
|
||||
$data = [];
|
||||
// get the column names for the table
|
||||
$columns = Schema::getColumnListing($table->getTable());
|
||||
foreach ($columns as &$column) {
|
||||
$type = Schema::getColumnType($table->getTable(), $column);
|
||||
array_push($data, ['name' => $column, 'type' => $type]);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getPopulate($model, $route, $id)
|
||||
{
|
||||
echo Form::model($model, ['route' => [$route.'.update', $id]]);
|
||||
}
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
class Export
|
||||
{
|
||||
public $xls;
|
||||
|
||||
public $sheet;
|
||||
|
||||
public $filename;
|
||||
|
||||
public $stockage;
|
||||
|
||||
public $lig;
|
||||
|
||||
public $nb;
|
||||
|
||||
public $debug;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_time_limit(0);
|
||||
ini_set('memory_limit', '1G');
|
||||
$this->xls = new PHPExcel();
|
||||
}
|
||||
|
||||
public function create($filename, $stockage = false)
|
||||
{
|
||||
$this->sheet = $this->xls->setActiveSheetIndex(0);
|
||||
$this->filename = $filename;
|
||||
$this->stockage = $stockage;
|
||||
$this->lig = 1;
|
||||
}
|
||||
|
||||
public function setColumnsTitle($data)
|
||||
{
|
||||
$col = 0;
|
||||
foreach ($data as $value) {
|
||||
$this->writeTitle($this->lig, $col, $value);
|
||||
$col++;
|
||||
}
|
||||
$this->lig++;
|
||||
}
|
||||
|
||||
public function writeTitle($lig, $col, $txt)
|
||||
{
|
||||
$coord = $this->conv($lig, $col);
|
||||
$style = $this->sheet->getStyle($coord);
|
||||
$styleFont = $style->getFont();
|
||||
$styleFont->setBold(true);
|
||||
$styleFont->setSize(12);
|
||||
$styleFont->setName('Arial');
|
||||
$this->sheet->setCellValue($coord, $txt);
|
||||
}
|
||||
|
||||
public function writeCell($lig, $col, $txt)
|
||||
{
|
||||
$coord = $this->conv($lig, $col);
|
||||
$this->sheet->setCellValue($coord, $txt);
|
||||
}
|
||||
|
||||
public function exportRow($data, $config = null)
|
||||
{
|
||||
if ($config) {
|
||||
$vars = $config['vars'];
|
||||
$options = $config['options'];
|
||||
$multioptions = $config['multioptions'];
|
||||
}
|
||||
$col = 0;
|
||||
if (is_array($vars)) {
|
||||
foreach ($vars as $key) {
|
||||
$txt = $data[$key];
|
||||
if (isset($options[$key])) {
|
||||
$txt = $options[$key][$txt];
|
||||
}
|
||||
if (! isset($multioptions[$key])) {
|
||||
$this->writeCell($this->lig, $col, $txt);
|
||||
$this->nb++;
|
||||
$col++;
|
||||
|
||||
continue;
|
||||
}
|
||||
$tabs = self::getReverseMultiOptions($txt);
|
||||
foreach ($tabs as $key2 => $value) {
|
||||
$txt .= $multioptions[$key][$key2].'\n';
|
||||
}
|
||||
|
||||
$this->writeCell($this->lig, $col, $txt);
|
||||
$this->nb++;
|
||||
$col++;
|
||||
}
|
||||
} else {
|
||||
foreach ($data as $value) {
|
||||
$txt = $value;
|
||||
$this->writeCell($this->lig, $col, $txt);
|
||||
$this->nb++;
|
||||
$col++;
|
||||
}
|
||||
}
|
||||
$this->lig++;
|
||||
}
|
||||
|
||||
public function header()
|
||||
{
|
||||
// Redirect output to a client’s web browser (Excel5)
|
||||
header('Content-Type: application/vnd.ms-excel');
|
||||
header('Content-Disposition: attachment;filename="'.$this->filename.'"');
|
||||
header('Cache-Control: max-age=0');
|
||||
// If you're serving to IE 9, then the following may be needed
|
||||
// header('Cache-Control: max-age=1');
|
||||
|
||||
// If you're serving to IE over SSL, then the following may be needed
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
|
||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
|
||||
header('Pragma: public'); // HTTP/1.0
|
||||
}
|
||||
|
||||
public function close()
|
||||
{
|
||||
if ($this->debug) {
|
||||
return;
|
||||
}
|
||||
$objWriter = PHPExcel_IOFactory::createWriter($this->xls, 'Excel2007');
|
||||
if (! $this->stockage) {
|
||||
$this->header();
|
||||
$objWriter->save('php://output');
|
||||
} else {
|
||||
$objWriter->save('text.xlsx');
|
||||
}
|
||||
}
|
||||
|
||||
public function conv($lig, $col)
|
||||
{
|
||||
$c = static::convColtoTxt($col);
|
||||
|
||||
return $c.$lig;
|
||||
}
|
||||
|
||||
public function convColtoTxt($col)
|
||||
{
|
||||
$col1 = $col % 26;
|
||||
$col2 = (int) floor($col / 26);
|
||||
if ($col2) {
|
||||
$c = chr(64 + $col2);
|
||||
} else {
|
||||
$c = '';
|
||||
}
|
||||
$c .= chr(65 + $col1);
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
public function getOption($var)
|
||||
{
|
||||
$data = $this->init();
|
||||
|
||||
return $data[$var.'_options'];
|
||||
}
|
||||
|
||||
public function getOptions($data)
|
||||
{
|
||||
$options = [];
|
||||
foreach ($data as $key => $value) {
|
||||
$var = substr($key, 0, -8);
|
||||
$options[$var] = $value;
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use App\Traits\Repository\Imageable;
|
||||
|
||||
class Images
|
||||
{
|
||||
use Imageable;
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Mail;
|
||||
|
||||
use App\Models\Core\Mail\MailLog;
|
||||
use App\Traits\Model\Basic;
|
||||
|
||||
class MailLogs
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public static function getSubject($id)
|
||||
{
|
||||
return MailParser::getSubject(self::get($id)->event);
|
||||
}
|
||||
|
||||
public static function getParsed($id)
|
||||
{
|
||||
return MailParser::getParsed(self::get($id)->event);
|
||||
}
|
||||
|
||||
public static function getModel()
|
||||
{
|
||||
return MailLog::query();
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\Mail;
|
||||
|
||||
use ZBateson\MailMimeParser\Header\HeaderConsts;
|
||||
use ZBateson\MailMimeParser\MailMimeParser;
|
||||
|
||||
class MailParser
|
||||
{
|
||||
public static function getParsed($mail)
|
||||
{
|
||||
$model = self::getModel($mail);
|
||||
|
||||
return [
|
||||
'from' => self::getFromByModel($model),
|
||||
'subject' => self::getSubjectByModel($model),
|
||||
'content' => self::getHtmlByModel($model),
|
||||
'to_name' => self::getToNameByModel($model),
|
||||
'to_email' => self::getToEmailByModel($model),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getSubject($mail)
|
||||
{
|
||||
return self::getSubjectByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getText($mail)
|
||||
{
|
||||
return self::getTextByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getHtml($mail)
|
||||
{
|
||||
return self::getHtmlByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getFrom($mail)
|
||||
{
|
||||
return self::getFromByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getToName($mail)
|
||||
{
|
||||
return self::getToNameByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getToEmail($mail)
|
||||
{
|
||||
return self::getToEmailByModel(self::getModel($mail));
|
||||
}
|
||||
|
||||
public static function getSubjectByModel($model)
|
||||
{
|
||||
return $model->getHeaderValue(HeaderConsts::SUBJECT);
|
||||
}
|
||||
|
||||
public static function getTextByModel($model)
|
||||
{
|
||||
return $model->getTextContent();
|
||||
}
|
||||
|
||||
public static function getFromByModel($model)
|
||||
{
|
||||
return $model->getHeader(HeaderConsts::FROM)->getPersonName();
|
||||
}
|
||||
|
||||
public static function getToNameByModel($model)
|
||||
{
|
||||
return $model->getHeader(HeaderConsts::TO)->getAddresses()[0]->getName();
|
||||
}
|
||||
|
||||
public static function getToEmailByModel($model)
|
||||
{
|
||||
return $model->getHeader(HeaderConsts::TO)->getAddresses()[0]->getEmail();
|
||||
}
|
||||
|
||||
public static function getHtmlByModel($model)
|
||||
{
|
||||
return $model->getHtmlContent();
|
||||
}
|
||||
|
||||
public static function getModel($mail)
|
||||
{
|
||||
$mailParser = new MailMimeParser();
|
||||
|
||||
return $mailParser->parse($mail, false);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use View;
|
||||
|
||||
class Menu extends LavaryMenu
|
||||
{
|
||||
public function make($name, $callback)
|
||||
public function make($name, $callback, $arr = [])
|
||||
{
|
||||
if (! is_callable($callback)) {
|
||||
return;
|
||||
|
||||
@@ -2,41 +2,66 @@
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use Barryvdh\Debugbar\Facades\Debugbar;
|
||||
use Barryvdh\DomPDF\Facade\Pdf as DomPDF;
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf;
|
||||
use GravityMedia\Ghostscript\Ghostscript;
|
||||
use Imagick;
|
||||
use Mpdf\Mpdf;
|
||||
use Spatie\PdfToText\Pdf as PDFToText;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class PDF
|
||||
{
|
||||
public function convertView($view, $data, $filename)
|
||||
{
|
||||
try {
|
||||
Browsershot::html(view($view, $data)->render())
|
||||
->noSandbox()
|
||||
->waitUntilNetworkIdle()
|
||||
->format('A4')
|
||||
->showBackground()
|
||||
->savePdf('temp.pdf');
|
||||
|
||||
$postRoute = URL::signedRoute('orderinvoices.store', ['order' => $this->order]);
|
||||
Http::attach('invoice', file_get_contents('temp.pdf'), $filename)
|
||||
->post($postRoute)
|
||||
->throw();
|
||||
} catch (\Exception $exception) {
|
||||
Log::error($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public static function view($view, $data, $filename = 'file.pdf')
|
||||
{
|
||||
\Debugbar::disable();
|
||||
Debugbar::disable();
|
||||
$pdf = DomPDF::loadView($view, $data);
|
||||
|
||||
return $pdf->download($filename);
|
||||
}
|
||||
|
||||
public static function countPages($filename)
|
||||
{
|
||||
$image = new Imagick();
|
||||
$image->pingImage($filename);
|
||||
|
||||
return $image->getNumberImages();
|
||||
|
||||
/*
|
||||
$pdftext = file_get_contents($filename);
|
||||
|
||||
return preg_match_all("/\/Page\W*(\d+)/", $pdftext, $dummy);
|
||||
*/
|
||||
}
|
||||
|
||||
public function getPDFPages($document)
|
||||
{
|
||||
$cmd = '/path/to/pdfinfo'; // Linux
|
||||
$cmd = 'C:\\path\\to\\pdfinfo.exe'; // Windows
|
||||
|
||||
// Parse entire output
|
||||
// Surround with double quotes if file name has spaces
|
||||
exec("$cmd \"$document\"", $output);
|
||||
|
||||
// Iterate through lines
|
||||
$pagecount = 0;
|
||||
foreach ($output as $op) {
|
||||
// Extract the number
|
||||
if (preg_match("/Pages:\s*(\d+)/i", $op, $matches) === 1) {
|
||||
$pagecount = intval($matches[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $pagecount;
|
||||
}
|
||||
|
||||
public static function getText($filename)
|
||||
{
|
||||
return PDFToText::getText($filename);
|
||||
}
|
||||
|
||||
public static function convertHTML($html)
|
||||
{
|
||||
$mpdf = new Mpdf();
|
||||
@@ -45,11 +70,11 @@ class PDF
|
||||
return $mpdf->Output();
|
||||
}
|
||||
|
||||
public static function convertURL($url)
|
||||
public static function convertURL($url, $filename = 'sample.pdf')
|
||||
{
|
||||
$pdf = SnappyPdf::loadFile($url);
|
||||
|
||||
return $pdf->download('invoice.pdf');
|
||||
return $pdf->download($filename);
|
||||
}
|
||||
|
||||
public static function convertIfNeeded($filename)
|
||||
@@ -62,13 +87,14 @@ class PDF
|
||||
public static function getVersion($filename)
|
||||
{
|
||||
$pdf = fopen($filename, 'r');
|
||||
if ($pdf) {
|
||||
$line_first = fgets($pdf);
|
||||
fclose($pdf);
|
||||
} else {
|
||||
if (! $pdf) {
|
||||
echo 'error opening the file.';
|
||||
|
||||
return false;
|
||||
}
|
||||
preg_match_all('!\d+!', $line_first, $matches);
|
||||
$lineFirst = fgets($pdf);
|
||||
fclose($pdf);
|
||||
preg_match_all('!\d+!', $lineFirst, $matches);
|
||||
$version = implode('.', $matches[0]);
|
||||
|
||||
return (float) $version;
|
||||
@@ -76,35 +102,31 @@ class PDF
|
||||
|
||||
public static function downgrade($filename)
|
||||
{
|
||||
$new_filename = $filename.'-temp';
|
||||
$newFilename = $filename.'-temp';
|
||||
$ghostscript = new Ghostscript([
|
||||
'quiet' => false,
|
||||
]);
|
||||
|
||||
$device = $ghostscript->createPdfDevice($new_filename);
|
||||
$device = $ghostscript->createPdfDevice($newFilename);
|
||||
$device->setCompatibilityLevel(1.4);
|
||||
|
||||
// dump($device);
|
||||
$process = $device->createProcess($filename);
|
||||
// dump($process);
|
||||
// echo '$ ' . $process->getCommandLine() . PHP_EOL;
|
||||
// exit;
|
||||
|
||||
$process->run(function ($type, $buffer) {
|
||||
if ($type === Process::ERR) {
|
||||
throw new \RuntimeException($buffer);
|
||||
}
|
||||
// print $buffer;
|
||||
});
|
||||
|
||||
unlink($filename);
|
||||
rename($new_filename, $filename);
|
||||
rename($newFilename, $filename);
|
||||
}
|
||||
|
||||
public static function downgrade2($filename)
|
||||
{
|
||||
$new_filename = $filename.'-temp';
|
||||
shell_exec('gs -dBATCH -dCompatibilityLevel=1.4 -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="'.$new_filename.'" "'.$filename.'"');
|
||||
$newFilename = $filename.'-temp';
|
||||
$options = '-dBATCH -dCompatibilityLevel=1.4 -dNOPAUSE -q -sDEVICE=pdfwrite';
|
||||
shell_exec("gs {$options} -sOutputFile=\"{$newFilename}\" \"{$filename}\"");
|
||||
unlink($filename);
|
||||
rename($new_filename, $filename);
|
||||
rename($newFilename, $filename);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Stat
|
||||
{
|
||||
public static $is_debug = false;
|
||||
|
||||
public static $force_output = true;
|
||||
|
||||
public static function getNewByPeriod($model, $start, $end)
|
||||
{
|
||||
return $model->whereBetween('created_at', [$start, $end])->count();
|
||||
}
|
||||
|
||||
public static function getTotalAtDate($model, $end)
|
||||
{
|
||||
return $model->where('created_at', '<', $end)->count();
|
||||
}
|
||||
|
||||
public static function renderStatsbyMultiVar($var, $var_option = '')
|
||||
{
|
||||
self::renderStatsJson(self::getStatsbyMultiVar($var, $var_option));
|
||||
}
|
||||
|
||||
public static function renderStatsbyVar($var)
|
||||
{
|
||||
self::renderStatsJson(self::getStatsbyVar($var));
|
||||
}
|
||||
|
||||
public static function renderStatsbyOptions($var, $var_option = '')
|
||||
{
|
||||
self::renderStatsJson(self::getStatsbyOptions($var, $var_option));
|
||||
}
|
||||
|
||||
public static function renderStatsJson($data)
|
||||
{
|
||||
return json_encode($data, JSON_NUMERIC_CHECK);
|
||||
}
|
||||
|
||||
public static function getStatsbyMultiVar($var, $var_option = '')
|
||||
{
|
||||
if ($var_option) {
|
||||
$var_option = $var;
|
||||
}
|
||||
$options = self::getOption($var_option);
|
||||
|
||||
return self::getStatsbyMultiOptions($var, $options);
|
||||
}
|
||||
|
||||
public static function getCountByPeriod($var, $begin, $end)
|
||||
{
|
||||
return self::getModel()
|
||||
->whereBetween($var, $begin, $end)
|
||||
->count();
|
||||
}
|
||||
|
||||
public static function getCountbyVar($var)
|
||||
{
|
||||
$db = self::getInstance()->app->db;
|
||||
|
||||
return self::getModel()
|
||||
->select($db::raw("count(id) as y, {$var} as name"))
|
||||
->groupBy($var)
|
||||
->get();
|
||||
}
|
||||
|
||||
public static function getStatsbyOptions($var, $var_option = '')
|
||||
{
|
||||
if ($var_option ?? false) {
|
||||
$var_option = $var;
|
||||
}
|
||||
$options = self::getInstance()->controller->getOption($var_option);
|
||||
$nb = self::getCountbyOption($var);
|
||||
$data = [];
|
||||
foreach ($options as $key => $value) {
|
||||
$y = (int) $nb[$key];
|
||||
$data[] = ['y' => $y, 'name' => $value];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getCountbyOption($var)
|
||||
{
|
||||
$db = self::getInstance()->app->db;
|
||||
$data = self::getModel()
|
||||
->select($db::raw('count(id) as nb'))
|
||||
->groupBy($var)
|
||||
->get();
|
||||
foreach ($data as $key => $value) {
|
||||
if (is_array($data[$key])) {
|
||||
$data[$key] = (int) $data[$key]['nb'];
|
||||
} else {
|
||||
$data[$key] = (int) $data[$key]->nb;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getStatsbyMultiOptions($var, $options)
|
||||
{
|
||||
$data = [];
|
||||
foreach ($options as $key => $value) {
|
||||
$nb = self::getCountbyBin($var, $key);
|
||||
$data[] = ['y' => $nb, 'name' => $value];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getCountbyBin($var, $value)
|
||||
{
|
||||
$bit = pow(2, $value);
|
||||
|
||||
return self::getModel()->where($var, '&', $bit)->count();
|
||||
}
|
||||
|
||||
public static function getStatsbyPeriod($begin = '', $end = '', $period = 'days')
|
||||
{
|
||||
$end = Carbon::now();
|
||||
$begin = Carbon::now()->subMonth(1);
|
||||
switch ($period) {
|
||||
case 'days':
|
||||
$periods = DateRange::getPeriodsbyDay($begin, $end);
|
||||
break;
|
||||
case 'months':
|
||||
$periods = DateRange::getPeriodsbyMonth($begin, $end);
|
||||
break;
|
||||
case 'weeks':
|
||||
$periods = DateRange::getPeriodsbyWeek($begin, $end);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
return $periods;
|
||||
}
|
||||
|
||||
public static function serializeValues($tab)
|
||||
{
|
||||
return self::serializeByVar($tab, 'count');
|
||||
}
|
||||
|
||||
public static function serializeByVar($tab, $var, $n = 0)
|
||||
{
|
||||
$collection = collect($tab);
|
||||
|
||||
if ($n) {
|
||||
$tab = $collection->pluck($var)->slice(-$n)->toArray();
|
||||
} else {
|
||||
$tab = $collection->pluck($var)->toArray();
|
||||
}
|
||||
|
||||
return implode(',', $tab);
|
||||
}
|
||||
|
||||
public static function avgByVar($tab, $var)
|
||||
{
|
||||
return collect($tab)->pluck($var)->avg();
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,10 @@ class Trees
|
||||
return $tree;
|
||||
}
|
||||
|
||||
public static function moveTree($node_id, $target_id, $type)
|
||||
public static function moveTree($node_id, $target_id, $type, $model)
|
||||
{
|
||||
$item = self::getNode($node_id);
|
||||
$item_target = self::getNode($target_id);
|
||||
$item = self::getNode($node_id, $model);
|
||||
$item_target = self::getNode($target_id, $model);
|
||||
|
||||
switch ($type) {
|
||||
case 'after':
|
||||
@@ -49,7 +49,7 @@ class Trees
|
||||
|
||||
public static function create($data, $model)
|
||||
{
|
||||
$parent = $data['parent_id'] ?? false ? self::getNode($data['parent_id']) : self::getRoot();
|
||||
$parent = $data['parent_id'] ?? false ? self::getNode($data['parent_id'], $model) : self::getRoot($model);
|
||||
$tree = $model->create(['name' => $data['name']]);
|
||||
$tree->appendToNode($parent)->save();
|
||||
|
||||
@@ -69,9 +69,9 @@ class Trees
|
||||
// return Category::destroy($id);
|
||||
}
|
||||
|
||||
public static function getRoot()
|
||||
public static function getRoot($model)
|
||||
{
|
||||
return self::getNode(1);
|
||||
return self::getNode(1, $model);
|
||||
}
|
||||
|
||||
public static function getNode($id, $model)
|
||||
|
||||
@@ -10,24 +10,19 @@ class BasketStores
|
||||
{
|
||||
use Basic;
|
||||
|
||||
public function has($key)
|
||||
public static function has($key)
|
||||
{
|
||||
return Basket::find($key);
|
||||
}
|
||||
|
||||
public function get($key)
|
||||
public static function get($key)
|
||||
{
|
||||
if ($this->has($key)) {
|
||||
return new CartCollection(Basket::find($key)->cart_data);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
return self::has($key) ? new CartCollection(Basket::find($key)->cart_data) : [];
|
||||
}
|
||||
|
||||
public function put($key, $value)
|
||||
public static function put($key, $value)
|
||||
{
|
||||
if ($row = Basket::find($key)) {
|
||||
// update
|
||||
$row->cart_data = $value;
|
||||
$row->save();
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\InvoicePayment;
|
||||
use Bnb\PayboxGateway\Requests\Paybox\AuthorizationWithCapture;
|
||||
use Bnb\PayboxGateway\Requests\PayboxDirect\Capture;
|
||||
use Bnb\PayboxGateway\Responses\Exceptions\InvalidSignature;
|
||||
@@ -35,9 +36,9 @@ class Paybox
|
||||
}
|
||||
}
|
||||
|
||||
public static function getPreviousAuthorizedRequest()
|
||||
public static function getPreviousAuthorizedRequest($request)
|
||||
{
|
||||
$payment = Payment::where('number', $request->input('order_number'))->firstOrFail();
|
||||
$payment = InvoicePayment::where('number', $request->input('order_number'))->firstOrFail();
|
||||
$captureRequest = App::make(Capture::class);
|
||||
$response = $captureRequest->setAmount($payment->amount)
|
||||
->setPayboxCallNumber($payment->call_number)
|
||||
|
||||
@@ -15,7 +15,6 @@ class PriceListValues
|
||||
return [
|
||||
'unities' => Unities::getOptions(),
|
||||
'taxes_options' => Taxes::getOptions(),
|
||||
'categories' => PriceListValueCategories::getOptions(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Tariffs
|
||||
|
||||
public static function autocomplete($str)
|
||||
{
|
||||
$data = Tariff::byAutocomplete($str)->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||
$data = Tariff::byAutocomplete($str)->orderBy('name')->limit(30)->pluck('name', 'id');
|
||||
$export = [];
|
||||
foreach ($data as $key => $name) {
|
||||
$export[] = ['value' => $key, 'text' => $name];
|
||||
|
||||
@@ -11,7 +11,7 @@ class Taxes
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Tax::orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray();
|
||||
return Tax::orderBy('value', 'asc')->pluck('value', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
|
||||
@@ -11,12 +11,12 @@ class Unities
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Unity::orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray();
|
||||
return Unity::orderBy('value', 'asc')->pluck('value', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getOptionsByPackage($package_id)
|
||||
{
|
||||
return Unity::byPackage($package_id)->orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray();
|
||||
return Unity::byPackage($package_id)->orderBy('value', 'asc')->pluck('value', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
|
||||
@@ -20,7 +20,7 @@ class Variations
|
||||
|
||||
public static function autocomplete($str)
|
||||
{
|
||||
$data = Variation::where('name', 'LIKE', "%{$str}%")->orderBy('name')->limit(30)->get()->pluck('name', 'id');
|
||||
$data = Variation::where('name', 'LIKE', "%{$str}%")->orderBy('name')->limit(30)->pluck('name', 'id');
|
||||
$export = [];
|
||||
foreach ($data as $key => $name) {
|
||||
$export[] = ['value' => $key, 'text' => $name];
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Repositories\Core\Auth\Users as parentUsers;
|
||||
use App\Repositories\Shop\SaleChannels;
|
||||
|
||||
class Users extends parentUsers
|
||||
{
|
||||
public static function getInfo($id = false)
|
||||
{
|
||||
$data = parent::getInfo($id);
|
||||
$sale_channel_default = SaleChannels::getDefault();
|
||||
$data['sale_channel'] = $sale_channel_default ? $sale_channel_default->toArray() : false;
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ trait Basic
|
||||
|
||||
public static function edit($id)
|
||||
{
|
||||
return self::get($id)->toArray();
|
||||
return self::getArray($id);
|
||||
}
|
||||
|
||||
public static function store($data, $stopStamping = false)
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Traits\Model;
|
||||
|
||||
use App\Contracts\Commentator;
|
||||
use App\Models\Core\Comment;
|
||||
use App\Repositories\Core\Auth\Users;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
trait HasComments
|
||||
@@ -15,19 +15,46 @@ trait HasComments
|
||||
|
||||
public function comment(string $comment)
|
||||
{
|
||||
return $this->commentAsUser(auth()->user(), $comment);
|
||||
$user = Users::getUser();
|
||||
|
||||
return $this->commentAsUser($user, $comment);
|
||||
}
|
||||
|
||||
public function commentAsUser(?Model $user, string $comment)
|
||||
{
|
||||
$comment = new Comment([
|
||||
'comment' => $comment,
|
||||
'is_approved' => $user instanceof Commentator ? ! $user->needsCommentApproval($this) : false,
|
||||
'user_id' => is_null($user) ? null : $user->getKey(),
|
||||
'commentable_id' => $this->getKey(),
|
||||
'commentable_type' => get_class(),
|
||||
]);
|
||||
if (trim(strip_tags($comment))) {
|
||||
$data = new Comment([
|
||||
'comment' => $comment,
|
||||
// 'is_approved' => ($user instanceof CanComment) ? ! $user->needsCommentApproval($this) : false,
|
||||
'is_approved' => true,
|
||||
'commenter_id' => is_null($user) ? null : $user->getKey(),
|
||||
'commenter_type' => is_null($user) ? null : $user::class,
|
||||
'commentable_id' => $this->getKey(),
|
||||
'commentable_type' => $this::class,
|
||||
]);
|
||||
|
||||
return $this->comments()->save($comment);
|
||||
return $this->comments()->save($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function commentAsGuest($guest, string $comment)
|
||||
{
|
||||
if (trim(strip_tags($comment))) {
|
||||
$data = new Comment([
|
||||
'comment' => $comment,
|
||||
'guest_name' => $guest['name'],
|
||||
'guest_email' => $guest['email'],
|
||||
// 'is_approved' => ($guest instanceof CanComment) ? ! $guest->needsCommentApproval($this) : false,
|
||||
'is_approved' => true,
|
||||
'commentable_id' => $this->getKey(),
|
||||
'commentable_type' => $this::class,
|
||||
]);
|
||||
|
||||
return $this->comments()->save($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use MadWeb\Initializer\Contracts\Runner;
|
||||
|
||||
class Update
|
||||
{
|
||||
public function production(Runner $run)
|
||||
{
|
||||
$run->external('composer', 'install', '--no-dev', '--prefer-dist', '--optimize-autoloader')
|
||||
->external('npm', 'install', '--production')
|
||||
->external('npm', 'run', 'production')
|
||||
->artisan('route:cache')
|
||||
->artisan('config:cache')
|
||||
->artisan('event:cache')
|
||||
->artisan('migrate', ['--force' => true])
|
||||
->artisan('cache:clear')
|
||||
->artisan('queue:restart'); // ->artisan('horizon:terminate');
|
||||
}
|
||||
|
||||
public function local(Runner $run)
|
||||
{
|
||||
$run->external('composer', 'install')
|
||||
->external('npm', 'install')
|
||||
->external('npm', 'run', 'development')
|
||||
->artisan('migrate')
|
||||
->artisan('cache:clear');
|
||||
}
|
||||
}
|
||||
121
app/User.php
121
app/User.php
@@ -2,125 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
use Mpociot\Teamwork\Traits\UserHasTeams;
|
||||
use Sebastienheyd\Boilerplate\Notifications\NewUser as NewUserNotification;
|
||||
use Sebastienheyd\Boilerplate\Notifications\ResetPassword as ResetPasswordNotification;
|
||||
use Yadahan\AuthenticationLog\AuthenticationLogable;
|
||||
use Sebastienheyd\Boilerplate\Models\User as parentUser;
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends parentUser
|
||||
{
|
||||
use AuthenticationLogable;
|
||||
use LaratrustUserTrait;
|
||||
use Notifiable;
|
||||
use SoftDeletes;
|
||||
use UserHasTeams;
|
||||
|
||||
protected $fillable = ['active', 'last_name', 'first_name', 'email', 'password', 'remember_token', 'last_login'];
|
||||
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function teams()
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
'App\Models\Core\Auth\Team',
|
||||
'App\Models\Core\Auth\TeamUser',
|
||||
'user_id',
|
||||
'id',
|
||||
'id',
|
||||
'team_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function scopeByTeam($query, $id)
|
||||
{
|
||||
return $query->whereHas('teams', function ($query) use ($id) {
|
||||
$query->where('id', $id);
|
||||
});
|
||||
}
|
||||
|
||||
public function scopeByUniqueTeam($query)
|
||||
{
|
||||
return $query->has('teams', '=', 1);
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('active', 1);
|
||||
}
|
||||
|
||||
public function sendPasswordResetNotification($token)
|
||||
{
|
||||
$this->notify(new ResetPasswordNotification($token));
|
||||
}
|
||||
|
||||
public function sendNewUserNotification($token)
|
||||
{
|
||||
$this->notify(new NewUserNotification($token, $this));
|
||||
}
|
||||
|
||||
public function getLastNameAttribute($value)
|
||||
{
|
||||
return mb_strtoupper($value);
|
||||
}
|
||||
|
||||
public function getFirstNameAttribute($value)
|
||||
{
|
||||
return mb_convert_case($value, MB_CASE_TITLE);
|
||||
}
|
||||
|
||||
public function getNameAttribute($value)
|
||||
{
|
||||
if ($value ?? false) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $this->first_name.' '.$this->last_name;
|
||||
}
|
||||
|
||||
public function getLastLogin($format = 'YYYY-MM-DD HH:mm:ss', $default = '')
|
||||
{
|
||||
if ($this->last_login === null) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
return Carbon::createFromTimeString($this->last_login)->isoFormat($format);
|
||||
}
|
||||
|
||||
public function getRolesList()
|
||||
{
|
||||
$res = [];
|
||||
foreach ($this->roles as $role) {
|
||||
$res[] = __($role->display_name);
|
||||
}
|
||||
if (! $res ?? true) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return implode(', ', $res);
|
||||
}
|
||||
|
||||
public function getAvatarPathAttribute()
|
||||
{
|
||||
return public_path('images/avatars/'.md5($this->id.$this->email).'.jpg');
|
||||
}
|
||||
|
||||
public function getAvatarUrlAttribute()
|
||||
{
|
||||
if (is_file($this->avatar_path)) {
|
||||
$ts = filemtime($this->avatar_path);
|
||||
|
||||
return asset('images/avatars/'.md5($this->id.$this->email).'.jpg?t='.$ts);
|
||||
}
|
||||
|
||||
return asset('/assets/vendor/boilerplate/images/default-user.png');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,266 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
|
||||
'source' => [
|
||||
|
||||
'files' => [
|
||||
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
base_path(),
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*
|
||||
* Directories used by the backup process will automatically be excluded.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'follow_links' => false,
|
||||
|
||||
/*
|
||||
* Determines if it should avoid unreadable folders.
|
||||
*/
|
||||
'ignore_unreadable_directories' => false,
|
||||
|
||||
/*
|
||||
* This path is used to make directories in resulting zip-file relative
|
||||
* Set to `null` to include complete absolute path
|
||||
* Example: base_path()
|
||||
*/
|
||||
'relative_path' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*
|
||||
* The content of the database dump may be customized for each connection
|
||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'excludeTables' => [
|
||||
* 'table_to_exclude_from_backup',
|
||||
* 'another_table_to_exclude'
|
||||
* ]
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* If you are using only InnoDB tables on a MySQL server, you can
|
||||
* also supply the useSingleTransaction option to avoid table locking.
|
||||
*
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'useSingleTransaction' => true,
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||
*/
|
||||
'databases' => [
|
||||
'mysql',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The database dump can be compressed to decrease diskspace usage.
|
||||
*
|
||||
* Out of the box Laravel-backup supplies
|
||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||
*
|
||||
* You can also create custom compressor. More info on that here:
|
||||
* https://github.com/spatie/db-dumper#using-compression
|
||||
*
|
||||
* If you do not want any compressor at all, set it to null.
|
||||
*/
|
||||
'database_dump_compressor' => null,
|
||||
|
||||
/*
|
||||
* The file extension used for the database dump files.
|
||||
*
|
||||
* If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
|
||||
* The file extension should be specified without a leading .
|
||||
*/
|
||||
'database_dump_file_extension' => '',
|
||||
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The filename prefix used for the backup zip file.
|
||||
*/
|
||||
'filename_prefix' => '',
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The directory where the temporary files will be stored.
|
||||
*/
|
||||
'temporary_directory' => storage_path('app/backup-temp'),
|
||||
|
||||
/*
|
||||
* The password to be used for archive encryption.
|
||||
* Set to `null` to disable encryption.
|
||||
*/
|
||||
'password' => env('BACKUP_ARCHIVE_PASSWORD'),
|
||||
|
||||
/*
|
||||
* The encryption algorithm to be used for archive encryption.
|
||||
* You can set it to `null` or `false` to disable encryption.
|
||||
*
|
||||
* When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
|
||||
* available on your system.
|
||||
*/
|
||||
'encryption' => 'default',
|
||||
],
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install laravel/slack-notification-channel.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Events` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => 'your@example.com',
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound event will be fired.
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
'disks' => ['local'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* delete the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'default_strategy' => [
|
||||
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
|
||||
/*
|
||||
* The number of days for which daily backups must be kept.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 16,
|
||||
|
||||
/*
|
||||
* The number of weeks for which one weekly backup must be kept.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 8,
|
||||
|
||||
/*
|
||||
* The number of months for which one monthly backup must be kept.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
|
||||
/*
|
||||
* The number of years for which one yearly backup must be kept.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
*/
|
||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* The comment class that should be used to store and retrieve
|
||||
* the comments.
|
||||
*/
|
||||
'comment_class' => \BeyondCode\Comments\Comment::class,
|
||||
|
||||
/*
|
||||
* The user model that should be used when associating comments with
|
||||
* commentators. If null, the default user provider from your
|
||||
* Laravel authentication configuration will be used.
|
||||
*/
|
||||
'user_model' => null,
|
||||
|
||||
];
|
||||
@@ -10,7 +10,7 @@ return [
|
||||
| corner of the window. Feel free to edit this value to suit your needs.
|
||||
|
|
||||
*/
|
||||
'title' => 'FgDigital Monitoring checking',
|
||||
'title' => 'Monitoring checking',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Editor
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Choose your preferred editor to use when clicking any edit button.
|
||||
|
|
||||
| Supported: "phpstorm", "vscode", "vscode-insiders", "textmate", "emacs",
|
||||
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
|
||||
| "xdebug"
|
||||
|
|
||||
*/
|
||||
|
||||
'editor' => env('IGNITION_EDITOR', 'phpstorm'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Theme
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which theme Ignition should use.
|
||||
|
|
||||
| Supported: "light", "dark", "auto"
|
||||
|
|
||||
*/
|
||||
|
||||
'theme' => env('IGNITION_THEME', 'light'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sharing
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can share local errors with colleagues or others around the world.
|
||||
| Sharing is completely free and doesn't require an account on Flare.
|
||||
|
|
||||
| If necessary, you can completely disable sharing below.
|
||||
|
|
||||
*/
|
||||
|
||||
'enable_share_button' => env('IGNITION_SHARING_ENABLED', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Ignition commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Ignition comes with an additional make command that lets you create
|
||||
| new solution classes more easily. To keep your default Laravel
|
||||
| installation clean, this command is not registered by default.
|
||||
|
|
||||
| You can enable the command registration below.
|
||||
|
|
||||
*/
|
||||
'register_commands' => env('REGISTER_IGNITION_COMMANDS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Ignored Solution Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify a list of solution providers (as fully qualified class
|
||||
| names) that shouldn't be loaded. Ignition will ignore these classes
|
||||
| and possible solutions provided by them will never be displayed.
|
||||
|
|
||||
*/
|
||||
|
||||
'ignored_solution_providers' => [
|
||||
\Facade\Ignition\SolutionProviders\MissingPackageSolutionProvider::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Runnable Solutions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some solutions that Ignition displays are runnable and can perform
|
||||
| various tasks. Runnable solutions are enabled when your app has
|
||||
| debug mode enabled. You may also fully disable this feature.
|
||||
|
|
||||
*/
|
||||
|
||||
'enable_runnable_solutions' => env('IGNITION_ENABLE_RUNNABLE_SOLUTIONS', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Path Mapping
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using a remote dev server, like Laravel Homestead, Docker, or
|
||||
| even a remote VPS, it will be necessary to specify your path mapping.
|
||||
|
|
||||
| Leaving one, or both of these, empty or null will not trigger the remote
|
||||
| URL changes and Ignition will treat your editor links as local files.
|
||||
|
|
||||
| "remote_sites_path" is an absolute base path for your sites or projects
|
||||
| in Homestead, Vagrant, Docker, or another remote development server.
|
||||
|
|
||||
| Example value: "/home/vagrant/Code"
|
||||
|
|
||||
| "local_sites_path" is an absolute base path for your sites or projects
|
||||
| on your local computer where your IDE or code editor is running on.
|
||||
|
|
||||
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
||||
|
|
||||
*/
|
||||
|
||||
'remote_sites_path' => env('IGNITION_REMOTE_SITES_PATH', ''),
|
||||
'local_sites_path' => env('IGNITION_LOCAL_SITES_PATH', ''),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Housekeeping Endpoint Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Ignition registers a couple of routes when it is enabled. Below you may
|
||||
| specify a route prefix that will be used to host all internal links.
|
||||
|
|
||||
*/
|
||||
'housekeeping_endpoint_prefix' => '_ignition',
|
||||
|
||||
];
|
||||
@@ -1,334 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use MorphMap in relationships between models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, the morphMap feature is going to be used. The array values that
|
||||
| are going to be used are the ones inside the 'user_models' array.
|
||||
|
|
||||
*/
|
||||
'use_morph_map' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Which permissions and role checker to use.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines if you want to use the roles and permissions checker.
|
||||
| Available:
|
||||
| - default: Check for the roles and permissions using the method that Laratrust
|
||||
has always used.
|
||||
| - query: Check for the roles and permissions using direct queries to the database.
|
||||
| This method doesn't support cache yet.
|
||||
|
|
||||
*/
|
||||
'checker' => 'default',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Manage Laratrust's cache configurations. It uses the driver defined in the
|
||||
| config/cache.php file.
|
||||
|
|
||||
*/
|
||||
'cache' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use cache in the package
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines if Laratrust will use Laravel's Cache to cache the roles and permissions.
|
||||
| NOTE: Currently the database check does not use cache.
|
||||
|
|
||||
*/
|
||||
'enabled' => env('LARATRUST_ENABLE_CACHE', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Time to store in cache Laratrust's roles and permissions.
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines the time in SECONDS to store Laratrust's roles and permissions in the cache.
|
||||
|
|
||||
*/
|
||||
'expiration_time' => 3600,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust User Models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the array that contains the information of the user models.
|
||||
| This information is used in the add-trait command, for the roles and
|
||||
| permissions relationships with the possible user models, and the
|
||||
| administration panel to attach roles and permissions to the users.
|
||||
|
|
||||
| The key in the array is the name of the relationship inside the roles and permissions.
|
||||
|
|
||||
*/
|
||||
'user_models' => [
|
||||
'users' => \App\Models\User::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the models used by Laratrust to define the roles, permissions and teams.
|
||||
| If you want the Laratrust models to be in a different namespace or
|
||||
| to have a different name, you can do it here.
|
||||
|
|
||||
*/
|
||||
'models' => [
|
||||
|
||||
'role' => \App\Models\Role::class,
|
||||
|
||||
'permission' => \App\Models\Permission::class,
|
||||
|
||||
/**
|
||||
* Will be used only if the teams functionality is enabled.
|
||||
*/
|
||||
'team' => \App\Models\Team::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Tables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the tables used by Laratrust to store all the authorization data.
|
||||
|
|
||||
*/
|
||||
'tables' => [
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/**
|
||||
* Will be used only if the teams functionality is enabled.
|
||||
*/
|
||||
'teams' => 'teams',
|
||||
|
||||
'role_user' => 'role_user',
|
||||
|
||||
'permission_user' => 'permission_user',
|
||||
|
||||
'permission_role' => 'permission_role',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Foreign Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the foreign keys used by laratrust in the intermediate tables.
|
||||
|
|
||||
*/
|
||||
'foreign_keys' => [
|
||||
/**
|
||||
* User foreign key on Laratrust's role_user and permission_user tables.
|
||||
*/
|
||||
'user' => 'user_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's role_user and permission_role tables.
|
||||
*/
|
||||
'role' => 'role_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's permission_user and permission_role tables.
|
||||
*/
|
||||
'permission' => 'permission_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's role_user and permission_user tables.
|
||||
*/
|
||||
'team' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This configuration helps to customize the Laratrust middleware behavior.
|
||||
|
|
||||
*/
|
||||
'middleware' => [
|
||||
/**
|
||||
* Define if the laratrust middleware are registered automatically in the service provider
|
||||
*/
|
||||
'register' => true,
|
||||
|
||||
/**
|
||||
* Method to be called in the middleware return case.
|
||||
* Available: abort|redirect
|
||||
*/
|
||||
'handling' => 'abort',
|
||||
|
||||
/**
|
||||
* Handlers for the unauthorized method in the middlewares.
|
||||
* The name of the handler must be the same as the handling.
|
||||
*/
|
||||
'handlers' => [
|
||||
/**
|
||||
* Aborts the execution with a 403 code and allows you to provide the response text
|
||||
*/
|
||||
'abort' => [
|
||||
'code' => 403,
|
||||
'message' => 'User does not have any of the necessary access rights.',
|
||||
],
|
||||
|
||||
/**
|
||||
* Redirects the user to the given url.
|
||||
* If you want to flash a key to the session,
|
||||
* you can do it by setting the key and the content of the message
|
||||
* If the message content is empty it won't be added to the redirection.
|
||||
*/
|
||||
'redirect' => [
|
||||
'url' => '/home',
|
||||
'message' => [
|
||||
'key' => 'error',
|
||||
'content' => '',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'teams' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use teams feature in the package
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines if Laratrust will use the teams feature.
|
||||
| Please check the docs to see what you need to do in case you have the package already configured.
|
||||
|
|
||||
*/
|
||||
'enabled' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Strict check for roles/permissions inside teams
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines if a strict check should be done when checking if a role or permission
|
||||
| is attached inside a team.
|
||||
| If it's false, when checking a role/permission without specifying the team,
|
||||
| it will check only if the user has attached that role/permission ignoring the team.
|
||||
|
|
||||
*/
|
||||
'strict_check' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Magic 'isAbleTo' Method
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Supported cases for the magic is able to method (Refer to the docs).
|
||||
| Available: camel_case|snake_case|kebab_case
|
||||
|
|
||||
*/
|
||||
'magic_is_able_to_method_case' => 'kebab_case',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Permissions as Gates
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines if you can check if a user has a permission using the "can" method.
|
||||
|
|
||||
*/
|
||||
'permissions_as_gates' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Panel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Section to manage everything related with the admin panel for the roles and permissions.
|
||||
|
|
||||
*/
|
||||
'panel' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Panel Register
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This manages if routes used for the admin panel should be registered.
|
||||
| Turn this value to false if you don't want to use Laratrust admin panel
|
||||
|
|
||||
*/
|
||||
'register' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Panel Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the URI path where Laratrust panel for roles and permissions
|
||||
| will be accessible from.
|
||||
|
|
||||
*/
|
||||
'path' => 'laratrust',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Panel Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The route where the go back link should point
|
||||
|
|
||||
*/
|
||||
'go_back_route' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Panel Route Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These middleware will get attached onto each Laratrust panel route.
|
||||
|
|
||||
*/
|
||||
'middleware' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Enable permissions assignment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enable/Disable the permissions assignment to the users.
|
||||
|
|
||||
*/
|
||||
'assign_permissions_to_user' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Add restriction to roles in the panel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure which roles can not be editable, deletable and removable.
|
||||
| To add a role to the restriction, use name of the role here.
|
||||
|
|
||||
*/
|
||||
'roles_restrictions' => [
|
||||
// The user won't be able to remove roles already assigned to users.
|
||||
'not_removable' => [],
|
||||
|
||||
// The user won't be able to edit the role and the permissions assigned.
|
||||
'not_editable' => [],
|
||||
|
||||
// The user won't be able to delete the role.
|
||||
'not_deletable' => [],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Auth Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Auth model used by Teamwork.
|
||||
|
|
||||
*/
|
||||
'user_model' => config('auth.providers.users.model', App\User::class),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork users Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the users table name used by Teamwork.
|
||||
|
|
||||
*/
|
||||
'users_table' => 'users',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork Team Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Team model used by Teamwork to create correct relations. Update
|
||||
| the team if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'team_model' => Mpociot\Teamwork\TeamworkTeam::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork teams Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the teams table name used by Teamwork to save teams to the database.
|
||||
|
|
||||
*/
|
||||
'teams_table' => 'teams',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork team_user Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the team_user table used by Teamwork to save assigned teams to the
|
||||
| database.
|
||||
|
|
||||
*/
|
||||
'team_user_table' => 'team_user',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Foreign key on Teamwork's team_user Table (Pivot)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'user_foreign_key' => 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork Team Invite Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Team Invite model used by Teamwork to create correct relations.
|
||||
| Update the team if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'invite_model' => Mpociot\Teamwork\TeamInvite::class,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Teamwork team invites Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the team invites table name used by Teamwork to save sent/pending
|
||||
| invitation into teams to the database.
|
||||
|
|
||||
*/
|
||||
'team_invites_table' => 'team_invites',
|
||||
];
|
||||
@@ -1,230 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the TwigBridge package.
|
||||
*
|
||||
* @copyright Robert Crowe <hello@vivalacrowe.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration options for Twig.
|
||||
*/
|
||||
return [
|
||||
|
||||
'twig' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extension
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| File extension for Twig view files.
|
||||
|
|
||||
*/
|
||||
'extension' => 'twig',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Accepts all Twig environment configuration options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| http://twig.sensiolabs.org/doc/api.html#environment-options
|
||||
|
|
||||
*/
|
||||
'environment' => [
|
||||
|
||||
// When set to true, the generated templates have a __toString() method
|
||||
// that you can use to display the generated nodes.
|
||||
// default: false
|
||||
'debug' => env('APP_DEBUG', false),
|
||||
|
||||
// The charset used by the templates.
|
||||
// default: utf-8
|
||||
'charset' => 'utf-8',
|
||||
|
||||
// The base template class to use for generated templates.
|
||||
// default: TwigBridge\Twig\Template
|
||||
'base_template_class' => 'TwigBridge\Twig\Template',
|
||||
|
||||
// An absolute path where to store the compiled templates, or false to disable caching. If null
|
||||
// then the cache file path is used.
|
||||
// default: cache file storage path
|
||||
'cache' => null,
|
||||
|
||||
// When developing with Twig, it's useful to recompile the template
|
||||
// whenever the source code changes. If you don't provide a value
|
||||
// for the auto_reload option, it will be determined automatically based on the debug value.
|
||||
'auto_reload' => true,
|
||||
|
||||
// If set to false, Twig will silently ignore invalid variables
|
||||
// (variables and or attributes/methods that do not exist) and
|
||||
// replace them with a null value. When set to true, Twig throws an exception instead.
|
||||
// default: false
|
||||
'strict_variables' => false,
|
||||
|
||||
// If set to true, auto-escaping will be enabled by default for all templates.
|
||||
// default: 'html'
|
||||
'autoescape' => 'html',
|
||||
|
||||
// A flag that indicates which optimizations to apply
|
||||
// (default to -1 -- all optimizations are enabled; set it to 0 to disable)
|
||||
'optimizations' => -1,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Safe Classes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When set, the output of the `__string` method of the following classes will not be escaped.
|
||||
| default: Laravel's Htmlable, which the HtmlString class implements.
|
||||
|
|
||||
*/
|
||||
'safe_classes' => [
|
||||
\Illuminate\Contracts\Support\Htmlable::class => ['html'],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global variables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These will always be passed in and can be accessed as Twig variables.
|
||||
| NOTE: these will be overwritten if you pass data into the view with the same key.
|
||||
|
|
||||
*/
|
||||
'globals' => [],
|
||||
],
|
||||
|
||||
'extensions' => [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extensions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enabled extensions.
|
||||
|
|
||||
| `Twig\Extension\DebugExtension` is enabled automatically if twig.debug is TRUE.
|
||||
|
|
||||
*/
|
||||
'enabled' => [
|
||||
'TwigBridge\Extension\Loader\Facades',
|
||||
'TwigBridge\Extension\Loader\Filters',
|
||||
'TwigBridge\Extension\Loader\Functions',
|
||||
|
||||
'TwigBridge\Extension\Laravel\Auth',
|
||||
'TwigBridge\Extension\Laravel\Config',
|
||||
'TwigBridge\Extension\Laravel\Dump',
|
||||
'TwigBridge\Extension\Laravel\Input',
|
||||
'TwigBridge\Extension\Laravel\Session',
|
||||
'TwigBridge\Extension\Laravel\Str',
|
||||
'TwigBridge\Extension\Laravel\Translator',
|
||||
'TwigBridge\Extension\Laravel\Url',
|
||||
'TwigBridge\Extension\Laravel\Model',
|
||||
// 'TwigBridge\Extension\Laravel\Gate',
|
||||
|
||||
// 'TwigBridge\Extension\Laravel\Form',
|
||||
// 'TwigBridge\Extension\Laravel\Html',
|
||||
// 'TwigBridge\Extension\Laravel\Legacy\Facades',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Facades
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Available facades. Access like `{{ Config.get('foo.bar') }}`.
|
||||
|
|
||||
| Each facade can take an optional array of options. To mark the whole facade
|
||||
| as safe you can set the option `'is_safe' => true`. Setting the facade as
|
||||
| safe means that any HTML returned will not be escaped.
|
||||
|
|
||||
| It is advisable to not set the whole facade as safe and instead mark the
|
||||
| each appropriate method as safe for security reasons. You can do that with
|
||||
| the following syntax:
|
||||
|
|
||||
| <code>
|
||||
| 'Form' => [
|
||||
| 'is_safe' => [
|
||||
| 'open'
|
||||
| ]
|
||||
| ]
|
||||
| </code>
|
||||
|
|
||||
| The values of the `is_safe` array must match the called method on the facade
|
||||
| in order to be marked as safe.
|
||||
|
|
||||
*/
|
||||
'facades' => [],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Functions
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Available functions. Access like `{{ secure_url(...) }}`.
|
||||
|
|
||||
| Each function can take an optional array of options. These options are
|
||||
| passed directly to `Twig\TwigFunction`.
|
||||
|
|
||||
| So for example, to mark a function as safe you can do the following:
|
||||
|
|
||||
| <code>
|
||||
| 'link_to' => [
|
||||
| 'is_safe' => ['html']
|
||||
| ]
|
||||
| </code>
|
||||
|
|
||||
| The options array also takes a `callback` that allows you to name the
|
||||
| function differently in your Twig templates than what it's actually called.
|
||||
|
|
||||
| <code>
|
||||
| 'link' => [
|
||||
| 'callback' => 'link_to'
|
||||
| ]
|
||||
| </code>
|
||||
|
|
||||
*/
|
||||
'functions' => [
|
||||
'elixir',
|
||||
'head',
|
||||
'last',
|
||||
'mix',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filters
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Available filters. Access like `{{ variable|filter }}`.
|
||||
|
|
||||
| Each filter can take an optional array of options. These options are
|
||||
| passed directly to `Twig\TwigFilter`.
|
||||
|
|
||||
| So for example, to mark a filter as safe you can do the following:
|
||||
|
|
||||
| <code>
|
||||
| 'studly_case' => [
|
||||
| 'is_safe' => ['html']
|
||||
| ]
|
||||
| </code>
|
||||
|
|
||||
| The options array also takes a `callback` that allows you to name the
|
||||
| filter differently in your Twig templates than what is actually called.
|
||||
|
|
||||
| <code>
|
||||
| 'snake' => [
|
||||
| 'callback' => 'snake_case'
|
||||
| ]
|
||||
| </code>
|
||||
|
|
||||
*/
|
||||
'filters' => [
|
||||
'get' => 'data_get',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use App\User;
|
||||
use Faker\Generator as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(User::class, function (Faker $faker) {
|
||||
return [
|
||||
'name' => $faker->name,
|
||||
'email' => $faker->unique()->safeEmail,
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
});
|
||||
@@ -11,5 +11,4 @@ Route::prefix('Producers')->name('Producers.')->group(function () {
|
||||
Route::post('getSelect', 'ProducerController@getOptions')->name('getSelect');
|
||||
Route::post('deleteImage', 'ProducerController@deleteImage')->name('deleteImage');
|
||||
Route::any('getImages/{id?}/{can_edit?}', 'ProducerController@getImages')->name('getImages');
|
||||
Route::any('exportExcel', 'ProducerController@exportExcel')->name('exportExcel');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user