diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index c6a6de67..74ff68d2 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -4,7 +4,7 @@ namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\Providers\RouteServiceProvider; -use App\User; +use App\Models\Core\Auth\User; use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; diff --git a/app/Http/Controllers/Shop/Admin/CategoryController.php b/app/Http/Controllers/Shop/Admin/CategoryController.php deleted file mode 100644 index 68a3501b..00000000 --- a/app/Http/Controllers/Shop/Admin/CategoryController.php +++ /dev/null @@ -1,87 +0,0 @@ -ajax()) { + return self::getDatatable($request); + } else { + $data = []; + return view('Shop.Admin.Sections.list', $data); + } + } + + public function getDatatable(Request $request) + { + return Sections::getTables($request->all()); } /** @@ -25,7 +36,8 @@ class SectionController extends Controller */ public function create() { - // + $data = []; + return view('Shop.Admin.Sections.create', $data); } /** @@ -36,39 +48,42 @@ class SectionController extends Controller */ public function store(Request $request) { - // + $ret = Sections::store($request); + return redirect()->route('Shop.Admin.Sections.index'); } /** * Display the specified resource. * - * @param \App\Section $Section + * @param \App\Customer $customer * @return \Illuminate\Http\Response */ - public function show(Section $Section) + public function show($id) { - // + $data = Sections::get($id); + return view('Shop.Admin.Sections.view', $data); } /** * Show the form for editing the specified resource. * - * @param \App\Section $Section + * @param \App\Customer $customer * @return \Illuminate\Http\Response */ - public function edit(Section $Section) + public function edit($id) { - // + $data = Sections::get($id); + return view('Shop.Admin.Sections.edit', $data); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request - * @param \App\Section $Section + * @param \App\Customer $customer * @return \Illuminate\Http\Response */ - public function update(Request $request, Section $Section) + public function update(Request $request) { // } @@ -76,11 +91,11 @@ class SectionController extends Controller /** * Remove the specified resource from storage. * - * @param \App\Section $Section + * @param \App\Customer $customer * @return \Illuminate\Http\Response */ - public function destroy(Section $Section) + public function destroy($id) { - // + return Sections::destroy($id); } } diff --git a/app/Http/Controllers/Shop/SectionController.php b/app/Http/Controllers/Shop/SectionController.php index 7d212985..1c897015 100644 --- a/app/Http/Controllers/Shop/SectionController.php +++ b/app/Http/Controllers/Shop/SectionController.php @@ -14,30 +14,19 @@ class SectionController extends Controller * * @return \Illuminate\Http\Response */ - public function index() + public function index(Request $request) { - // + if ($request->ajax()) { + return self::getDatatable($request); + } else { + $data = []; + return view('Shop.Sections.list', $data); + } } - /** - * Show the form for creating a new resource. - * - * @return \Illuminate\Http\Response - */ - public function create() + public function getDatatable(Request $request) { - // - } - - /** - * Store a newly created resource in storage. - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\Response - */ - public function store(Request $request) - { - // + return Sections::getTables($request->all()); } /** @@ -48,40 +37,8 @@ class SectionController extends Controller */ public function show(Customer $customer) { - // + $data = Sections::get($id); + return view('Shop.Admin.Sections.view', $data); } - /** - * Show the form for editing the specified resource. - * - * @param \App\Customer $customer - * @return \Illuminate\Http\Response - */ - public function edit(Customer $customer) - { - // - } - - /** - * Update the specified resource in storage. - * - * @param \Illuminate\Http\Request $request - * @param \App\Customer $customer - * @return \Illuminate\Http\Response - */ - public function update(Request $request, Customer $customer) - { - // - } - - /** - * Remove the specified resource from storage. - * - * @param \App\Customer $customer - * @return \Illuminate\Http\Response - */ - public function destroy(Customer $customer) - { - // - } } diff --git a/app/Menu/Shop.php b/app/Menu/Shop.php index 57d8c7f8..490a6668 100644 --- a/app/Menu/Shop.php +++ b/app/Menu/Shop.php @@ -12,17 +12,18 @@ class Shop $menu->add('Commerce', [ 'permission' => 'backend', 'icon' => 'cog' ]) ->id('shop') ->activeIfRoute('shop') + ->order(1); - $menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend' ]) - ->activeIfRoute(['Shop.Admin.Orders.index'])->order(1); - $menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ]) - ->activeIfRoute(['Shop.Admin.Invoices.index'])->order(2); - - $menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ]) - ->activeIfRoute(['Shop.Admin.Products.index'])->order(3); + $menu->addTo('shop', 'Categories', [ 'route' => 'Shop.Admin.Sections.index', 'permission' => 'backend' ]) + ->activeIfRoute(['Shop.Admin.Sections.index'])->order(1); $menu->addTo('shop', 'Produits', [ 'route' => 'Shop.Admin.Products.index', 'permission' => 'backend' ]) - ->activeIfRoute(['Shop.Admin.Products.index'])->order(4); + ->activeIfRoute(['Shop.Admin.Products.index'])->order(2); + $menu->addTo('shop', 'Commandes', [ 'route' => 'Shop.Admin.Orders.index', 'permission' => 'backend' ]) + ->activeIfRoute(['Shop.Admin.Orders.index'])->order(3); + $menu->addTo('shop', 'Factures', [ 'route' => 'Shop.Admin.Invoices.index', 'permission' => 'backend' ]) + ->activeIfRoute(['Shop.Admin.Invoices.index'])->order(4); + } diff --git a/app/Models/Modules/Application.php b/app/Models/Core/App/Application.php similarity index 79% rename from app/Models/Modules/Application.php rename to app/Models/Core/App/Application.php index e3c7bd47..f885dd48 100644 --- a/app/Models/Modules/Application.php +++ b/app/Models/Core/App/Application.php @@ -1,6 +1,6 @@ hasMany('App\Models\Modules\ApplicationPage'); + return $this->hasMany('App\Models\Core\App\ApplicationPage'); } public function modules() { - return $this->hasMany('App\Models\Modules\ApplicationModule'); + return $this->hasMany('App\Models\Core\App\ApplicationModule'); } public function scopeActive($query) diff --git a/app/Models/Modules/ApplicationModule.php b/app/Models/Core/App/ApplicationModule.php similarity index 87% rename from app/Models/Modules/ApplicationModule.php rename to app/Models/Core/App/ApplicationModule.php index fb21b978..f938e4e1 100644 --- a/app/Models/Modules/ApplicationModule.php +++ b/app/Models/Core/App/ApplicationModule.php @@ -1,5 +1,6 @@ belongsTo('App\Models\Modules\Application'); + return $this->belongsTo('App\Models\Core\App\Application'); } public function permissions() diff --git a/app/Models/Modules/ApplicationPage.php b/app/Models/Core/App/ApplicationPage.php similarity index 86% rename from app/Models/Modules/ApplicationPage.php rename to app/Models/Core/App/ApplicationPage.php index f966916e..965bf6fe 100644 --- a/app/Models/Modules/ApplicationPage.php +++ b/app/Models/Core/App/ApplicationPage.php @@ -1,6 +1,6 @@ belongsTo('App\Models\Modules\Application'); + return $this->belongsTo('App\Models\Core\App'); } public function scopeActive($query) diff --git a/app/Models/Auth/Permission.php b/app/Models/Core/Auth/Permission.php similarity index 88% rename from app/Models/Auth/Permission.php rename to app/Models/Core/Auth/Permission.php index 966a6868..7ab2d197 100644 --- a/app/Models/Auth/Permission.php +++ b/app/Models/Core/Auth/Permission.php @@ -1,6 +1,6 @@ belongsTo('App\Models\Application'); + return $this->belongsTo('App\Models\Core\App\Application'); } public function application_module() { - return $this->belongsTo('App\Models\ApplicationModule'); + return $this->belongsTo('App\Models\Core\App\ApplicationModule'); } public function getDisplayNameAttribute($value) diff --git a/app/Models/PermissionCategory.php b/app/Models/Core/Auth/PermissionCategory.php similarity index 97% rename from app/Models/PermissionCategory.php rename to app/Models/Core/Auth/PermissionCategory.php index 3cba9818..33122eb0 100644 --- a/app/Models/PermissionCategory.php +++ b/app/Models/Core/Auth/PermissionCategory.php @@ -1,7 +1,6 @@ belongsTo('App\Permission'); + return $this->belongsTo('App\Models\Core\Auth\Permission'); } public function role() { - return $this->belongsTo('App\Role'); + return $this->belongsTo('App\Models\Core\Auth\Role'); } public function scopeByPermission($query, $id) diff --git a/app/Models/Auth/PermissionUser.php b/app/Models/Core/Auth/PermissionUser.php similarity index 75% rename from app/Models/Auth/PermissionUser.php rename to app/Models/Core/Auth/PermissionUser.php index ef2931e8..81dbf2c1 100644 --- a/app/Models/Auth/PermissionUser.php +++ b/app/Models/Core/Auth/PermissionUser.php @@ -1,6 +1,6 @@ belongsTo('App\Permission'); + return $this->belongsTo('App\Models\Core\Auth\Permission'); } public function user() { - return $this->belongsTo('App\User'); + return $this->belongsTo('App\Models\Core\Auth\User'); } public function team() { - return $this->belongsTo('App\Team'); + return $this->belongsTo('App\Models\Core\Auth\Team'); } public function scopeByUser($query, $id) diff --git a/app/Models/Auth/Role.php b/app/Models/Core/Auth/Role.php similarity index 97% rename from app/Models/Auth/Role.php rename to app/Models/Core/Auth/Role.php index eb599ca8..e5c61c08 100644 --- a/app/Models/Auth/Role.php +++ b/app/Models/Core/Auth/Role.php @@ -1,6 +1,6 @@ belongsTo('App\User'); + return $this->belongsTo('App\Models\Core\Auth\User'); } public function team() { - return $this->belongsTo('App\Team'); + return $this->belongsTo('App\Models\Core\Auth\Team'); } public function scopeByUser($query, $id) diff --git a/app/Models/Auth/Team.php b/app/Models/Core/Auth/Team.php similarity index 58% rename from app/Models/Auth/Team.php rename to app/Models/Core/Auth/Team.php index ec235b33..3b54f849 100644 --- a/app/Models/Auth/Team.php +++ b/app/Models/Core/Auth/Team.php @@ -1,6 +1,6 @@ hasMany('App\User'); - } - - public function society() - { - return $this->belongsTo('App\Models\Society'); + return $this->hasMany('App\Models\Core\Auth\User'); } public function scopeActive($query) @@ -28,8 +23,4 @@ class Team extends LaratrustTeam return $query->where('active', 1); } - public function scopeBySociety($query, $id) - { - return $query->where('society_id', $id); - } } diff --git a/app/Models/Auth/TeamUser.php b/app/Models/Core/Auth/TeamUser.php similarity index 73% rename from app/Models/Auth/TeamUser.php rename to app/Models/Core/Auth/TeamUser.php index a796258c..91d8539b 100644 --- a/app/Models/Auth/TeamUser.php +++ b/app/Models/Core/Auth/TeamUser.php @@ -1,6 +1,6 @@ belongsTo('App\User'); + return $this->belongsTo('App\Models\Core\Auth\User'); } public function team() { - return $this->belongsTo('App\Team'); + return $this->belongsTo('App\Models\Core\Auth\Team'); } public function scopeByUser($query, $id) diff --git a/app/User.php b/app/Models/Core/Auth/User.php similarity index 89% rename from app/User.php rename to app/Models/Core/Auth/User.php index ebbae15a..9c1f58ec 100644 --- a/app/User.php +++ b/app/Models/Core/Auth/User.php @@ -1,12 +1,13 @@ 'datetime', ]; - public function user_detail() + public function teams() { - return $this->hasOne('App\Models\UserDetail'); - } - - public function teams2() - { - return $this->hasManyThrough('App\Team', 'App\Models\TeamUser', 'user_id', 'id', 'id', 'team_id'); + 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('teams2', function ($query) use ($id) { + return $query->whereHas('teams', function ($query) use ($id) { $query->where('id', $id); }); } public function scopeByUniqueTeam($query) { - return $query->has('teams2', '=', 1); - } - - public function scopeBySociete($query, $id) - { - return $query->whereHas('teams2', function ($query) use ($id) { - $query->bySociete($id); - }); - } - - public function scopeByPartenaire($query, $id) - { - return $query->whereHas('teams2', function ($query) use ($id) { - $query->byPartenaire($id); - }); + return $query->has('teams', '=', 1); } public function scopeActive($query) diff --git a/app/Models/Shop/Customer.php b/app/Models/Shop/Customer.php index c68c8eaa..17db8f8f 100644 --- a/app/Models/Shop/Customer.php +++ b/app/Models/Shop/Customer.php @@ -8,25 +8,16 @@ class Customer extends Model { protected $guarded = ['id']; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ public function Invoices() { return $this->hasMany('App\Models\Shop\Invoice'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ public function Orders() { return $this->hasMany('App\Models\Shop\Order'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function User() { return $this->belongsTo('App\User'); diff --git a/app/Models/Shop/CustomerAddress.php b/app/Models/Shop/CustomerAddress.php new file mode 100644 index 00000000..eea8762a --- /dev/null +++ b/app/Models/Shop/CustomerAddress.php @@ -0,0 +1,21 @@ +belongsTo('App\Models\Shop\Customer'); + } + + public function Orders() + { + return $this->hasMany('App\Models\Shop\Order'); + } + +} \ No newline at end of file diff --git a/app/Models/Shop/ProductPrice.php b/app/Models/Shop/ProductPrice.php index 99186808..1d49891e 100644 --- a/app/Models/Shop/ProductPrice.php +++ b/app/Models/Shop/ProductPrice.php @@ -8,19 +8,19 @@ class ProductPrice extends Model { protected $guarded = ['id']; - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function Product() { return $this->belongsTo('App\Models\Shop\Product'); } - /** - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function ProductAttribute() { return $this->belongsTo('App\Models\Shop\ProductAttribute'); } + + public function scopeByProduct($query, $id) + { + return $query->where('product_id', $id); + } + } \ No newline at end of file diff --git a/app/Models/Shop/ProductSection.php b/app/Models/Shop/ProductSection.php new file mode 100644 index 00000000..9fa5b15b --- /dev/null +++ b/app/Models/Shop/ProductSection.php @@ -0,0 +1,30 @@ +belongsTo('App\Models\Shop\Product'); + } + + public function Section() + { + return $this->belongsTo('App\Models\Shop\Product'); + } + + public function scopeByProduct($query, $id) + { + return $query->where('product_id', $id); + } + + public function scopeBySection($query, $id) + { + return $query->where('section_id', $id); + } +} \ No newline at end of file diff --git a/app/Models/Shop/Section.php b/app/Models/Shop/Section.php index 8f18192d..69a5607f 100644 --- a/app/Models/Shop/Section.php +++ b/app/Models/Shop/Section.php @@ -4,13 +4,13 @@ namespace App\Models\Shop; use Illuminate\Database\Eloquent\Model; +use Rinvex\Categories\Traits\Categorizable, + class Section extends Model { - protected $guarded = ['id']; + use Categorizable; + protected $guarded = ['id']; - /** - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ public function Products() { return $this->hasMany('App\Models\Shop\Product'); diff --git a/app/Repositories/ApplicationPages.php b/app/Repositories/Core/App/ApplicationPages.php similarity index 93% rename from app/Repositories/ApplicationPages.php rename to app/Repositories/Core/App/ApplicationPages.php index 6b5d7960..eb6c3a89 100644 --- a/app/Repositories/ApplicationPages.php +++ b/app/Repositories/Core/App/ApplicationPages.php @@ -2,7 +2,7 @@ namespace App\Repositories; -use App\Models\ApplicationPage; +use App\Models\Core\App\ApplicationPage; use Illuminate\Support\Facades\Route; diff --git a/app/Repositories/Applications.php b/app/Repositories/Core/App/Applications.php similarity index 97% rename from app/Repositories/Applications.php rename to app/Repositories/Core/App/Applications.php index 155399df..88ea948d 100644 --- a/app/Repositories/Applications.php +++ b/app/Repositories/Core/App/Applications.php @@ -1,6 +1,6 @@ distinct('module')->get()->pluck('module'); + } + + public static function getOptions() + { + return Permission::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray(); + } + + public static function getInfo($id) + { + return Permission::find($id); + } + + public static function select_all() + { + return self::getAll()->toArray(); + } + + public static function select_by_id($id) + { + return Permission::find($id)->toArray(); + } + + public static function getAll() + { + return Permission::orderBy('name', 'asc')->get(); + } + + public static function getByName($name) + { + return Permission::where('name', $name)->first(); + } + + public static function get($id) + { + return Permission::find($id); + } + + public static function getTable($id) + { + $datas = Permission::withCount(['users']); + return Datatables::of($datas)->make(true); + } + + public static function delete($id) + { + Users::destroyByUniquePermission($id); + return Permission::destroy($id); + } + + public static function store($data) + { + return (isset($data['id']) && $data['id']) ? self::update($data) : self::create($data); + } + + public static function create($data) + { + return Permission::create($data); + } + + public static function update($data) + { + return Permission::find($data['id'])->update($data); + } + + public static function count() + { + return Permission::count(); + } +} diff --git a/app/Repositories/Core/User/ResetPassword.php b/app/Repositories/Core/Auth/ResetPassword.php similarity index 100% rename from app/Repositories/Core/User/ResetPassword.php rename to app/Repositories/Core/Auth/ResetPassword.php diff --git a/app/Repositories/Core/Auth/Roles.php b/app/Repositories/Core/Auth/Roles.php new file mode 100644 index 00000000..57687bf7 --- /dev/null +++ b/app/Repositories/Core/Auth/Roles.php @@ -0,0 +1,147 @@ + $name, 'display_name' => $name, 'translated' => $translated, 'description' => '', 'active' => true]); + $role->attachPermissions($permissions); + return $role; + } + + // met à jour les informations d'une forme juridique + public static function update($input, $id = false) + { + $id = ($id) ? $id : $input['id']; + $permissions = array_keys($input['permissions']); + $name = $input['name']; + $translated = $input['translated']; + self::setTranslation($name, $translated); + $role = Role::find($id); + $role->update(['name' => $name, 'translated' => $translated]); + $role->syncPermissions($permissions); + return $role; + } + + // supprime une forme juridique + public static function delete($id) + { + $old = self::select_by_id($id); + self::deleteTranslation($old->translated); + return Role::destroy($id); + } + + // met à jour le statut actif/inactif d'une forme juridique + public static function toggle_active($id, $active) + { + return Role::find($id)->update(['active' => $active]); + } + + // compte le nombre de formes juridiques + public static function count() + { + return Role::count(); + } + + // récupère toutes les infos sur les formes juridiques + public static function select_all() + { + return Role::all()->toArray(); + } + + public static function select_by_id($id) + { + return Role::find($id)->toArray(); + } + + public static function getWithPermissions($id) + { + $role = Role::find($id)->toArray(); + $role['permissions'] = Role::find($id)->permissions->pluck('id')->toArray(); + return $role; + } + + public static function getAll() + { + return Role::orderBy('name', 'asc')->get(); + } + + public static function getByName($name) + { + return Role::where('name', $name)->first(); + } + + public static function get($id) + { + return Role::find($id); + } + + public static function getTable($id) + { + $datas = Role::orderBy('name', 'asc'); + return Datatables::of($datas)->make(true); + } + + 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 getOptions() + { + return Role::orderBy('name', 'asc')->get()->pluck('name', 'id')->toArray(); + } + + public static function setTranslation($name, $translated) + { + $lang = Translate::getLang(); + $appli = 1; // ContractDrive + $client = 1; // Client + Translations::setTranslation($name, $translated, $lang, $appli, $client); + } + + public static function deleteTranslation($translated) + { + $lang = Translate::getLang(); + $appli = 1; // ContractDrive + $client = 1; // Client + Translations::deleteTranslation($translated, $lang, $appli, $client); + } +} diff --git a/app/Repositories/Teams.php b/app/Repositories/Core/Auth/Teams.php similarity index 92% rename from app/Repositories/Teams.php rename to app/Repositories/Core/Auth/Teams.php index 686aa79b..85b197b0 100644 --- a/app/Repositories/Teams.php +++ b/app/Repositories/Core/Auth/Teams.php @@ -1,15 +1,15 @@ first(); - return $partenaire ? $partenaire->id : null; - } - - public static function getPartenaire($user_id = false) - { - $user_id = $user_id ? $user_id : self::getId(); - return Societe::partenaireByUser($user_id)->first(); - } - - public static function getPromoteurId($user_id = false) - { - $user_id = $user_id ? $user_id : self::getId(); - return Promoteur::byUser($user_id)->first()->id; - } - - public static function getPromoteur($user_id = false) - { - $user_id = $user_id ? $user_id : self::getId(); - return Societe::promoteurByUser($user_id)->first(); - } - public static function getInfo($id = false) { return self::getWithDetail($id); diff --git a/config/activitylog.php b/config/activitylog.php new file mode 100644 index 00000000..a6558ecb --- /dev/null +++ b/config/activitylog.php @@ -0,0 +1,52 @@ + env('ACTIVITY_LOGGER_ENABLED', true), + + /* + * When the clean-command is executed, all recording activities older than + * the number of days specified here will be deleted. + */ + 'delete_records_older_than_days' => 365, + + /* + * If no log name is passed to the activity() helper + * we use this default log name. + */ + 'default_log_name' => 'default', + + /* + * You can specify an auth driver here that gets user models. + * If this is null we'll use the default Laravel auth driver. + */ + 'default_auth_driver' => null, + + /* + * If set to true, the subject returns soft deleted models. + */ + 'subject_returns_soft_deleted_models' => false, + + /* + * This model will be used to log activity. + * It should be implements the Spatie\Activitylog\Contracts\Activity interface + * and extend Illuminate\Database\Eloquent\Model. + */ + 'activity_model' => \Spatie\Activitylog\Models\Activity::class, + + /* + * This is the name of the table that will be created by the migration and + * used by the Activity model shipped with this package. + */ + 'table_name' => 'activity_log', + + /* + * This is the database connection that will be used by the migration and + * the Activity model shipped with this package. In case it's not set + * Laravel database.default will be used instead. + */ + 'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'), +]; diff --git a/config/app.php b/config/app.php index c9960cde..ef681e53 100644 --- a/config/app.php +++ b/config/app.php @@ -67,7 +67,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'Europe/Paris', /* |-------------------------------------------------------------------------- @@ -80,7 +80,7 @@ return [ | */ - 'locale' => 'en', + 'locale' => 'fr', /* |-------------------------------------------------------------------------- diff --git a/config/boilerplate/auth.php b/config/boilerplate/auth.php index 7128a28e..74b9cd02 100644 --- a/config/boilerplate/auth.php +++ b/config/boilerplate/auth.php @@ -6,7 +6,7 @@ return [ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => Sebastienheyd\Boilerplate\Models\User::class, + 'model' => App\Models\Core\Auth\User::class, 'table' => 'users', ], ], diff --git a/config/boilerplate/laratrust.php b/config/boilerplate/laratrust.php index c668b3a5..d10ea08c 100644 --- a/config/boilerplate/laratrust.php +++ b/config/boilerplate/laratrust.php @@ -1,7 +1,7 @@ Sebastienheyd\Boilerplate\Models\User::class, - 'role' => Sebastienheyd\Boilerplate\Models\Role::class, - 'permission' => Sebastienheyd\Boilerplate\Models\Permission::class, + 'user' => App\Models\Core\Auth\User::class, + 'role' => App\Models\Core\Auth\Role::class, + 'permission' => App\Models\Core\Auth\Permission::class, ]; diff --git a/config/googlmapper.php b/config/googlmapper.php new file mode 100644 index 00000000..bf83b98e --- /dev/null +++ b/config/googlmapper.php @@ -0,0 +1,304 @@ + true, + + /* + |-------------------------------------------------------------------------- + | Google API Key + |-------------------------------------------------------------------------- + | + | A Google API key to link Googlmapper to Google's API. + | + */ + 'key' => env('GOOGLE_API_KEY', 'AIzaSyAtqWsq5Ai3GYv6dSa6311tZiYKlbYT4mw'), + + /* + |-------------------------------------------------------------------------- + | Google API version + |-------------------------------------------------------------------------- + | + | A Google API version to use with Googlmapper. + | + */ + 'version' => env('GOOGLE_API_VERSION', 'quarterly'), + + /* + |-------------------------------------------------------------------------- + | Region + |-------------------------------------------------------------------------- + | + | The region Google API should use required in ISO 3166-1 code format. + | + */ + 'region' => 'GB', + + /* + |-------------------------------------------------------------------------- + | Language + |-------------------------------------------------------------------------- + | + | The Language Google API should use required in ISO 639-1 code format. + | + */ + 'language' => 'en-gb', + + /* + |-------------------------------------------------------------------------- + | Asynchronous + |-------------------------------------------------------------------------- + | + | Perform the loading and rendering of Googlmapper map asynchronously. + | + */ + 'async' => false, + + /* + |-------------------------------------------------------------------------- + | Location Marker + |-------------------------------------------------------------------------- + | + | Automatically add a location marker to the provided location for a + | Googlmapper displayed map. + | + */ + 'marker' => true, + + /* + |-------------------------------------------------------------------------- + | Center Map + |-------------------------------------------------------------------------- + | + | Automatically center the Googlmapper displayed map on the provided + | location. + | + */ + 'center' => true, + + /* + |-------------------------------------------------------------------------- + | Locate Users Location + |-------------------------------------------------------------------------- + | + | Automatically center the Googlmapper displayed map on the users current + | location. + | + */ + 'locate' => false, + + /* + |-------------------------------------------------------------------------- + | Default Zoom + |-------------------------------------------------------------------------- + | + | The default zoom level Googlmapper should use. + | + */ + 'zoom' => 8, + + /* + |-------------------------------------------------------------------------- + | Scroll wheel Zoom + |-------------------------------------------------------------------------- + | + | Set if scroll wheel zoom should be used by Googlmapper. + | + */ + 'scrollWheelZoom' => true, + + /* + |-------------------------------------------------------------------------- + | Zoom Control + |-------------------------------------------------------------------------- + | + | Set if zoom control should be displayed by Googlmapper. + | + */ + 'zoomControl' => true, + + /* + |-------------------------------------------------------------------------- + | Map Type Control + |-------------------------------------------------------------------------- + | + | Set if map type control should be displayed by Googlmapper. + | + */ + 'mapTypeControl' => true, + + /* + |-------------------------------------------------------------------------- + | Scale Control + |-------------------------------------------------------------------------- + | + | Set if scale control should be displayed by Googlmapper. + | + */ + 'scaleControl' => false, + + /* + |-------------------------------------------------------------------------- + | Street View Control + |-------------------------------------------------------------------------- + | + | Set if street view control should be displayed by Googlmapper. + | + */ + 'streetViewControl' => true, + + /* + |-------------------------------------------------------------------------- + | Rotate Control + |-------------------------------------------------------------------------- + | + | Set if rotate control should be displayed by Googlmapper. + | + */ + 'rotateControl' => false, + + /* + |-------------------------------------------------------------------------- + | Fullscreen Control + |-------------------------------------------------------------------------- + | + | Set if fullscreen control should be displayed by Googlmapper. + | + */ + 'fullscreenControl' => true, + + /* + |-------------------------------------------------------------------------- + | Map Type + |-------------------------------------------------------------------------- + | + | Set the default Googlmapper displayed map type. (ROADMAP|SATELLITE|HYBRID|TERRAIN) + | + */ + 'type' => 'ROADMAP', + + /* + |-------------------------------------------------------------------------- + | Map UI + |-------------------------------------------------------------------------- + | + | Should the default Googlmapper displayed map UI be shown. + | + */ + 'ui' => true, + + /* + |-------------------------------------------------------------------------- + | Map Marker + |-------------------------------------------------------------------------- + | + | Set the default Googlmapper map marker behaviour. + | + */ + 'markers' => [ + + /* + |-------------------------------------------------------------------------- + | Marker Icon + |-------------------------------------------------------------------------- + | + | Display a custom icon for markers. (Link to an image) + | + */ + 'icon' => '', + + /* + |-------------------------------------------------------------------------- + | Marker Animation + |-------------------------------------------------------------------------- + | + | Display an animation effect for markers. (NONE|DROP|BOUNCE) + | + */ + 'animation' => 'NONE', + + ], + + /* + |-------------------------------------------------------------------------- + | Map Marker Cluster + |-------------------------------------------------------------------------- + | + | Enable default Googlmapper map marker cluster. + | + */ + 'cluster' => true, + + /* + |-------------------------------------------------------------------------- + | Map Marker Cluster + |-------------------------------------------------------------------------- + | + | Set the default Googlmapper map marker cluster behaviour. + | + */ + 'clusters' => [ + + /* + |-------------------------------------------------------------------------- + | Cluster Icon + |-------------------------------------------------------------------------- + | + | Display custom images for clusters using icon path. (Link to an image path) + | + */ + 'icon' => '//googlearchive.github.io/js-marker-clusterer/images/m', + + /* + |-------------------------------------------------------------------------- + | Cluster Size + |-------------------------------------------------------------------------- + | + | The grid size of a cluster in pixels. + | + */ + 'grid' => 60, + + /* + |-------------------------------------------------------------------------- + | Cluster Zoom + |-------------------------------------------------------------------------- + | + | The maximum zoom level that a marker can be part of a cluster. + | + */ + 'zoom' => null, + + /* + |-------------------------------------------------------------------------- + | Cluster Center + |-------------------------------------------------------------------------- + | + | Whether the center of each cluster should be the average of all markers + | in the cluster. + | + */ + 'center' => false, + + /* + |-------------------------------------------------------------------------- + | Cluster Size + |-------------------------------------------------------------------------- + | + | The minimum number of markers to be in a cluster before the markers are + | hidden and a count is shown. + | + */ + 'size' => 2 + + ], + +]; diff --git a/database/migrations/2020_03_24_211342_create_media_table.php b/database/migrations/2020_03_28_223351_create_media_table.php similarity index 100% rename from database/migrations/2020_03_24_211342_create_media_table.php rename to database/migrations/2020_03_28_223351_create_media_table.php diff --git a/database/migrations/2020_03_24_211342_teamwork_setup_tables.php b/database/migrations/2020_03_28_223351_teamwork_setup_tables.php similarity index 100% rename from database/migrations/2020_03_24_211342_teamwork_setup_tables.php rename to database/migrations/2020_03_28_223351_teamwork_setup_tables.php diff --git a/database/migrations/2020_03_29_100655_create_activity_log_table.php b/database/migrations/2020_03_29_100655_create_activity_log_table.php new file mode 100644 index 00000000..4f0f9432 --- /dev/null +++ b/database/migrations/2020_03_29_100655_create_activity_log_table.php @@ -0,0 +1,38 @@ +create(config('activitylog.table_name'), function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('log_name')->nullable(); + $table->text('description'); + $table->unsignedBigInteger('subject_id')->nullable(); + $table->string('subject_type')->nullable(); + $table->unsignedBigInteger('causer_id')->nullable(); + $table->string('causer_type')->nullable(); + $table->json('properties')->nullable(); + $table->timestamps(); + + $table->index('log_name'); + $table->index(['subject_id', 'subject_type'], 'subject'); + $table->index(['causer_id', 'causer_type'], 'causer'); + }); + } + + /** + * Reverse the migrations. + */ + public function down() + { + Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name')); + } +} diff --git a/resources/_back/auth/firstlogin.blade.php b/resources/_back/auth/firstlogin.blade.php new file mode 100644 index 00000000..7685c3bb --- /dev/null +++ b/resources/_back/auth/firstlogin.blade.php @@ -0,0 +1,42 @@ +@extends('boilerplate::auth.layout', [ + 'title' => __('boilerplate::auth.firstlogin.title'), + 'bodyClass' => 'hold-transition login-page' +]) + +@section('content') + @component('boilerplate::auth.loginbox') + {{ Form::open(['route' => 'boilerplate.users.firstlogin', 'autocomplete' => 'off']) }} + +
+ {{ __('boilerplate::auth.firstlogin.intro') }} +
+
+
+ {{ Form::input('password', 'password', Request::old('password'), ['class' => 'form-control'.$errors->first('password', ' is-invalid'), 'autofocus', 'placeholder' => __('boilerplate::auth.fields.password')]) }} +
+
+ +
+
+
+ {!! $errors->first('password','
:message
') !!} +
+
+
+ {{ Form::input('password', 'password_confirmation', Request::old('password_confirmation'), ['class' => 'form-control'.$errors->first('password_confirmation', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password_confirm')]) }} +
+
+ +
+
+
+ {!! $errors->first('password_confirmation','
:message
') !!} +
+
+ +
+ + @endcomponent +@endsection diff --git a/resources/_back/auth/layout.blade.php b/resources/_back/auth/layout.blade.php new file mode 100644 index 00000000..679a8723 --- /dev/null +++ b/resources/_back/auth/layout.blade.php @@ -0,0 +1,15 @@ + + + + + + + + + {{ $title }} | {{ config('app.name') }} + + + + @yield('content') + + \ No newline at end of file diff --git a/resources/_back/auth/login.blade.php b/resources/_back/auth/login.blade.php new file mode 100644 index 00000000..067d6945 --- /dev/null +++ b/resources/_back/auth/login.blade.php @@ -0,0 +1,55 @@ +@extends('boilerplate::auth.layout', [ + 'title' => __('boilerplate::auth.login.title'), + 'bodyClass' => 'hold-transition login-page' +]) + +@section('content') + @component('boilerplate::auth.loginbox') +

{{ __('boilerplate::auth.login.intro') }}

+ {!! Form::open(['route' => 'boilerplate.login', 'method' => 'post', 'autocomplete'=> 'off']) !!} +
+
+ {{ Form::email('email', old('email'), ['class' => 'form-control'.$errors->first('email', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }} +
+
+ +
+
+
+ {!! $errors->first('email','
:message
') !!} +
+
+
+ {{ Form::password('password', ['class' => 'form-control'.$errors->first('password', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('password','
:message
') !!} +
+
+
+
+ + +
+
+
+ +
+
+ {!! Form::close() !!} +

+ {{ __('boilerplate::auth.login.forgotpassword') }}
+

+ @if(config('boilerplate.auth.register')) +

+ {{ __('boilerplate::auth.login.register') }} +

+ @endif + @endcomponent +@endsection diff --git a/resources/_back/auth/loginbox.blade.php b/resources/_back/auth/loginbox.blade.php new file mode 100644 index 00000000..b628fd70 --- /dev/null +++ b/resources/_back/auth/loginbox.blade.php @@ -0,0 +1,12 @@ +
+ + +
+ +
+
diff --git a/resources/_back/auth/passwords/email.blade.php b/resources/_back/auth/passwords/email.blade.php new file mode 100644 index 00000000..a7a3a68c --- /dev/null +++ b/resources/_back/auth/passwords/email.blade.php @@ -0,0 +1,44 @@ +@extends('boilerplate::auth.layout', ['title' => __('boilerplate::auth.password.title'), 'bodyClass' => 'hold-transition login-page']) + +@section('content') + @component('boilerplate::auth.loginbox') +

{{ __('boilerplate::auth.password.intro') }}

+ @if (session('status')) +
+ + {{ session('status') }} +
+ @else + {!! Form::open(['route' => 'boilerplate.password.email', 'method' => 'post', 'autocomplete'=> 'off']) !!} +
+
+ {{ Form::email('email', old('email'), ['class' => 'form-control'.$errors->first('email', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }} +
+
+ +
+
+
+ {!! $errors->first('email','
:message
') !!} +
+
+
+
+ +
+
+
+ {!! Form::close() !!} + @endif +

+ {{ __('boilerplate::auth.password.login_link') }} +

+ @if(config('boilerplate.auth.register')) +

+ {{ __('boilerplate::auth.login.register') }} +

+ @endif + @endcomponent +@endsection diff --git a/resources/_back/auth/passwords/reset.blade.php b/resources/_back/auth/passwords/reset.blade.php new file mode 100644 index 00000000..9dd900b5 --- /dev/null +++ b/resources/_back/auth/passwords/reset.blade.php @@ -0,0 +1,48 @@ +@extends('boilerplate::auth.layout', ['title' => __('boilerplate::auth.password_reset.title')]) + +@section('content') + @component('boilerplate::auth.loginbox') +

{{ __('boilerplate::auth.password_reset.intro') }}

+ {!! Form::open(['route' => 'boilerplate.password.reset.post', 'method' => 'post', 'autocomplete'=> 'off']) !!} + {!! Form::hidden('token', $token) !!} +
+
+ {{ Form::email('email', old('email', $email), ['class' => 'form-control'.$errors->first('email', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.email'), 'required', 'autofocus']) }} +
+
+ +
+
+
+ {!! $errors->first('email','
:message
') !!} +
+
+
+ {{ Form::password('password', ['class' => 'form-control'.$errors->first('password', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('password','
:message
') !!} +
+
+
+ {{ Form::password('password_confirmation', ['class' => 'form-control'.$errors->first('password_confirmation', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password_confirm'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('password_confirmation','
:message
') !!} +
+
+
+ +
+
+ {!! Form::close() !!} + @endcomponent +@endsection diff --git a/resources/_back/auth/register.blade.php b/resources/_back/auth/register.blade.php new file mode 100644 index 00000000..ed0e589d --- /dev/null +++ b/resources/_back/auth/register.blade.php @@ -0,0 +1,76 @@ +@extends('boilerplate::auth.layout', ['title' => __('boilerplate::auth.register.title'), 'bodyClass' => 'hold-transition login-page']) + +@section('content') + @component('boilerplate::auth.loginbox') +

{{ __('boilerplate::auth.register.intro') }}

+ {!! Form::open(['route' => 'boilerplate.register', 'method' => 'post', 'autocomplete'=> 'off']) !!} +
+
+ {{ Form::text('first_name', old('first_name'), ['class' => 'form-control'.$errors->first('first_name', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.first_name'), 'required', 'autofocus']) }} +
+
+ +
+
+
+ {!! $errors->first('first_name','
:message
') !!} +
+
+
+ {{ Form::text('last_name', old('last_name'), ['class' => 'form-control'.$errors->first('last_name', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.last_name'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('last_name','
:message
') !!} +
+
+
+ {{ Form::email('email', old('email'), ['class' => 'form-control'.$errors->first('email', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.email'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('email','
:message
') !!} +
+
+
+ {{ Form::password('password', ['class' => 'form-control'.$errors->first('password', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('password','
:message
') !!} +
+
+
+ {{ Form::password('password_confirmation', ['class' => 'form-control'.$errors->first('password_confirmation', ' is-invalid'), 'placeholder' => __('boilerplate::auth.fields.password_confirm'), 'required']) }} +
+
+ +
+
+
+ {!! $errors->first('password_confirmation','
:message
') !!} +
+
+
+ +
+
+ {!! Form::close() !!} + @if(!$firstUser) +

+ {{ __('boilerplate::auth.register.login_link') }}
+

+ @endif + @endcomponent +@endsection diff --git a/resources/_back/auth/verify.blade.php b/resources/_back/auth/verify.blade.php new file mode 100644 index 00000000..c742cb4b --- /dev/null +++ b/resources/_back/auth/verify.blade.php @@ -0,0 +1,24 @@ +@extends('layouts.app') + +@section('content') +
+
+
+
+
{{ __('Verify Your Email Address') }}
+ +
+ @if (session('resent')) + + @endif + + {{ __('Before proceeding, please check your email for a verification link.') }} + {{ __('If you did not receive the email') }}, {{ __('click here to request another') }}. +
+
+
+
+
+@endsection diff --git a/resources/lang/fr/shop.php b/resources/lang/fr/shop.php new file mode 100644 index 00000000..4b8963b9 --- /dev/null +++ b/resources/lang/fr/shop.php @@ -0,0 +1,32 @@ + 'Résidences', + 'name' => 'Référence', + 'parameters' => 'Paramètres', + 'label' => 'Libellé', + 'description' => 'Description', + 'savebutton' => 'Enregistrer', + 'sections' => [ + 'title' => 'Gestion des catégories', + 'description' => 'Gérer les catégories', + 'add' => 'Ajouter une catégorie', + 'edit' => 'Editer une catégorie', + 'del' => 'Effacer une catégorie', + 'list' => [ + 'title' => 'Liste des catégories', + ], + 'successadd' => 'La catégorie a été correctement ajoutée', + 'successmod' => 'La catégorie a été correctement modifiée', + 'successdel' => 'La catégorie a été correctement effacée', + 'confirmdelete' => 'Confirmez-vous la suppression de la catégorie ?', + ], + 'products' => [ + 'title' => 'Gestion des produits', + 'description' => 'Gérer les produits', + ], + 'customers' => [ + 'title' => "Gestion des clients", + 'description' => 'Gérer les clients', + ], +]; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index e7f4856a..036977d8 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -3,6 +3,8 @@ 'bodyClass' => 'hold-transition login-page' ]) +@include('boilerplate::load.icheck') + @prepend('js') @include('components.js.ie11') @include('components.js', ['js' => '/js/main.min.js']) diff --git a/resources/views/components/button-save.blade.php b/resources/views/components/button-save.blade.php index 467e0889..5cb4e756 100644 --- a/resources/views/components/button-save.blade.php +++ b/resources/views/components/button-save.blade.php @@ -1,3 +1,3 @@ - \ No newline at end of file diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 46aa40ed..c435acbe 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,7 +1,7 @@ @extends('layouts.site', [ - 'title' => 'Banques', - 'subtitle' => 'Liste des banques', - 'breadcrumb' => ['Banques'] + 'title' => 'Accueil', + 'subtitle' => '', + 'breadcrumb' => ['Accueil'] ]) @section('content') diff --git a/resources/views/layout/contentheader.blade.php b/resources/views/layout/contentheader.blade.php index c67f7117..9fc9fa4b 100644 --- a/resources/views/layout/contentheader.blade.php +++ b/resources/views/layout/contentheader.blade.php @@ -1,24 +1,34 @@ -

- {{ $title }} - @if(isset($subtitle)) - {{ $subtitle }} - @endif -

- \ No newline at end of file +
+
+
+
+

+ {{ $title }} + @if(isset($subtitle)) + {{ $subtitle }} + @endif +

+
+
+ +
+
+
+
diff --git a/resources/views/layout/footer.blade.php b/resources/views/layout/footer.blade.php index e68d348a..77ae6031 100644 --- a/resources/views/layout/footer.blade.php +++ b/resources/views/layout/footer.blade.php @@ -1,12 +1,18 @@ -