├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── README.md ├── app ├── Asset.php ├── AssetGroup.php ├── Console │ └── Kernel.php ├── Document.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Admin │ │ │ ├── AssetController.php │ │ │ ├── AssetGroupController.php │ │ │ ├── DocumentController.php │ │ │ ├── ImageController.php │ │ │ ├── NoteController.php │ │ │ ├── ProfileController.php │ │ │ ├── RoleController.php │ │ │ ├── TenantController.php │ │ │ └── UserController.php │ │ ├── Auth │ │ │ ├── ConfirmPasswordController.php │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── PasswordController.php │ │ │ ├── RegisterController.php │ │ │ ├── ResetPasswordController.php │ │ │ └── VerificationController.php │ │ ├── Controller.php │ │ ├── HomeController.php │ │ ├── TenantController.php │ │ └── Traits │ │ │ └── MediaUploadingTrait.php │ ├── Kernel.php │ ├── Middleware │ │ ├── AuthGates.php │ │ ├── Authenticate.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── CheckForPassword.php │ │ ├── CheckForSuspension.php │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php │ └── Requests │ │ ├── StoreAssetGroupRequest.php │ │ ├── StoreAssetRequest.php │ │ ├── StoreDocumentRequest.php │ │ ├── StoreImageRequest.php │ │ ├── StoreNoteRequest.php │ │ ├── StorePasswordRequest.php │ │ ├── StoreRoleRequest.php │ │ ├── StoreTenantRequest.php │ │ ├── StoreUserRequest.php │ │ ├── UpdateAssetGroupRequest.php │ │ ├── UpdateAssetRequest.php │ │ ├── UpdateDocumentRequest.php │ │ ├── UpdateImageRequest.php │ │ ├── UpdateNoteRequest.php │ │ ├── UpdateProfileRequest.php │ │ ├── UpdateRoleRequest.php │ │ ├── UpdateTenantRequest.php │ │ └── UpdateUserRequest.php ├── Image.php ├── Note.php ├── Notifications │ ├── TenantInvitation.php │ └── UserInvitation.php ├── Permission.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Role.php ├── Traits │ ├── MultiTenantAssetTrait.php │ ├── MultiTenantRoleTrait.php │ └── MultiTenantUserTrait.php └── User.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2020_07_17_091720_add_relationship_field_to_users_table.php │ ├── 2020_07_20_062422_create_roles_table.php │ ├── 2020_07_20_062705_create_permissions_table.php │ ├── 2020_07_20_062808_create_permission_role_pivot_table.php │ ├── 2020_07_20_070323_create_role_user_pivot_table.php │ ├── 2020_07_22_173741_create_asset_groups_table.php │ ├── 2020_07_22_174237_add_relationship_field_to_asset_groups_table.php │ ├── 2020_07_23_155342_create_assets_table.php │ ├── 2020_07_27_113121_create_media_table.php │ ├── 2020_07_27_115009_create_images_table.php │ ├── 2020_07_27_115021_create_documents_table.php │ └── 2020_07_27_115028_create_notes_table.php └── seeds │ ├── DatabaseSeeder.php │ ├── PermissionRoleTableSeeder.php │ ├── PermissionsTableSeeder.php │ ├── RoleUserTableSeeder.php │ ├── RolesTableSeeder.php │ └── UsersTableSeeder.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ └── app.css ├── favicon.ico ├── index.php ├── js │ ├── app.js │ └── app.js.LICENSE.txt ├── mix-manifest.json └── robots.txt ├── resources ├── js │ ├── app.js │ ├── bootstrap.js │ └── components │ │ └── ExampleComponent.vue ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── sass │ ├── _variables.scss │ └── app.scss └── views │ ├── admin │ ├── assetGroups │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── assets │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ ├── relationships │ │ │ ├── documents.blade.php │ │ │ ├── images.blade.php │ │ │ └── notes.blade.php │ │ └── show.blade.php │ ├── documents │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── images │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── notes │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── profile.blade.php │ ├── roles │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── tenants │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ └── users │ │ ├── create.blade.php │ │ ├── edit.blade.php │ │ ├── index.blade.php │ │ └── show.blade.php │ ├── auth │ ├── login.blade.php │ ├── password.blade.php │ ├── passwords │ │ ├── confirm.blade.php │ │ ├── email.blade.php │ │ └── reset.blade.php │ ├── register.blade.php │ └── verify.blade.php │ ├── home.blade.php │ ├── layouts │ ├── app.blade.php │ └── auth.blade.php │ └── partials │ ├── datatableActions.blade.php │ └── menu.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── logs │ └── .gitignore └── tmp │ └── uploads │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=laravel 13 | DB_USERNAME=root 14 | DB_PASSWORD= 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_MAILER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | MAIL_FROM_ADDRESS=null 33 | MAIL_FROM_NAME="${APP_NAME}" 34 | 35 | AWS_ACCESS_KEY_ID= 36 | AWS_SECRET_ACCESS_KEY= 37 | AWS_DEFAULT_REGION=us-east-1 38 | AWS_BUCKET= 39 | 40 | PUSHER_APP_ID= 41 | PUSHER_APP_KEY= 42 | PUSHER_APP_SECRET= 43 | PUSHER_APP_CLUSTER=mt1 44 | 45 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 46 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 47 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | /.idea 7 | .env 8 | .env.backup 9 | .phpunit.result.cache 10 | Homestead.json 11 | Homestead.yaml 12 | npm-debug.log 13 | yarn-error.log 14 | -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | disabled: 4 | - unused_use 5 | finder: 6 | not-name: 7 | - index.php 8 | - server.php 9 | js: 10 | finder: 11 | not-name: 12 | - webpack.mix.js 13 | css: true 14 | -------------------------------------------------------------------------------- /app/Asset.php: -------------------------------------------------------------------------------- 1 | belongsTo(AssetGroup::class, 'sub_group_id'); 25 | } 26 | 27 | public function images() 28 | { 29 | return $this->hasMany(Image::class); 30 | } 31 | 32 | public function documents() 33 | { 34 | return $this->hasMany(Document::class); 35 | } 36 | 37 | public function notes() 38 | { 39 | return $this->hasMany(Note::class); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/AssetGroup.php: -------------------------------------------------------------------------------- 1 | belongsTo(self::class, 'parent_id'); 25 | } 26 | 27 | public function children() 28 | { 29 | return $this->hasMany(self::class, 'parent_id'); 30 | } 31 | 32 | public function tenant() 33 | { 34 | return $this->belongsTo(User::class, 'tenant_id'); 35 | } 36 | 37 | public function assets() 38 | { 39 | return $this->hasMany(Asset::class, 'sub_group_id'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 28 | } 29 | 30 | /** 31 | * Register the commands for the application. 32 | * 33 | * @return void 34 | */ 35 | protected function commands() 36 | { 37 | $this->load(__DIR__.'/Commands'); 38 | 39 | require base_path('routes/console.php'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Document.php: -------------------------------------------------------------------------------- 1 | getMedia('document')->last(); 26 | } 27 | 28 | public function tenant() 29 | { 30 | return $this->belongsTo(User::class, 'tenant_id'); 31 | } 32 | 33 | public function asset() 34 | { 35 | return $this->belongsTo(Asset::class); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | user(); 21 | 22 | return view('admin.profile', compact('user')); 23 | } 24 | 25 | /** 26 | * Update profile. 27 | * 28 | * @param UpdateProfileRequest $request 29 | * @return \Illuminate\Http\Response 30 | */ 31 | public function update(UpdateProfileRequest $request) 32 | { 33 | $data = [ 34 | 'name' => $request->input('name'), 35 | ]; 36 | 37 | if ($request->input('password')) { 38 | $data['password'] = Hash::make($request->input('password')); 39 | } 40 | 41 | auth()->user()->update($data); 42 | 43 | return redirect()->back()->withMessage('Profile has been updated successfully'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest')->except('logout'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 14 | } 15 | 16 | /** 17 | * Show the form for setting a password. 18 | * 19 | * @return \Illuminate\Http\Response 20 | */ 21 | public function create() 22 | { 23 | if (auth()->user()->password) { 24 | return redirect()->route('home'); 25 | } 26 | 27 | return view('auth.password'); 28 | } 29 | 30 | /** 31 | * Store a password of user. 32 | * 33 | * @param StorePasswordRequest $request 34 | * @return \Illuminate\Http\RedirectResponse 35 | */ 36 | public function store(StorePasswordRequest $request) 37 | { 38 | $redirect = redirect()->route('home'); 39 | $user = auth()->user(); 40 | 41 | if (!$user->password) { 42 | $user->update([ 43 | 'password' => Hash::make($request->password) 44 | ]); 45 | 46 | $redirect->withMessage('Password has been set successfully'); 47 | } 48 | 49 | return $redirect; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 42 | } 43 | 44 | /** 45 | * Get a validator for an incoming registration request. 46 | * 47 | * @param array $data 48 | * @return \Illuminate\Contracts\Validation\Validator 49 | */ 50 | protected function validator(array $data) 51 | { 52 | return Validator::make($data, [ 53 | 'name' => ['required', 'string', 'max:255'], 54 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'], 55 | 'password' => ['required', 'string', 'min:8', 'confirmed'], 56 | ]); 57 | } 58 | 59 | /** 60 | * Create a new user instance after a valid registration. 61 | * 62 | * @param array $data 63 | * @return \App\User 64 | */ 65 | protected function create(array $data) 66 | { 67 | return User::create([ 68 | 'name' => $data['name'], 69 | 'email' => $data['email'], 70 | 'password' => Hash::make($data['password']), 71 | ]); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 39 | $this->middleware('signed')->only('verify'); 40 | $this->middleware('throttle:6,1')->only('verify', 'resend'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 17 | } 18 | 19 | /** 20 | * Show the application dashboard. 21 | * 22 | * @return \Illuminate\Contracts\Support\Renderable 23 | */ 24 | public function index() 25 | { 26 | return view('home'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/TenantController.php: -------------------------------------------------------------------------------- 1 | to('/home'); 18 | } 19 | 20 | /** 21 | * Tenant invitation 22 | * 23 | * @param User $user 24 | * @return \Illuminate\Http\RedirectResponse 25 | */ 26 | public function invitation(User $user) 27 | { 28 | if (!request()->hasValidSignature() || $user->password) { 29 | abort(401); 30 | } 31 | 32 | auth()->login($user); 33 | 34 | return redirect()->route('home'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Http/Controllers/Traits/MediaUploadingTrait.php: -------------------------------------------------------------------------------- 1 | has('size')) { 13 | $this->validate(request(), [ 14 | 'file' => 'max:' . request()->input('size') * 1024, 15 | ]); 16 | } 17 | 18 | // If width or height is preset - we are validating it as an image 19 | if (request()->has('width') || request()->has('height')) { 20 | $this->validate(request(), [ 21 | 'file' => sprintf( 22 | 'image|dimensions:max_width=%s,max_height=%s', 23 | request()->input('width', 100000), 24 | request()->input('height', 100000) 25 | ), 26 | ]); 27 | } 28 | 29 | $path = storage_path('tmp/uploads'); 30 | 31 | try { 32 | if (!file_exists($path)) { 33 | mkdir($path, 0755, true); 34 | } 35 | } catch (\Exception $e) { 36 | } 37 | 38 | $file = $request->file('file'); 39 | 40 | $name = uniqid() . '_' . trim($file->getClientOriginalName()); 41 | 42 | $file->move($path, $name); 43 | 44 | return response()->json([ 45 | 'name' => $name, 46 | 'original_name' => $file->getClientOriginalName(), 47 | ]); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 36 | \App\Http\Middleware\EncryptCookies::class, 37 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 38 | \Illuminate\Session\Middleware\StartSession::class, 39 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 40 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 41 | \App\Http\Middleware\VerifyCsrfToken::class, 42 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 43 | CheckForPassword::class, 44 | CheckForSuspension::class, 45 | AuthGates::class, 46 | ], 47 | 48 | 'api' => [ 49 | 'throttle:60,1', 50 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 51 | ], 52 | ]; 53 | 54 | /** 55 | * The application's route middleware. 56 | * 57 | * These middleware may be assigned to groups or used individually. 58 | * 59 | * @var array 60 | */ 61 | protected $routeMiddleware = [ 62 | 'auth' => \App\Http\Middleware\Authenticate::class, 63 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 64 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 65 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 66 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 67 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 68 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 69 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 70 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 71 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 72 | ]; 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Middleware/AuthGates.php: -------------------------------------------------------------------------------- 1 | with('permissions')->get(); 17 | $permissionsArray = []; 18 | 19 | foreach ($roles as $role) { 20 | foreach ($role->permissions as $permissions) { 21 | $permissionsArray[$permissions->title][] = $role->id; 22 | } 23 | } 24 | 25 | foreach ($permissionsArray as $title => $roles) { 26 | Gate::define($title, function (\App\User $user) use ($roles) { 27 | $user->load(['roles' => function ($query) { 28 | $query->withoutGlobalScopes(); 29 | }]); 30 | return count(array_intersect($user->roles->pluck('id')->toArray(), $roles)) > 0; 31 | }); 32 | } 33 | } 34 | 35 | return $next($request); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForMaintenanceMode.php: -------------------------------------------------------------------------------- 1 | check() && !auth()->user()->password && !$request->is('password')) { 20 | return redirect()->route('password.create'); 21 | } 22 | 23 | return $next($request); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Middleware/CheckForSuspension.php: -------------------------------------------------------------------------------- 1 | check() && auth()->user()->is_suspended) { 19 | auth()->logout(); 20 | 21 | return redirect()->route('login')->withError('Your account is suspended.'); 22 | } 23 | 24 | return $next($request); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | return redirect(RouteServiceProvider::HOME); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 'string', 34 | ], 35 | 'parent_id' => [ 36 | 'nullable', 'integer', 'in:' . AssetGroup::whereNull('parent_id')->pluck('id')->implode(',') 37 | ], 38 | ]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreAssetRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 'string', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'serial_number' => [ 39 | 'nullable', 'string', 40 | ], 41 | 'price' => [ 42 | 'nullable', 'numeric', 'min:0', 43 | ], 44 | 'warranty_expiry_date' => [ 45 | 'nullable', 'date', 46 | ], 47 | 'sub_group_id' => [ 48 | 'required', 'integer', 'in:' . AssetGroup::whereNotNull('parent_id')->pluck('id')->implode(','), 49 | ], 50 | ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreDocumentRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'asset_id' => [ 39 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreImageRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'asset_id' => [ 39 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreNoteRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'nullable', 'string', 34 | ], 35 | 'asset_id' => [ 36 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 37 | ], 38 | ]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Requests/StorePasswordRequest.php: -------------------------------------------------------------------------------- 1 | [ 28 | 'string', 'min:8', 'confirmed', 29 | ], 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreRoleRequest.php: -------------------------------------------------------------------------------- 1 | findOrFail(3) 33 | ->permissions() 34 | ->pluck('id'); 35 | 36 | return [ 37 | 'title' => [ 38 | 'required', 'string', 39 | ], 40 | 'permissions' => [ 41 | 'array', 42 | ], 43 | 'permissions.*' => [ 44 | 'integer', 'in:' . $permissions->implode(','), 45 | ], 46 | ]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreTenantRequest.php: -------------------------------------------------------------------------------- 1 | [ 32 | 'required', 33 | ], 34 | 'email' => [ 35 | 'required', 'email', 'unique:users', 36 | ], 37 | 'domain' => [ 38 | 'required', 'alpha_num', 'unique:users', 39 | ], 40 | ]; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreUserRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 'string', 34 | ], 35 | 'email' => [ 36 | 'required', 'email', 'unique:users', 37 | ], 38 | 'role_id' => [ 39 | 'integer', 'in:' . Role::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateAssetGroupRequest.php: -------------------------------------------------------------------------------- 1 | where('id', '!=', $this->route('asset_group')->id) 33 | ->pluck('id') 34 | ->implode(','); 35 | 36 | return [ 37 | 'name' => [ 38 | 'required', 'string', 39 | ], 40 | 'parent_id' => [ 41 | 'nullable', 'integer', 'in:' . $availableGroups, 42 | ], 43 | ]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateAssetRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 'string', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'serial_number' => [ 39 | 'nullable', 'string', 40 | ], 41 | 'price' => [ 42 | 'nullable', 'numeric', 'min:0', 43 | ], 44 | 'warranty_expiry_date' => [ 45 | 'nullable', 'date', 46 | ], 47 | 'sub_group_id' => [ 48 | 'required', 'integer', 'in:' . AssetGroup::whereNotNull('parent_id')->pluck('id')->implode(','), 49 | ], 50 | ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateDocumentRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'asset_id' => [ 39 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateImageRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 34 | ], 35 | 'description' => [ 36 | 'nullable', 'string', 37 | ], 38 | 'asset_id' => [ 39 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateNoteRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'nullable', 'string', 34 | ], 35 | 'asset_id' => [ 36 | 'required', 'integer', 'in:' . Asset::pluck('id')->implode(','), 37 | ], 38 | ]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateProfileRequest.php: -------------------------------------------------------------------------------- 1 | [ 28 | 'required', 29 | ], 30 | 'password' => [ 31 | 'nullable', 'min:8', 'confirmed', 32 | ], 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateRoleRequest.php: -------------------------------------------------------------------------------- 1 | findOrFail(3) 33 | ->permissions() 34 | ->pluck('id'); 35 | 36 | return [ 37 | 'title' => [ 38 | 'required', 'string', 39 | ], 40 | 'permissions' => [ 41 | 'array', 42 | ], 43 | 'permissions.*' => [ 44 | 'integer', 'in:' . $permissions->implode(','), 45 | ], 46 | ]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateTenantRequest.php: -------------------------------------------------------------------------------- 1 | [ 32 | 'required', 'string', 33 | ], 34 | 'email' => [ 35 | 'required', 'email', 'unique:users,email,' . request()->route('tenant'), 36 | ], 37 | 'domain' => [ 38 | 'required', 'alpha_num', 'unique:users,domain,' . request()->route('tenant'), 39 | ], 40 | ]; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateUserRequest.php: -------------------------------------------------------------------------------- 1 | [ 33 | 'required', 'string', 34 | ], 35 | 'email' => [ 36 | 'required', 'email', 'unique:users,email,' . request()->route('user'), 37 | ], 38 | 'role_id' => [ 39 | 'integer', 'in:' . Role::pluck('id')->implode(','), 40 | ], 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Image.php: -------------------------------------------------------------------------------- 1 | addMediaConversion('thumb')->fit('crop', 50, 50); 27 | $this->addMediaConversion('preview')->fit('crop', 120, 120); 28 | } 29 | 30 | public function getImageAttribute() 31 | { 32 | $file = $this->getMedia('image')->last(); 33 | 34 | if ($file) { 35 | $file->url = $file->getUrl(); 36 | $file->thumbnail = $file->getUrl('thumb'); 37 | $file->preview = $file->getUrl('preview'); 38 | } 39 | 40 | return $file; 41 | } 42 | 43 | public function tenant() 44 | { 45 | return $this->belongsTo(User::class, 'tenant_id'); 46 | } 47 | 48 | public function asset() 49 | { 50 | return $this->belongsTo(Asset::class); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Note.php: -------------------------------------------------------------------------------- 1 | belongsTo(User::class, 'tenant_id'); 20 | } 21 | 22 | public function asset() 23 | { 24 | return $this->belongsTo(Asset::class); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Notifications/TenantInvitation.php: -------------------------------------------------------------------------------- 1 | url = $url; 24 | } 25 | 26 | /** 27 | * Get the notification's delivery channels. 28 | * 29 | * @param mixed $notifiable 30 | * @return array 31 | */ 32 | public function via($notifiable) 33 | { 34 | return ['mail']; 35 | } 36 | 37 | /** 38 | * Get the mail representation of the notification. 39 | * 40 | * @param mixed $notifiable 41 | * @return \Illuminate\Notifications\Messages\MailMessage 42 | */ 43 | public function toMail($notifiable) 44 | { 45 | return (new MailMessage) 46 | ->line('You have been invited as a tenant!') 47 | ->action('Accept Invitation', $this->url) 48 | ->line('Thank you for using our application!'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Notifications/UserInvitation.php: -------------------------------------------------------------------------------- 1 | url = $url; 24 | } 25 | 26 | /** 27 | * Get the notification's delivery channels. 28 | * 29 | * @param mixed $notifiable 30 | * @return array 31 | */ 32 | public function via($notifiable) 33 | { 34 | return ['mail']; 35 | } 36 | 37 | /** 38 | * Get the mail representation of the notification. 39 | * 40 | * @param mixed $notifiable 41 | * @return \Illuminate\Notifications\Messages\MailMessage 42 | */ 43 | public function toMail($notifiable) 44 | { 45 | return (new MailMessage) 46 | ->line('You have been invited as an user!') 47 | ->action('Accept Invitation', $this->url) 48 | ->line('Thank you for using our application!'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Permission.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | parent::boot(); 31 | 32 | // 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 46 | 47 | $this->mapWebRoutes(); 48 | 49 | // 50 | } 51 | 52 | /** 53 | * Define the "web" routes for the application. 54 | * 55 | * These routes all receive session state, CSRF protection, etc. 56 | * 57 | * @return void 58 | */ 59 | protected function mapWebRoutes() 60 | { 61 | Route::middleware('web') 62 | ->namespace($this->namespace) 63 | ->group(base_path('routes/web.php')); 64 | } 65 | 66 | /** 67 | * Define the "api" routes for the application. 68 | * 69 | * These routes are typically stateless. 70 | * 71 | * @return void 72 | */ 73 | protected function mapApiRoutes() 74 | { 75 | Route::prefix('api') 76 | ->middleware('api') 77 | ->namespace($this->namespace) 78 | ->group(base_path('routes/api.php')); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/Role.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Permission::class); 20 | } 21 | 22 | public function tenant() 23 | { 24 | return $this->belongsTo(User::class, 'tenant_id'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Traits/MultiTenantAssetTrait.php: -------------------------------------------------------------------------------- 1 | runningInConsole() && auth()->check()) { 13 | $user = auth()->user(); 14 | static::creating(function ($model) use ($user) { 15 | $model->tenant_id = $user->tenant_id ?? $user->id; 16 | }); 17 | static::addGlobalScope('asset_tenant_id', function (Builder $builder) use ($user) { 18 | $builder->where('tenant_id', $user->tenant_id ?? $user->id); 19 | }); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Traits/MultiTenantRoleTrait.php: -------------------------------------------------------------------------------- 1 | runningInConsole() && auth()->check() && request()->is('admin/roles*', 'admin/users*')) { 13 | $user = auth()->user(); 14 | static::creating(function ($model) use ($user) { 15 | $model->tenant_id = $user->id; 16 | }); 17 | if ($user->is_tenant_admin) { 18 | static::addGlobalScope('role_tenant_id', function (Builder $builder) use ($user) { 19 | $builder->where('tenant_id', $user->id) 20 | ->when(request()->is('admin/users*'), function ($query) { 21 | $query->orWhere('id', 3); 22 | }); 23 | }); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Traits/MultiTenantUserTrait.php: -------------------------------------------------------------------------------- 1 | runningInConsole() && auth()->check() && request()->is('admin/users*')) { 13 | $user = auth()->user(); 14 | static::creating(function ($model) use ($user) { 15 | $model->tenant_id = $user->id; 16 | }); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/User.php: -------------------------------------------------------------------------------- 1 | 'datetime', 41 | ]; 42 | 43 | protected $cascadeDeletes = [ 44 | 'tenantUsers', 'roles', 'assetGroups', 45 | ]; 46 | 47 | protected $with = [ 48 | 'roles', 49 | ]; 50 | 51 | protected static function booted() 52 | { 53 | static::deleting(function ($user) { 54 | if ($user->domain) { 55 | $user->update([ 56 | 'domain' => $user->domain . '-deleted-' . time() 57 | ]); 58 | } 59 | }); 60 | } 61 | 62 | public function getIsAdminAttribute() 63 | { 64 | return $this->roles()->withoutGlobalScopes()->whereId(1)->exists(); 65 | } 66 | 67 | public function getIsTenantAdminAttribute() 68 | { 69 | return $this->roles()->withoutGlobalScopes()->whereId(2)->exists(); 70 | } 71 | 72 | public function getIsTenantUserAttribute() 73 | { 74 | return $this->roles()->withoutGlobalScopes()->whereId(3)->exists(); 75 | } 76 | 77 | public function tenant() 78 | { 79 | return $this->belongsTo(self::class, 'tenant_id'); 80 | } 81 | 82 | public function tenantUsers() 83 | { 84 | return $this->hasMany(self::class, 'tenant_id'); 85 | } 86 | 87 | public function roles() 88 | { 89 | return $this->belongsToMany(Role::class); 90 | } 91 | 92 | public function assetGroups() 93 | { 94 | return $this->hasMany(AssetGroup::class, 'tenant_id'); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^7.2.5", 12 | "fideloper/proxy": "^4.2", 13 | "fruitcake/laravel-cors": "^2.0", 14 | "guzzlehttp/guzzle": "^6.3", 15 | "iatstuti/laravel-cascade-soft-deletes": "^3.0", 16 | "laravel/framework": "^7.0", 17 | "laravel/tinker": "^2.0", 18 | "laravel/ui": "^2.1", 19 | "spatie/laravel-medialibrary": "^7.19", 20 | "yajra/laravel-datatables-oracle": "^9.10" 21 | }, 22 | "require-dev": { 23 | "facade/ignition": "^2.0", 24 | "fzaninotto/faker": "^1.9.1", 25 | "mockery/mockery": "^1.3.1", 26 | "nunomaduro/collision": "^4.1", 27 | "phpunit/phpunit": "^8.5" 28 | }, 29 | "config": { 30 | "optimize-autoloader": true, 31 | "preferred-install": "dist", 32 | "sort-packages": true 33 | }, 34 | "extra": { 35 | "laravel": { 36 | "dont-discover": [] 37 | } 38 | }, 39 | "autoload": { 40 | "psr-4": { 41 | "App\\": "app/" 42 | }, 43 | "classmap": [ 44 | "database/seeds", 45 | "database/factories" 46 | ] 47 | }, 48 | "autoload-dev": { 49 | "psr-4": { 50 | "Tests\\": "tests/" 51 | } 52 | }, 53 | "minimum-stability": "dev", 54 | "prefer-stable": true, 55 | "scripts": { 56 | "post-autoload-dump": [ 57 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 58 | "@php artisan package:discover --ansi" 59 | ], 60 | "post-root-package-install": [ 61 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 62 | ], 63 | "post-create-project-cmd": [ 64 | "@php artisan key:generate --ansi" 65 | ] 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'cluster' => env('PUSHER_APP_CLUSTER'), 40 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'redis' => [ 45 | 'driver' => 'redis', 46 | 'connection' => 'default', 47 | ], 48 | 49 | 'log' => [ 50 | 'driver' => 'log', 51 | ], 52 | 53 | 'null' => [ 54 | 'driver' => 'null', 55 | ], 56 | 57 | ], 58 | 59 | ]; 60 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Cloud Filesystem Disk 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Many applications store files both locally and in the cloud. For this 24 | | reason, you may specify a default "cloud" driver here. This driver 25 | | will be bound as the Cloud disk implementation in the container. 26 | | 27 | */ 28 | 29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Filesystem Disks 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here you may configure as many filesystem "disks" as you wish, and you 37 | | may even configure multiple disks of the same driver. Defaults have 38 | | been setup for each driver as an example of the required options. 39 | | 40 | | Supported Drivers: "local", "ftp", "sftp", "s3" 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'url' => env('APP_URL').'/storage', 55 | 'visibility' => 'public', 56 | ], 57 | 58 | 's3' => [ 59 | 'driver' => 's3', 60 | 'key' => env('AWS_ACCESS_KEY_ID'), 61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 62 | 'region' => env('AWS_DEFAULT_REGION'), 63 | 'bucket' => env('AWS_BUCKET'), 64 | 'url' => env('AWS_URL'), 65 | 'endpoint' => env('AWS_ENDPOINT'), 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Symbolic Links 73 | |-------------------------------------------------------------------------- 74 | | 75 | | Here you may configure the symbolic links that will be created when the 76 | | `storage:link` Artisan command is executed. The array keys should be 77 | | the locations of the links and the values should be their targets. 78 | | 79 | */ 80 | 81 | 'links' => [ 82 | public_path('storage') => storage_path('app/public'), 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 1024, 48 | 'threads' => 2, 49 | 'time' => 2, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Log Channels 25 | |-------------------------------------------------------------------------- 26 | | 27 | | Here you may configure the log channels for your application. Out of 28 | | the box, Laravel uses the Monolog PHP logging library. This gives 29 | | you a variety of powerful log handlers / formatters to utilize. 30 | | 31 | | Available Drivers: "single", "daily", "slack", "syslog", 32 | | "errorlog", "monolog", 33 | | "custom", "stack" 34 | | 35 | */ 36 | 37 | 'channels' => [ 38 | 'stack' => [ 39 | 'driver' => 'stack', 40 | 'channels' => ['single'], 41 | 'ignore_exceptions' => false, 42 | ], 43 | 44 | 'single' => [ 45 | 'driver' => 'single', 46 | 'path' => storage_path('logs/laravel.log'), 47 | 'level' => 'debug', 48 | ], 49 | 50 | 'daily' => [ 51 | 'driver' => 'daily', 52 | 'path' => storage_path('logs/laravel.log'), 53 | 'level' => 'debug', 54 | 'days' => 14, 55 | ], 56 | 57 | 'slack' => [ 58 | 'driver' => 'slack', 59 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 60 | 'username' => 'Laravel Log', 61 | 'emoji' => ':boom:', 62 | 'level' => 'critical', 63 | ], 64 | 65 | 'papertrail' => [ 66 | 'driver' => 'monolog', 67 | 'level' => 'debug', 68 | 'handler' => SyslogUdpHandler::class, 69 | 'handler_with' => [ 70 | 'host' => env('PAPERTRAIL_URL'), 71 | 'port' => env('PAPERTRAIL_PORT'), 72 | ], 73 | ], 74 | 75 | 'stderr' => [ 76 | 'driver' => 'monolog', 77 | 'handler' => StreamHandler::class, 78 | 'formatter' => env('LOG_STDERR_FORMATTER'), 79 | 'with' => [ 80 | 'stream' => 'php://stderr', 81 | ], 82 | ], 83 | 84 | 'syslog' => [ 85 | 'driver' => 'syslog', 86 | 'level' => 'debug', 87 | ], 88 | 89 | 'errorlog' => [ 90 | 'driver' => 'errorlog', 91 | 'level' => 'debug', 92 | ], 93 | 94 | 'null' => [ 95 | 'driver' => 'monolog', 96 | 'handler' => NullHandler::class, 97 | ], 98 | 99 | 'emergency' => [ 100 | 'path' => storage_path('logs/laravel.log'), 101 | ], 102 | ], 103 | 104 | ]; 105 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | 'block_for' => 0, 50 | ], 51 | 52 | 'sqs' => [ 53 | 'driver' => 'sqs', 54 | 'key' => env('AWS_ACCESS_KEY_ID'), 55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 58 | 'suffix' => env('SQS_SUFFIX'), 59 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 60 | ], 61 | 62 | 'redis' => [ 63 | 'driver' => 'redis', 64 | 'connection' => 'default', 65 | 'queue' => env('REDIS_QUEUE', 'default'), 66 | 'retry_after' => 90, 67 | 'block_for' => null, 68 | ], 69 | 70 | ], 71 | 72 | /* 73 | |-------------------------------------------------------------------------- 74 | | Failed Queue Jobs 75 | |-------------------------------------------------------------------------- 76 | | 77 | | These options configure the behavior of failed queue job logging so you 78 | | can control which database and table are used to store the jobs that 79 | | have failed. You may change them to any database / table you wish. 80 | | 81 | */ 82 | 83 | 'failed' => [ 84 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 85 | 'database' => env('DB_CONNECTION', 'mysql'), 86 | 'table' => 'failed_jobs', 87 | ], 88 | 89 | ]; 90 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | *.sqlite-journal 3 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | define(User::class, function (Faker $faker) { 21 | return [ 22 | 'name' => $faker->name, 23 | 'email' => $faker->unique()->safeEmail, 24 | 'email_verified_at' => now(), 25 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 26 | 'remember_token' => Str::random(10), 27 | ]; 28 | }); 29 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password')->nullable(); 22 | $table->string('domain')->unique()->nullable(); 23 | $table->boolean('is_suspended')->default(false); 24 | $table->rememberToken(); 25 | $table->timestamps(); 26 | $table->softDeletes(); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('users'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->text('connection'); 19 | $table->text('queue'); 20 | $table->longText('payload'); 21 | $table->longText('exception'); 22 | $table->timestamp('failed_at')->useCurrent(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('failed_jobs'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2020_07_17_091720_add_relationship_field_to_users_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('tenant_id')->nullable(); 18 | $table->foreign('tenant_id')->references('id')->on('users'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('users', function (Blueprint $table) { 30 | $table->dropForeign(['tenant_id']); 31 | $table->dropColumn('tenant_id'); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2020_07_20_062422_create_roles_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->unsignedBigInteger('tenant_id')->nullable(); 20 | $table->foreign('tenant_id')->references('id')->on('users'); 21 | $table->timestamps(); 22 | $table->softDeletes(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('roles'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2020_07_20_062705_create_permissions_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->timestamps(); 20 | $table->softDeletes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('permissions'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2020_07_20_062808_create_permission_role_pivot_table.php: -------------------------------------------------------------------------------- 1 | foreignId('permission_id')->constrained()->cascadeOnDelete(); 18 | $table->foreignId('role_id')->constrained()->cascadeOnDelete(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::dropIfExists('permission_role'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2020_07_20_070323_create_role_user_pivot_table.php: -------------------------------------------------------------------------------- 1 | foreignId('role_id')->constrained()->cascadeOnDelete(); 18 | $table->foreignId('user_id')->constrained()->cascadeOnDelete(); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::dropIfExists('role_user'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2020_07_22_173741_create_asset_groups_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->timestamps(); 20 | $table->softDeletes(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('asset_groups'); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/migrations/2020_07_22_174237_add_relationship_field_to_asset_groups_table.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('parent_id')->nullable(); 18 | $table->foreign('parent_id')->references('id')->on('asset_groups'); 19 | $table->unsignedBigInteger('tenant_id'); 20 | $table->foreign('tenant_id')->references('id')->on('users'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::table('asset_groups', function (Blueprint $table) { 32 | $table->dropColumn([ 33 | 'parent_id', 'tenant_id', 34 | ]); 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/migrations/2020_07_23_155342_create_assets_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->text('description')->nullable(); 20 | $table->string('serial_number')->nullable(); 21 | $table->decimal('price', 15, 2)->nullable(); 22 | $table->date('warranty_expiry_date')->nullable(); 23 | $table->unsignedBigInteger('sub_group_id'); 24 | $table->foreign('sub_group_id')->references('id')->on('asset_groups'); 25 | $table->unsignedBigInteger('tenant_id'); 26 | $table->foreign('tenant_id')->references('id')->on('users'); 27 | $table->timestamps(); 28 | $table->softDeletes(); 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('assets'); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /database/migrations/2020_07_27_113121_create_media_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->morphs('model'); 19 | $table->string('collection_name'); 20 | $table->string('name'); 21 | $table->string('file_name'); 22 | $table->string('mime_type')->nullable(); 23 | $table->string('disk'); 24 | $table->unsignedInteger('size'); 25 | $table->json('manipulations'); 26 | $table->json('custom_properties'); 27 | $table->json('responsive_images'); 28 | $table->unsignedInteger('order_column')->nullable(); 29 | $table->nullableTimestamps(); 30 | }); 31 | } 32 | 33 | /** 34 | * Reverse the migrations. 35 | * 36 | * @return void 37 | */ 38 | public function down() 39 | { 40 | Schema::dropIfExists('media'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /database/migrations/2020_07_27_115009_create_images_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->text('description')->nullable(); 19 | $table->foreignId('asset_id'); 20 | $table->unsignedBigInteger('tenant_id'); 21 | $table->foreign('tenant_id')->references('id')->on('users'); 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('images'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2020_07_27_115021_create_documents_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->text('description')->nullable(); 19 | $table->foreignId('asset_id'); 20 | $table->unsignedBigInteger('tenant_id'); 21 | $table->foreign('tenant_id')->references('id')->on('users'); 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('documents'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2020_07_27_115028_create_notes_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->text('text')->nullable(); 19 | $table->foreignId('asset_id'); 20 | $table->unsignedBigInteger('tenant_id'); 21 | $table->foreign('tenant_id')->references('id')->on('users'); 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('notes'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call([ 15 | PermissionsTableSeeder::class, 16 | RolesTableSeeder::class, 17 | PermissionRoleTableSeeder::class, 18 | UsersTableSeeder::class, 19 | RoleUserTableSeeder::class, 20 | ]); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /database/seeds/PermissionRoleTableSeeder.php: -------------------------------------------------------------------------------- 1 | filter(function ($permission) { 18 | return substr($permission->title, 0, 18) == 'tenant_management_'; 19 | }); 20 | Role::findOrFail(1)->permissions()->sync($admin_permissions->pluck('id')); 21 | $tenant_admin_permissions = $all_permissions->filter(function ($permission) { 22 | return substr($permission->title, 0, 18) != 'tenant_management_'; 23 | }); 24 | Role::findOrFail(2)->permissions()->sync($tenant_admin_permissions); 25 | $tenant_user_permissions = $all_permissions->filter(function ($permission) { 26 | return substr($permission->title, 0, 17) == 'asset_management_' 27 | || substr($permission->title, 0, 17) == 'image_management_' 28 | || substr($permission->title, 0, 20) == 'document_management_' 29 | || substr($permission->title, 0, 16) == 'note_management_'; 30 | }); 31 | Role::findOrFail(3)->permissions()->sync($tenant_user_permissions); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/seeds/PermissionsTableSeeder.php: -------------------------------------------------------------------------------- 1 | ++$i, 26 | 'title' => $permissionGroup . '_' . $permission, 27 | ]; 28 | } 29 | } 30 | 31 | Permission::insert($permissions); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /database/seeds/RoleUserTableSeeder.php: -------------------------------------------------------------------------------- 1 | roles()->attach(1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /database/seeds/RolesTableSeeder.php: -------------------------------------------------------------------------------- 1 | 1, 18 | 'title' => 'Admin', 19 | ], 20 | [ 21 | 'id' => 2, 22 | 'title' => 'Tenant Admin', 23 | ], 24 | [ 25 | 'id' => 3, 26 | 'title' => 'Tenant User', 27 | ], 28 | ]; 29 | 30 | Role::insert($roles); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/seeds/UsersTableSeeder.php: -------------------------------------------------------------------------------- 1 | 1, 18 | 'name' => 'Admin', 19 | 'email' => 'admin@admin.com', 20 | 'password' => bcrypt('password'), 21 | ] 22 | ]; 23 | 24 | User::insert($users); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "npm run development -- --watch", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.19", 14 | "bootstrap": "^4.0.0", 15 | "cross-env": "^7.0", 16 | "jquery": "^3.2", 17 | "laravel-mix": "^5.0.1", 18 | "lodash": "^4.17.13", 19 | "popper.js": "^1.12", 20 | "resolve-url-loader": "^2.3.1", 21 | "sass": "^1.20.1", 22 | "sass-loader": "^8.0.0", 23 | "vue": "^2.5.17", 24 | "vue-template-compiler": "^2.6.10" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaravelDaily/Laravel-Assets-Multi-Tenancy/3fc57dfd721e8f43562b67013812857b3308195c/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | define('LARAVEL_START', microtime(true)); 11 | 12 | /* 13 | |-------------------------------------------------------------------------- 14 | | Register The Auto Loader 15 | |-------------------------------------------------------------------------- 16 | | 17 | | Composer provides a convenient, automatically generated class loader for 18 | | our application. We just need to utilize it! We'll simply require it 19 | | into the script here so that we don't have to worry about manual 20 | | loading any of our classes later on. It feels great to relax. 21 | | 22 | */ 23 | 24 | require __DIR__.'/../vendor/autoload.php'; 25 | 26 | /* 27 | |-------------------------------------------------------------------------- 28 | | Turn On The Lights 29 | |-------------------------------------------------------------------------- 30 | | 31 | | We need to illuminate PHP development, so let us turn on the lights. 32 | | This bootstraps the framework and gets it ready for use, then it 33 | | will load up this application so that we can run it and send 34 | | the responses back to the browser and delight our users. 35 | | 36 | */ 37 | 38 | $app = require_once __DIR__.'/../bootstrap/app.php'; 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Run The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once we have the application, we can handle the incoming request 46 | | through the kernel, and send the associated response back to 47 | | the client's browser allowing them to enjoy the creative 48 | | and wonderful application we have prepared for them. 49 | | 50 | */ 51 | 52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 53 | 54 | $response = $kernel->handle( 55 | $request = Illuminate\Http\Request::capture() 56 | ); 57 | 58 | $response->send(); 59 | 60 | $kernel->terminate($request, $response); 61 | -------------------------------------------------------------------------------- /public/js/app.js.LICENSE.txt: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v4.5.0 (https://getbootstrap.com/) 3 | * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | 7 | /*! 8 | * Sizzle CSS Selector Engine v2.3.5 9 | * https://sizzlejs.com/ 10 | * 11 | * Copyright JS Foundation and other contributors 12 | * Released under the MIT license 13 | * https://js.foundation/ 14 | * 15 | * Date: 2020-03-14 16 | */ 17 | 18 | /*! 19 | * Vue.js v2.6.11 20 | * (c) 2014-2019 Evan You 21 | * Released under the MIT License. 22 | */ 23 | 24 | /*! 25 | * jQuery JavaScript Library v3.5.1 26 | * https://jquery.com/ 27 | * 28 | * Includes Sizzle.js 29 | * https://sizzlejs.com/ 30 | * 31 | * Copyright JS Foundation and other contributors 32 | * Released under the MIT license 33 | * https://jquery.org/license 34 | * 35 | * Date: 2020-05-04T22:49Z 36 | */ 37 | 38 | /** 39 | * @license 40 | * Lodash 41 | * Copyright OpenJS Foundation and other contributors 42 | * Released under MIT license 43 | * Based on Underscore.js 1.8.3 44 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 45 | */ 46 | 47 | /**! 48 | * @fileOverview Kickass library to create and place poppers near their reference elements. 49 | * @version 1.16.1 50 | * @license 51 | * Copyright (c) 2016 Federico Zivolo and contributors 52 | * 53 | * Permission is hereby granted, free of charge, to any person obtaining a copy 54 | * of this software and associated documentation files (the "Software"), to deal 55 | * in the Software without restriction, including without limitation the rights 56 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 57 | * copies of the Software, and to permit persons to whom the Software is 58 | * furnished to do so, subject to the following conditions: 59 | * 60 | * The above copyright notice and this permission notice shall be included in all 61 | * copies or substantial portions of the Software. 62 | * 63 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 64 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 65 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 66 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 67 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 68 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 69 | * SOFTWARE. 70 | */ 71 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css" 4 | } 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * First we will load all of this project's JavaScript dependencies which 3 | * includes Vue and other libraries. It is a great starting point when 4 | * building robust, powerful web applications using Vue and Laravel. 5 | */ 6 | 7 | require('./bootstrap'); 8 | 9 | window.Vue = require('vue'); 10 | 11 | /** 12 | * The following block of code may be used to automatically register your 13 | * Vue components. It will recursively scan this directory for the Vue 14 | * components and automatically register them with their "basename". 15 | * 16 | * Eg. ./components/ExampleComponent.vue -> 17 | */ 18 | 19 | // const files = require.context('./', true, /\.vue$/i) 20 | // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default)) 21 | 22 | Vue.component('example-component', require('./components/ExampleComponent.vue').default); 23 | 24 | /** 25 | * Next, we will create a fresh Vue application instance and attach it to 26 | * the page. Then, you may begin adding components to this application 27 | * or customize the JavaScript scaffolding to fit your unique needs. 28 | */ 29 | 30 | const app = new Vue({ 31 | el: '#app', 32 | }); 33 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support 5 | * for JavaScript based Bootstrap features such as modals and tabs. This 6 | * code may be modified to fit the specific needs of your application. 7 | */ 8 | 9 | try { 10 | window.Popper = require('popper.js').default; 11 | window.$ = window.jQuery = require('jquery'); 12 | 13 | require('bootstrap'); 14 | } catch (e) {} 15 | 16 | /** 17 | * We'll load the axios HTTP library which allows us to easily issue requests 18 | * to our Laravel back-end. This library automatically handles sending the 19 | * CSRF token as a header based on the value of the "XSRF" token cookie. 20 | */ 21 | 22 | window.axios = require('axios'); 23 | 24 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 25 | 26 | /** 27 | * Echo exposes an expressive API for subscribing to channels and listening 28 | * for events that are broadcast by Laravel. Echo and event broadcasting 29 | * allows your team to easily build robust real-time web applications. 30 | */ 31 | 32 | // import Echo from 'laravel-echo'; 33 | 34 | // window.Pusher = require('pusher-js'); 35 | 36 | // window.Echo = new Echo({ 37 | // broadcaster: 'pusher', 38 | // key: process.env.MIX_PUSHER_APP_KEY, 39 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 40 | // forceTLS: true 41 | // }); 42 | -------------------------------------------------------------------------------- /resources/js/components/ExampleComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 24 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/sass/_variables.scss: -------------------------------------------------------------------------------- 1 | // Body 2 | $body-bg: #f8fafc; 3 | 4 | // Typography 5 | $font-family-sans-serif: 'Nunito', sans-serif; 6 | $font-size-base: 0.9rem; 7 | $line-height-base: 1.6; 8 | 9 | // Colors 10 | $blue: #3490dc; 11 | $indigo: #6574cd; 12 | $purple: #9561e2; 13 | $pink: #f66d9b; 14 | $red: #e3342f; 15 | $orange: #f6993f; 16 | $yellow: #ffed4a; 17 | $green: #38c172; 18 | $teal: #4dc0b5; 19 | $cyan: #6cb2eb; 20 | -------------------------------------------------------------------------------- /resources/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Fonts 2 | @import url('https://fonts.googleapis.com/css?family=Nunito'); 3 | 4 | // Variables 5 | @import 'variables'; 6 | 7 | // Bootstrap 8 | @import '~bootstrap/scss/bootstrap'; 9 | -------------------------------------------------------------------------------- /resources/views/admin/assetGroups/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Create asset group 6 |
7 | 8 |
9 |
10 | @csrf 11 |
12 | 13 | 14 | @if($errors->has('name')) 15 |
16 | {{ $errors->first('name') }} 17 |
18 | @endif 19 |
20 |
21 | 22 | 28 | @if($errors->has('parent_id')) 29 |
30 | {{ $errors->first('parent_id') }} 31 |
32 | @endif 33 |
34 |
35 | 38 |
39 |
40 |
41 |
42 | @endsection 43 | 44 | @section('scripts') 45 | 48 | @endsection 49 | -------------------------------------------------------------------------------- /resources/views/admin/assetGroups/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Edit asset group 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('name')) 16 |
17 | {{ $errors->first('name') }} 18 |
19 | @endif 20 |
21 |
22 | 23 | 29 | @if($errors->has('parent_id')) 30 |
31 | {{ $errors->first('parent_id') }} 32 |
33 | @endif 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 | @endsection 44 | 45 | @section('scripts') 46 | 49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/admin/assetGroups/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Asset groups management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('asset_group_management_create') 20 |
21 | Create asset group 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 37 | 38 |
28 | ID 29 | 31 | Name 32 | 34 |   35 |
39 |
40 |
41 |
42 |
43 |
44 | @endsection 45 | @section('scripts') 46 | @parent 47 | 72 | @endsection 73 | -------------------------------------------------------------------------------- /resources/views/admin/assetGroups/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Asset group {{ $assetGroup->name }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 29 | 30 |
12 | ID 13 | 15 | {{ $assetGroup->id }} 16 |
20 | Name 21 | 23 | @if ($assetGroup->parent) 24 | {{ $assetGroup->parent->name }} 25 | 26 | @endif 27 | {{ $assetGroup->name ?? '' }} 28 |
31 | 36 |
37 |
38 | @endsection 39 | -------------------------------------------------------------------------------- /resources/views/admin/assets/relationships/documents.blade.php: -------------------------------------------------------------------------------- 1 | @can('document_management_create') 2 |
3 | 8 |
9 | @endcan 10 | 11 |
12 |
13 | Document management 14 |
15 | 16 |
17 | 18 | 19 | 20 | 23 | 26 | 29 | 30 | 31 |
21 | ID 22 | 24 | Document 25 | 27 |   28 |
32 |
33 |
34 | 35 | @section('scripts') 36 | @parent 37 | 62 | @endsection 63 | -------------------------------------------------------------------------------- /resources/views/admin/assets/relationships/images.blade.php: -------------------------------------------------------------------------------- 1 | @can('image_management_create') 2 |
3 | 8 |
9 | @endcan 10 | 11 |
12 |
13 | Image management 14 |
15 | 16 |
17 | 18 | 19 | 20 | 23 | 26 | 29 | 30 | 31 |
21 | ID 22 | 24 | Image 25 | 27 |   28 |
32 |
33 |
34 | 35 | @section('scripts') 36 | @parent 37 | 62 | @endsection 63 | -------------------------------------------------------------------------------- /resources/views/admin/assets/relationships/notes.blade.php: -------------------------------------------------------------------------------- 1 | @can('note_management_create') 2 |
3 | 8 |
9 | @endcan 10 | 11 |
12 |
13 | Note management 14 |
15 | 16 |
17 | 18 | 19 | 20 | 23 | 26 | 29 | 30 | 31 |
21 | ID 22 | 24 | Note Text 25 | 27 |   28 |
32 |
33 |
34 | 35 | @section('scripts') 36 | @parent 37 | 62 | @endsection 63 | -------------------------------------------------------------------------------- /resources/views/admin/documents/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Document management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('document_management_create') 20 |
21 | Add document 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 40 | 41 |
28 | ID 29 | 31 | Asset 32 | 34 | Document 35 | 37 |   38 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | @section('scripts') 49 | @parent 50 | 76 | @endsection 77 | -------------------------------------------------------------------------------- /resources/views/admin/documents/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Document #{{ $document->id }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 37 | 38 | 39 | 42 | 45 | 46 |
12 | ID 13 | 15 | {{ $document->id }} 16 |
20 | Asset 21 | 23 | {{ $document->asset ? $document->asset->name : '' }} 24 |
28 | Document 29 | 31 | @if ($document->document) 32 | 33 | Download File 34 | 35 | @endif 36 |
40 | Description 41 | 43 | {{ $document->description ?? '' }} 44 |
47 | 52 |
53 |
54 | @endsection 55 | -------------------------------------------------------------------------------- /resources/views/admin/images/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Image management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('image_management_create') 20 |
21 | Add image 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 40 | 41 |
28 | ID 29 | 31 | Asset 32 | 34 | Image 35 | 37 |   38 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | @section('scripts') 49 | @parent 50 | 76 | @endsection 77 | -------------------------------------------------------------------------------- /resources/views/admin/images/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Image #{{ $image->id }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 37 | 38 | 39 | 42 | 45 | 46 |
12 | ID 13 | 15 | {{ $image->id }} 16 |
20 | Asset 21 | 23 | {{ $image->asset ? $image->asset->name : '' }} 24 |
28 | Image 29 | 31 | @if ($image->image) 32 | 33 | 34 | 35 | @endif 36 |
40 | Description 41 | 43 | {{ $image->description ?? '' }} 44 |
47 | 52 |
53 |
54 | @endsection 55 | -------------------------------------------------------------------------------- /resources/views/admin/notes/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Add note 6 |
7 | 8 |
9 |
10 | @csrf 11 |
12 | 13 | 14 | @if($errors->has('text')) 15 |
16 | {{ $errors->first('text') }} 17 |
18 | @endif 19 |
20 | @if(request()->input('asset_id')) 21 | 22 | @else 23 |
24 | 25 | 30 | @if($errors->has('asset_id')) 31 |
32 | {{ $errors->first('asset_id') }} 33 |
34 | @endif 35 |
36 | @endif 37 |
38 | 41 |
42 |
43 |
44 |
45 | @endsection 46 | -------------------------------------------------------------------------------- /resources/views/admin/notes/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Edit note 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('text')) 16 |
17 | {{ $errors->first('text') }} 18 |
19 | @endif 20 |
21 |
22 | 23 | 28 | @if($errors->has('asset_id')) 29 |
30 | {{ $errors->first('asset_id') }} 31 |
32 | @endif 33 |
34 |
35 | 38 |
39 |
40 |
41 |
42 | @endsection 43 | -------------------------------------------------------------------------------- /resources/views/admin/notes/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Note management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('note_management_create') 20 |
21 | Add note 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 40 | 41 |
28 | ID 29 | 31 | Asset 32 | 34 | Note Text 35 | 37 |   38 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | @section('scripts') 49 | @parent 50 | 76 | @endsection 77 | -------------------------------------------------------------------------------- /resources/views/admin/notes/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Note #{{ $note->id }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 33 | 34 |
12 | ID 13 | 15 | {{ $note->id }} 16 |
20 | Asset 21 | 23 | {{ $note->asset ? $note->asset->name : '' }} 24 |
28 | Note Text 29 | 31 | {{ $note->text ?? '' }} 32 |
35 | 40 |
41 |
42 | @endsection 43 | -------------------------------------------------------------------------------- /resources/views/admin/profile.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | My profile 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('name')) 16 |
17 | {{ $errors->first('name') }} 18 |
19 | @endif 20 |
21 |
22 | 23 | 24 |
25 |
26 | 27 | 28 | @if($errors->has('password')) 29 |
30 | {{ $errors->first('password') }} 31 |
32 | @endif 33 |
34 |
35 | 36 | 37 |
38 |
39 | 42 |
43 |
44 |
45 |
46 | @endsection 47 | -------------------------------------------------------------------------------- /resources/views/admin/roles/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Create role 6 |
7 | 8 |
9 |
10 | @csrf 11 |
12 | 13 | 14 | @if($errors->has('title')) 15 |
16 | {{ $errors->first('title') }} 17 |
18 | @endif 19 |
20 |
21 | 22 |
23 | Select all 24 | Deselect all 25 |
26 | 31 | @if($errors->has('permissions')) 32 |
33 | {{ $errors->first('permissions') }} 34 |
35 | @endif 36 |
37 |
38 | 41 |
42 |
43 |
44 |
45 | @endsection 46 | 47 | @section('scripts') 48 | 62 | @endsection 63 | -------------------------------------------------------------------------------- /resources/views/admin/roles/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Edit role 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('title')) 16 |
17 | {{ $errors->first('title') }} 18 |
19 | @endif 20 |
21 |
22 | 23 |
24 | Select all 25 | Deselect all 26 |
27 | 32 | @if($errors->has('permissions')) 33 |
34 | {{ $errors->first('permissions') }} 35 |
36 | @endif 37 |
38 |
39 | 42 |
43 |
44 |
45 |
46 | @endsection 47 | 48 | @section('scripts') 49 | 63 | @endsection 64 | -------------------------------------------------------------------------------- /resources/views/admin/roles/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Role management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('role_management_create') 20 |
21 | Create role 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 37 | 38 |
28 | ID 29 | 31 | Title 32 | 34 |   35 |
39 |
40 |
41 |
42 |
43 |
44 | @endsection 45 | @section('scripts') 46 | @parent 47 | 72 | @endsection 73 | -------------------------------------------------------------------------------- /resources/views/admin/roles/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Role {{ $role->title }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 35 | 36 |
12 | ID 13 | 15 | {{ $role->id }} 16 |
20 | Title 21 | 23 | {{ $role->title ?? '' }} 24 |
28 | Permissions 29 | 31 | @foreach($role->permissions as $key => $item) 32 | {{ $item->title }} 33 | @endforeach 34 |
37 | 42 |
43 |
44 | @endsection 45 | -------------------------------------------------------------------------------- /resources/views/admin/tenants/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Create tenant 6 |
7 | 8 |
9 |
10 | @csrf 11 |
12 | 13 | 14 | @if($errors->has('name')) 15 |
16 | {{ $errors->first('name') }} 17 |
18 | @endif 19 |
20 |
21 | 22 | 23 | @if($errors->has('email')) 24 |
25 | {{ $errors->first('email') }} 26 |
27 | @endif 28 |
29 |
30 | 31 | 32 | @if($errors->has('domain')) 33 |
34 | {{ $errors->first('domain') }} 35 |
36 | @endif 37 |
38 |
39 | 42 |
43 |
44 |
45 |
46 | @endsection 47 | -------------------------------------------------------------------------------- /resources/views/admin/tenants/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Edit tenant 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('name')) 16 |
17 | {{ $errors->first('name') }} 18 |
19 | @endif 20 |
21 |
22 | 23 | 24 | @if($errors->has('email')) 25 |
26 | {{ $errors->first('email') }} 27 |
28 | @endif 29 |
30 |
31 | 32 | 33 | @if($errors->has('domain')) 34 |
35 | {{ $errors->first('domain') }} 36 |
37 | @endif 38 |
39 |
40 | 43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/admin/tenants/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Tenant management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('tenant_management_create') 20 |
21 | Create tenant 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 42 | 43 | 44 |
28 | ID 29 | 31 | Name 32 | 34 | Email 35 | 37 | Domain 38 | 40 |   41 |
45 |
46 |
47 |
48 |
49 |
50 | @endsection 51 | @section('scripts') 52 | @parent 53 | 88 | @endsection 89 | -------------------------------------------------------------------------------- /resources/views/admin/tenants/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Tenant {{ $tenant->name }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 33 | 34 | 35 | 38 | 41 | 42 |
12 | ID 13 | 15 | {{ $tenant->id }} 16 |
20 | Name 21 | 23 | {{ $tenant->name ?? '' }} 24 |
28 | Email 29 | 31 | {{ $tenant->email ?? '' }} 32 |
36 | Domain 37 | 39 | {!! $tenant->domain ? '' . route('tenant.show', $tenant) . '' : '' !!} 40 |
43 | 48 |
49 |
50 | @endsection 51 | -------------------------------------------------------------------------------- /resources/views/admin/users/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Create user 6 |
7 | 8 |
9 |
10 | @csrf 11 |
12 | 13 | 14 | @if($errors->has('name')) 15 |
16 | {{ $errors->first('name') }} 17 |
18 | @endif 19 |
20 |
21 | 22 | 23 | @if($errors->has('email')) 24 |
25 | {{ $errors->first('email') }} 26 |
27 | @endif 28 |
29 |
30 | 31 | 36 | @if($errors->has('role_id')) 37 |
38 | {{ $errors->first('role_id') }} 39 |
40 | @endif 41 |
42 |
43 | 46 |
47 |
48 |
49 |
50 | @endsection 51 | 52 | @section('scripts') 53 | 56 | @endsection 57 | -------------------------------------------------------------------------------- /resources/views/admin/users/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | Edit user 6 |
7 | 8 |
9 |
10 | @csrf 11 | @method('PUT') 12 |
13 | 14 | 15 | @if($errors->has('name')) 16 |
17 | {{ $errors->first('name') }} 18 |
19 | @endif 20 |
21 |
22 | 23 | 24 | @if($errors->has('email')) 25 |
26 | {{ $errors->first('email') }} 27 |
28 | @endif 29 |
30 |
31 | 32 | 37 | @if($errors->has('role_id')) 38 |
39 | {{ $errors->first('role_id') }} 40 |
41 | @endif 42 |
43 |
44 | 47 |
48 |
49 |
50 |
51 | @endsection 52 | 53 | @section('scripts') 54 | 57 | @endsection 58 | -------------------------------------------------------------------------------- /resources/views/admin/users/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | User management 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | @can('user_management_create') 20 |
21 | Create user 22 |
23 | @endcan 24 | 25 | 26 | 27 | 30 | 33 | 36 | 39 | 42 | 43 | 44 |
28 | ID 29 | 31 | Name 32 | 34 | Email 35 | 37 | Role 38 | 40 |   41 |
45 |
46 |
47 |
48 |
49 |
50 | @endsection 51 | @section('scripts') 52 | @parent 53 | 80 | @endsection 81 | -------------------------------------------------------------------------------- /resources/views/admin/users/show.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | @section('content') 3 |
4 |
5 | User {{ $user->name }} 6 |
7 | 8 |
9 | 10 | 11 | 14 | 17 | 18 | 19 | 22 | 25 | 26 | 27 | 30 | 33 | 34 |
12 | ID 13 | 15 | {{ $user->id }} 16 |
20 | Name 21 | 23 | {{ $user->name ?? '' }} 24 |
28 | Email 29 | 31 | {{ $user->email ?? '' }} 32 |
35 | 40 |
41 |
42 | @endsection 43 | -------------------------------------------------------------------------------- /resources/views/auth/password.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.auth') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Set A Password
9 | 10 |
11 |
12 | @csrf 13 | 14 |
15 | 16 | 17 |
18 | 19 | 20 | @error('password') 21 | 22 | {{ $message }} 23 | 24 | @enderror 25 |
26 |
27 | 28 |
29 | 30 | 31 |
32 | 33 | 34 | @error('password_confirmation') 35 | 36 | {{ $message }} 37 | 38 | @enderror 39 |
40 |
41 | 42 |
43 |
44 | 47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 | @endsection 56 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/confirm.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.auth') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Confirm Password') }}
9 | 10 |
11 | {{ __('Please confirm your password before continuing.') }} 12 | 13 |
14 | @csrf 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('password') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 |
32 | 35 | 36 | @if (Route::has('password.request')) 37 | 38 | {{ __('Forgot Your Password?') }} 39 | 40 | @endif 41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | @endsection 50 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.auth') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 | @if (session('status')) 12 | 15 | @endif 16 | 17 |
18 | @csrf 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | @error('email') 27 | 28 | {{ $message }} 29 | 30 | @enderror 31 |
32 |
33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.auth') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Reset Password') }}
9 | 10 |
11 |
12 | @csrf 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @error('email') 23 | 24 | {{ $message }} 25 | 26 | @enderror 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @error('password') 37 | 38 | {{ $message }} 39 | 40 | @enderror 41 |
42 |
43 | 44 |
45 | 46 | 47 |
48 | 49 |
50 |
51 | 52 |
53 |
54 | 57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | @endsection 66 | -------------------------------------------------------------------------------- /resources/views/auth/verify.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.auth') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
{{ __('Verify Your Email Address') }}
9 | 10 |
11 | @if (session('resent')) 12 | 15 | @endif 16 | 17 | {{ __('Before proceeding, please check your email for a verification link.') }} 18 | {{ __('If you did not receive the email') }}, 19 |
20 | @csrf 21 | . 22 |
23 |
24 |
25 |
26 |
27 |
28 | @endsection 29 | -------------------------------------------------------------------------------- /resources/views/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
9 | Dashboard 10 |
11 | 12 |
13 | @if(session('status')) 14 | 17 | @endif 18 | 19 | You are logged in! 20 |
21 |
22 |
23 |
24 |
25 | @endsection 26 | -------------------------------------------------------------------------------- /resources/views/layouts/auth.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {{ config('app.name', 'Laravel') }} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | @yield('content') 26 |
27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /resources/views/partials/datatableActions.blade.php: -------------------------------------------------------------------------------- 1 | @can($permissionPrefix . 'show') 2 | 3 | View 4 | 5 | @endcan 6 | 7 | @can($permissionPrefix . 'edit') 8 | 9 | Edit 10 | 11 | @endcan 12 | 13 | @can($permissionPrefix . 'delete') 14 | @if ($crudRoutePart === 'tenants') 15 | 16 | @if ($row->is_suspended) 17 | Resume 18 | @else 19 | Suspend 20 | @endif 21 | 22 | @endif 23 | 24 |
25 | 26 | 27 | 28 |
29 | @endcan 30 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->describe('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | '{user:domain}.'.config('app.short_url'), 'as' => 'tenant.'], function () { 17 | Route::get('/', 'TenantController@show')->name('show'); 18 | }); 19 | 20 | Route::redirect('/', '/home'); 21 | 22 | Auth::routes(); 23 | 24 | Route::get('/home', 'HomeController@index')->name('home'); 25 | 26 | Route::get('/invitation/{user}', 'TenantController@invitation')->name('invitation'); 27 | 28 | Route::get('/password', 'Auth\PasswordController@create')->name('password.create'); 29 | 30 | Route::post('/password', 'Auth\PasswordController@store')->name('password.store'); 31 | 32 | Route::group(['as' => 'admin.', 'namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth']], function () { 33 | Route::get('tenants/{tenant}/suspend', 'TenantController@suspend')->name('tenants.suspend'); 34 | 35 | Route::resource('tenants', 'TenantController'); 36 | 37 | Route::resource('users', 'UserController'); 38 | 39 | Route::resource('roles', 'RoleController'); 40 | 41 | Route::resource('asset-groups', 'AssetGroupController'); 42 | 43 | Route::resource('assets', 'AssetController'); 44 | 45 | Route::post('images/media', 'ImageController@storeMedia')->name('images.storeMedia'); 46 | 47 | Route::resource('images', 'ImageController'); 48 | 49 | Route::post('documents/media', 'DocumentController@storeMedia')->name('documents.storeMedia'); 50 | 51 | Route::resource('documents', 'DocumentController'); 52 | 53 | Route::resource('notes', 'NoteController'); 54 | 55 | Route::get('profile', 'ProfileController@edit')->name('profile.edit'); 56 | 57 | Route::put('profile', 'ProfileController@update')->name('profile.update'); 58 | }); 59 | -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 8 | */ 9 | 10 | $uri = urldecode( 11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 12 | ); 13 | 14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 15 | // built-in PHP web server. This provides a convenient way to test a Laravel 16 | // application without having installed a "real" web server software here. 17 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 18 | return false; 19 | } 20 | 21 | require_once __DIR__.'/public/index.php'; 22 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | config.php 2 | routes.php 3 | schedule-* 4 | compiled.php 5 | services.json 6 | events.scanned.php 7 | routes.scanned.php 8 | down 9 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/tmp/uploads/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel application. By default, we are compiling the Sass 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .sass('resources/sass/app.scss', 'public/css'); 16 | --------------------------------------------------------------------------------