89 |
90 |
91 |
--------------------------------------------------------------------------------
/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Session Lifetime
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may specify the number of minutes that you wish the session
27 | | to be allowed to remain idle before it expires. If you want them
28 | | to immediately expire on the browser closing, set that option.
29 | |
30 | */
31 |
32 | 'lifetime' => env('SESSION_LIFETIME', 120),
33 |
34 | 'expire_on_close' => false,
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Session Encryption
39 | |--------------------------------------------------------------------------
40 | |
41 | | This option allows you to easily specify that all of your session data
42 | | should be encrypted before it is stored. All encryption will be run
43 | | automatically by Laravel and you can use the Session like normal.
44 | |
45 | */
46 |
47 | 'encrypt' => false,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Session File Location
52 | |--------------------------------------------------------------------------
53 | |
54 | | When using the native session driver, we need a location where session
55 | | files may be stored. A default has been set for you but a different
56 | | location may be specified. This is only needed for file sessions.
57 | |
58 | */
59 |
60 | 'files' => storage_path('framework/sessions'),
61 |
62 | /*
63 | |--------------------------------------------------------------------------
64 | | Session Database Connection
65 | |--------------------------------------------------------------------------
66 | |
67 | | When using the "database" or "redis" session drivers, you may specify a
68 | | connection that should be used to manage these sessions. This should
69 | | correspond to a connection in your database configuration options.
70 | |
71 | */
72 |
73 | 'connection' => null,
74 |
75 | /*
76 | |--------------------------------------------------------------------------
77 | | Session Database Table
78 | |--------------------------------------------------------------------------
79 | |
80 | | When using the "database" session driver, you may specify the table we
81 | | should use to manage the sessions. Of course, a sensible default is
82 | | provided for you; however, you are free to change this as needed.
83 | |
84 | */
85 |
86 | 'table' => 'sessions',
87 |
88 | /*
89 | |--------------------------------------------------------------------------
90 | | Session Cache Store
91 | |--------------------------------------------------------------------------
92 | |
93 | | When using the "apc" or "memcached" session drivers, you may specify a
94 | | cache store that should be used for these sessions. This value must
95 | | correspond with one of the application's configured cache stores.
96 | |
97 | */
98 |
99 | 'store' => null,
100 |
101 | /*
102 | |--------------------------------------------------------------------------
103 | | Session Sweeping Lottery
104 | |--------------------------------------------------------------------------
105 | |
106 | | Some session drivers must manually sweep their storage location to get
107 | | rid of old sessions from storage. Here are the chances that it will
108 | | happen on a given request. By default, the odds are 2 out of 100.
109 | |
110 | */
111 |
112 | 'lottery' => [2, 100],
113 |
114 | /*
115 | |--------------------------------------------------------------------------
116 | | Session Cookie Name
117 | |--------------------------------------------------------------------------
118 | |
119 | | Here you may change the name of the cookie used to identify a session
120 | | instance by ID. The name specified here will get used every time a
121 | | new session cookie is created by the framework for every driver.
122 | |
123 | */
124 |
125 | 'cookie' => env(
126 | 'SESSION_COOKIE',
127 | str_slug(env('APP_NAME', 'laravel'), '_').'_session'
128 | ),
129 |
130 | /*
131 | |--------------------------------------------------------------------------
132 | | Session Cookie Path
133 | |--------------------------------------------------------------------------
134 | |
135 | | The session cookie path determines the path for which the cookie will
136 | | be regarded as available. Typically, this will be the root path of
137 | | your application but you are free to change this when necessary.
138 | |
139 | */
140 |
141 | 'path' => '/',
142 |
143 | /*
144 | |--------------------------------------------------------------------------
145 | | Session Cookie Domain
146 | |--------------------------------------------------------------------------
147 | |
148 | | Here you may change the domain of the cookie used to identify a session
149 | | in your application. This will determine which domains the cookie is
150 | | available to in your application. A sensible default has been set.
151 | |
152 | */
153 |
154 | 'domain' => env('SESSION_DOMAIN', null),
155 |
156 | /*
157 | |--------------------------------------------------------------------------
158 | | HTTPS Only Cookies
159 | |--------------------------------------------------------------------------
160 | |
161 | | By setting this option to true, session cookies will only be sent back
162 | | to the server if the browser has a HTTPS connection. This will keep
163 | | the cookie from being sent to you if it can not be done securely.
164 | |
165 | */
166 |
167 | 'secure' => env('SESSION_SECURE_COOKIE', false),
168 |
169 | /*
170 | |--------------------------------------------------------------------------
171 | | HTTP Access Only
172 | |--------------------------------------------------------------------------
173 | |
174 | | Setting this value to true will prevent JavaScript from accessing the
175 | | value of the cookie and the cookie will only be accessible through
176 | | the HTTP protocol. You are free to modify this option if needed.
177 | |
178 | */
179 |
180 | 'http_only' => true,
181 |
182 | /*
183 | |--------------------------------------------------------------------------
184 | | Same-Site Cookies
185 | |--------------------------------------------------------------------------
186 | |
187 | | This option determines how your cookies behave when cross-site requests
188 | | take place, and can be used to mitigate CSRF attacks. By default, we
189 | | do not enable this as other CSRF protection services are in place.
190 | |
191 | | Supported: "lax", "strict"
192 | |
193 | */
194 |
195 | 'same_site' => null,
196 |
197 | ];
198 |
--------------------------------------------------------------------------------
/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20 | 'alpha' => 'The :attribute may only contain letters.',
21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
23 | 'array' => 'The :attribute must be an array.',
24 | 'before' => 'The :attribute must be a date before :date.',
25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26 | 'between' => [
27 | 'numeric' => 'The :attribute must be between :min and :max.',
28 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
29 | 'string' => 'The :attribute must be between :min and :max characters.',
30 | 'array' => 'The :attribute must have between :min and :max items.',
31 | ],
32 | 'boolean' => 'The :attribute field must be true or false.',
33 | 'confirmed' => 'The :attribute confirmation does not match.',
34 | 'date' => 'The :attribute is not a valid date.',
35 | 'date_format' => 'The :attribute does not match the format :format.',
36 | 'different' => 'The :attribute and :other must be different.',
37 | 'digits' => 'The :attribute must be :digits digits.',
38 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
39 | 'dimensions' => 'The :attribute has invalid image dimensions.',
40 | 'distinct' => 'The :attribute field has a duplicate value.',
41 | 'email' => 'The :attribute must be a valid email address.',
42 | 'exists' => 'The selected :attribute is invalid.',
43 | 'file' => 'The :attribute must be a file.',
44 | 'filled' => 'The :attribute field must have a value.',
45 | 'gt' => [
46 | 'numeric' => 'The :attribute must be greater than :value.',
47 | 'file' => 'The :attribute must be greater than :value kilobytes.',
48 | 'string' => 'The :attribute must be greater than :value characters.',
49 | 'array' => 'The :attribute must have more than :value items.',
50 | ],
51 | 'gte' => [
52 | 'numeric' => 'The :attribute must be greater than or equal :value.',
53 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.',
54 | 'string' => 'The :attribute must be greater than or equal :value characters.',
55 | 'array' => 'The :attribute must have :value items or more.',
56 | ],
57 | 'image' => 'The :attribute must be an image.',
58 | 'in' => 'The selected :attribute is invalid.',
59 | 'in_array' => 'The :attribute field does not exist in :other.',
60 | 'integer' => 'The :attribute must be an integer.',
61 | 'ip' => 'The :attribute must be a valid IP address.',
62 | 'ipv4' => 'The :attribute must be a valid IPv4 address.',
63 | 'ipv6' => 'The :attribute must be a valid IPv6 address.',
64 | 'json' => 'The :attribute must be a valid JSON string.',
65 | 'lt' => [
66 | 'numeric' => 'The :attribute must be less than :value.',
67 | 'file' => 'The :attribute must be less than :value kilobytes.',
68 | 'string' => 'The :attribute must be less than :value characters.',
69 | 'array' => 'The :attribute must have less than :value items.',
70 | ],
71 | 'lte' => [
72 | 'numeric' => 'The :attribute must be less than or equal :value.',
73 | 'file' => 'The :attribute must be less than or equal :value kilobytes.',
74 | 'string' => 'The :attribute must be less than or equal :value characters.',
75 | 'array' => 'The :attribute must not have more than :value items.',
76 | ],
77 | 'max' => [
78 | 'numeric' => 'The :attribute may not be greater than :max.',
79 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
80 | 'string' => 'The :attribute may not be greater than :max characters.',
81 | 'array' => 'The :attribute may not have more than :max items.',
82 | ],
83 | 'mimes' => 'The :attribute must be a file of type: :values.',
84 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
85 | 'min' => [
86 | 'numeric' => 'The :attribute must be at least :min.',
87 | 'file' => 'The :attribute must be at least :min kilobytes.',
88 | 'string' => 'The :attribute must be at least :min characters.',
89 | 'array' => 'The :attribute must have at least :min items.',
90 | ],
91 | 'not_in' => 'The selected :attribute is invalid.',
92 | 'not_regex' => 'The :attribute format is invalid.',
93 | 'numeric' => 'The :attribute must be a number.',
94 | 'present' => 'The :attribute field must be present.',
95 | 'regex' => 'The :attribute format is invalid.',
96 | 'required' => 'The :attribute field is required.',
97 | 'required_if' => 'The :attribute field is required when :other is :value.',
98 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
99 | 'required_with' => 'The :attribute field is required when :values is present.',
100 | 'required_with_all' => 'The :attribute field is required when :values is present.',
101 | 'required_without' => 'The :attribute field is required when :values is not present.',
102 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
103 | 'same' => 'The :attribute and :other must match.',
104 | 'size' => [
105 | 'numeric' => 'The :attribute must be :size.',
106 | 'file' => 'The :attribute must be :size kilobytes.',
107 | 'string' => 'The :attribute must be :size characters.',
108 | 'array' => 'The :attribute must contain :size items.',
109 | ],
110 | 'string' => 'The :attribute must be a string.',
111 | 'timezone' => 'The :attribute must be a valid zone.',
112 | 'unique' => 'The :attribute has already been taken.',
113 | 'uploaded' => 'The :attribute failed to upload.',
114 | 'url' => 'The :attribute format is invalid.',
115 |
116 | /*
117 | |--------------------------------------------------------------------------
118 | | Custom Validation Language Lines
119 | |--------------------------------------------------------------------------
120 | |
121 | | Here you may specify custom validation messages for attributes using the
122 | | convention "attribute.rule" to name the lines. This makes it quick to
123 | | specify a specific custom language line for a given attribute rule.
124 | |
125 | */
126 |
127 | 'custom' => [
128 | 'attribute-name' => [
129 | 'rule-name' => 'custom-message',
130 | ],
131 | ],
132 |
133 | /*
134 | |--------------------------------------------------------------------------
135 | | Custom Validation Attributes
136 | |--------------------------------------------------------------------------
137 | |
138 | | The following language lines are used to swap attribute place-holders
139 | | with something more reader friendly such as E-Mail Address instead
140 | | of "email". This simply helps us make messages a little cleaner.
141 | |
142 | */
143 |
144 | 'attributes' => [],
145 |
146 | ];
147 |
--------------------------------------------------------------------------------
/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Environment
21 | |--------------------------------------------------------------------------
22 | |
23 | | This value determines the "environment" your application is currently
24 | | running in. This may determine how you prefer to configure various
25 | | services your application utilizes. Set this in your ".env" file.
26 | |
27 | */
28 |
29 | 'env' => env('APP_ENV', 'production'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Debug Mode
34 | |--------------------------------------------------------------------------
35 | |
36 | | When your application is in debug mode, detailed error messages with
37 | | stack traces will be shown on every error that occurs within your
38 | | application. If disabled, a simple generic error page is shown.
39 | |
40 | */
41 |
42 | 'debug' => env('APP_DEBUG', false),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application URL
47 | |--------------------------------------------------------------------------
48 | |
49 | | This URL is used by the console to properly generate URLs when using
50 | | the Artisan command line tool. You should set this to the root of
51 | | your application so that it is used when running Artisan tasks.
52 | |
53 | */
54 |
55 | 'url' => env('APP_URL', 'http://localhost'),
56 |
57 | /*
58 | |--------------------------------------------------------------------------
59 | | Application Timezone
60 | |--------------------------------------------------------------------------
61 | |
62 | | Here you may specify the default timezone for your application, which
63 | | will be used by the PHP date and date-time functions. We have gone
64 | | ahead and set this to a sensible default for you out of the box.
65 | |
66 | */
67 |
68 | 'timezone' => 'UTC',
69 |
70 | /*
71 | |--------------------------------------------------------------------------
72 | | Application Locale Configuration
73 | |--------------------------------------------------------------------------
74 | |
75 | | The application locale determines the default locale that will be used
76 | | by the translation service provider. You are free to set this value
77 | | to any of the locales which will be supported by the application.
78 | |
79 | */
80 |
81 | 'locale' => 'en',
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Application Fallback Locale
86 | |--------------------------------------------------------------------------
87 | |
88 | | The fallback locale determines the locale to use when the current one
89 | | is not available. You may change the value to correspond to any of
90 | | the language folders that are provided through your application.
91 | |
92 | */
93 |
94 | 'fallback_locale' => 'en',
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Encryption Key
99 | |--------------------------------------------------------------------------
100 | |
101 | | This key is used by the Illuminate encrypter service and should be set
102 | | to a random, 32 character string, otherwise these encrypted strings
103 | | will not be safe. Please do this before deploying an application!
104 | |
105 | */
106 |
107 | 'key' => env('APP_KEY'),
108 |
109 | 'cipher' => 'AES-256-CBC',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Autoloaded Service Providers
114 | |--------------------------------------------------------------------------
115 | |
116 | | The service providers listed here will be automatically loaded on the
117 | | request to your application. Feel free to add your own services to
118 | | this array to grant expanded functionality to your applications.
119 | |
120 | */
121 |
122 | 'providers' => [
123 |
124 | /*
125 | * Laravel Framework Service Providers...
126 | */
127 | Illuminate\Auth\AuthServiceProvider::class,
128 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
129 | Illuminate\Bus\BusServiceProvider::class,
130 | Illuminate\Cache\CacheServiceProvider::class,
131 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
132 | Illuminate\Cookie\CookieServiceProvider::class,
133 | Illuminate\Database\DatabaseServiceProvider::class,
134 | Illuminate\Encryption\EncryptionServiceProvider::class,
135 | Illuminate\Filesystem\FilesystemServiceProvider::class,
136 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
137 | Illuminate\Hashing\HashServiceProvider::class,
138 | Illuminate\Mail\MailServiceProvider::class,
139 | Illuminate\Notifications\NotificationServiceProvider::class,
140 | Illuminate\Pagination\PaginationServiceProvider::class,
141 | Illuminate\Pipeline\PipelineServiceProvider::class,
142 | Illuminate\Queue\QueueServiceProvider::class,
143 | Illuminate\Redis\RedisServiceProvider::class,
144 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
145 | Illuminate\Session\SessionServiceProvider::class,
146 | Illuminate\Translation\TranslationServiceProvider::class,
147 | Illuminate\Validation\ValidationServiceProvider::class,
148 | Illuminate\View\ViewServiceProvider::class,
149 |
150 | /*
151 | * Package Service Providers...
152 | */
153 |
154 | /*
155 | * Application Service Providers...
156 | */
157 | App\Providers\AppServiceProvider::class,
158 | App\Providers\AuthServiceProvider::class,
159 | // App\Providers\BroadcastServiceProvider::class,
160 | App\Providers\EventServiceProvider::class,
161 | App\Providers\RouteServiceProvider::class,
162 |
163 | ],
164 |
165 | /*
166 | |--------------------------------------------------------------------------
167 | | Class Aliases
168 | |--------------------------------------------------------------------------
169 | |
170 | | This array of class aliases will be registered when this application
171 | | is started. However, feel free to register as many as you wish as
172 | | the aliases are "lazy" loaded so they don't hinder performance.
173 | |
174 | */
175 |
176 | 'aliases' => [
177 |
178 | 'App' => Illuminate\Support\Facades\App::class,
179 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
180 | 'Auth' => Illuminate\Support\Facades\Auth::class,
181 | 'Blade' => Illuminate\Support\Facades\Blade::class,
182 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
183 | 'Bus' => Illuminate\Support\Facades\Bus::class,
184 | 'Cache' => Illuminate\Support\Facades\Cache::class,
185 | 'Config' => Illuminate\Support\Facades\Config::class,
186 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
187 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
188 | 'DB' => Illuminate\Support\Facades\DB::class,
189 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
190 | 'Event' => Illuminate\Support\Facades\Event::class,
191 | 'File' => Illuminate\Support\Facades\File::class,
192 | 'Gate' => Illuminate\Support\Facades\Gate::class,
193 | 'Hash' => Illuminate\Support\Facades\Hash::class,
194 | 'Lang' => Illuminate\Support\Facades\Lang::class,
195 | 'Log' => Illuminate\Support\Facades\Log::class,
196 | 'Mail' => Illuminate\Support\Facades\Mail::class,
197 | 'Notification' => Illuminate\Support\Facades\Notification::class,
198 | 'Password' => Illuminate\Support\Facades\Password::class,
199 | 'Queue' => Illuminate\Support\Facades\Queue::class,
200 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
201 | 'Redis' => Illuminate\Support\Facades\Redis::class,
202 | 'Request' => Illuminate\Support\Facades\Request::class,
203 | 'Response' => Illuminate\Support\Facades\Response::class,
204 | 'Route' => Illuminate\Support\Facades\Route::class,
205 | 'Schema' => Illuminate\Support\Facades\Schema::class,
206 | 'Session' => Illuminate\Support\Facades\Session::class,
207 | 'Storage' => Illuminate\Support\Facades\Storage::class,
208 | 'URL' => Illuminate\Support\Facades\URL::class,
209 | 'Validator' => Illuminate\Support\Facades\Validator::class,
210 | 'View' => Illuminate\Support\Facades\View::class,
211 |
212 | ],
213 |
214 | ];
215 |
--------------------------------------------------------------------------------
/config/tenancy.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | *
11 | * @see https://laravel-tenancy.com
12 | * @see https://github.com/hyn/multi-tenant
13 | */
14 |
15 | use Hyn\Tenancy\Database\Connection;
16 |
17 | return [
18 | 'models' => [
19 | /**
20 | * Specify different models to be used for the global, system database
21 | * connection. These are also used in their relationships. Models
22 | * used have to implement their respective contracts and
23 | * either extend the SystemModel or use the trait
24 | * UsesSystemConnection.
25 | */
26 |
27 | // Must implement \Hyn\Tenancy\Contracts\Hostname
28 | 'hostname' => \Hyn\Tenancy\Models\Hostname::class,
29 |
30 | // Must implement \Hyn\Tenancy\Contracts\Website
31 | 'website' => \Hyn\Tenancy\Models\Website::class
32 | ],
33 | /**
34 | * The package middleware. Removing a middleware here will disable it.
35 | * You can of course extend/replace them or add your own.
36 | */
37 | 'middleware' => [
38 | // The eager identification middleware.
39 | \Hyn\Tenancy\Middleware\EagerIdentification::class,
40 |
41 | // The hostname actions middleware (redirects, https, maintenance).
42 | \Hyn\Tenancy\Middleware\HostnameActions::class,
43 | ],
44 | 'website' => [
45 | /**
46 | * Each website has a short random hash that identifies this entity
47 | * to the application. By default this id is randomized and fully
48 | * auto-generated. In case you want to force your own logic for
49 | * when you need to have a better overview of the complete
50 | * tenant folder structure, disable this and implement
51 | * your own id generation logic.
52 | */
53 | 'disable-random-id' => false,
54 |
55 | /**
56 | * The random Id generator is responsible for creating the hash as mentioned
57 | * above. You can override what generator to use by modifying this value
58 | * in the configuration.
59 | *
60 | * @warn This won't work if disable-random-id is true.
61 | */
62 | 'random-id-generator' => Hyn\Tenancy\Generators\Uuid\ShaGenerator::class,
63 |
64 | /**
65 | * Enable this flag in case you're using a driver that does not support
66 | * database username or database name with a length of more than 32 characters.
67 | *
68 | * This should be enabled for MySQL, but not for MariaDB and PostgreSQL.
69 | */
70 | 'uuid-limit-length-to-32' => env('LIMIT_UUID_LENGTH_32', false),
71 |
72 | /**
73 | * Specify the disk you configured in the filesystems.php file where to store
74 | * the tenant specific files, including media, packages, routes and other
75 | * files for this particular website.
76 | *
77 | * @info If not set, will revert to the default filesystem.
78 | * @info If set to false will disable all tenant specific filesystem auto magic
79 | * like the config, vendor overrides.
80 | */
81 | 'disk' => null,
82 |
83 | /**
84 | * Automatically generate a tenant directory based on the random id of the
85 | * website. Uses the above disk to store files to override system-wide
86 | * files.
87 | *
88 | * @info set to false to disable.
89 | */
90 | 'auto-create-tenant-directory' => true,
91 |
92 | /**
93 | * Automatically rename the tenant directory when the random id of the
94 | * website changes. This should not be too common, but in case it happens
95 | * we automatically want to move files accordingly.
96 | *
97 | * @info set to false to disable.
98 | */
99 | 'auto-rename-tenant-directory' => true,
100 |
101 | /**
102 | * Automatically deletes the tenant specific directory and all files
103 | * contained within.
104 | *
105 | * @see
106 | * @info set to true to enable.
107 | */
108 | 'auto-delete-tenant-directory' => false,
109 |
110 | /**
111 | * Time to cache websites in minutes. Set to false to disable.
112 | */
113 | 'cache' => 10,
114 | ],
115 | 'hostname' => [
116 | /**
117 | * If you want the multi tenant application to fall back to a default
118 | * hostname/website in case the requested hostname was not found
119 | * in the database, complete in detail the default hostname.
120 | *
121 | * @warn this must be a FQDN, these have no protocol or path!
122 | */
123 | 'default' => env('TENANCY_DEFAULT_HOSTNAME'),
124 | /**
125 | * The package is able to identify the requested hostname by itself,
126 | * disable to get full control (and responsibility) over hostname
127 | * identification. The hostname identification is needed to
128 | * set a specific website as currently active.
129 | *
130 | * @see src/Jobs/HostnameIdentification.php
131 | */
132 | 'auto-identification' => env('TENANCY_AUTO_HOSTNAME_IDENTIFICATION', true),
133 |
134 | /**
135 | * In case you want to have the tenancy environment set up early,
136 | * enable this flag. This will run the tenant identification
137 | * inside a middleware. This will eager load tenancy.
138 | *
139 | * A good use case is when you have set "tenant" as the default
140 | * database connection.
141 | */
142 | 'early-identification' => env('TENANCY_EARLY_IDENTIFICATION', false),
143 |
144 | /**
145 | * Abort application execution in case no hostname was identified. This will throw a
146 | * 404 not found in case the tenant hostname was not resolved.
147 | */
148 | 'abort-without-identified-hostname' => false,
149 |
150 | /**
151 | * Time to cache hostnames in minutes. Set to false to disable.
152 | */
153 | 'cache' => 10,
154 |
155 | /**
156 | * Automatically update the app.url configured inside Laravel to match
157 | * the tenant FQDN whenever a hostname/tenant was identified.
158 | *
159 | * This will resolve issues with password reset mails etc using the
160 | * correct domain.
161 | */
162 | 'update-app-url' => true,
163 | ],
164 | 'db' => [
165 | /**
166 | * The default connection to use; this overrules the Laravel database.default
167 | * configuration setting. In Laravel this is normally configured to 'mysql'.
168 | * You can set a environment variable to override the default database
169 | * connection to - for instance - the tenant connection 'tenant'.
170 | */
171 | 'default' => env('TENANCY_DEFAULT_CONNECTION'),
172 | /**
173 | * Used to give names to the system and tenant database connections. By
174 | * default we configure 'system' and 'tenant'. The tenant connection
175 | * is set up automatically by this package.
176 | *
177 | * @see src/Database/Connection.php
178 | * @var system-connection-name The database connection name to use for the global/system database.
179 | * @var tenant-connection-name The database connection name to use for the tenant database.
180 | */
181 | 'system-connection-name' => env('TENANCY_SYSTEM_CONNECTION_NAME', Connection::DEFAULT_SYSTEM_NAME),
182 | 'tenant-connection-name' => env('TENANCY_TENANT_CONNECTION_NAME', Connection::DEFAULT_TENANT_NAME),
183 |
184 | /**
185 | * The tenant division mode specifies to what database websites will be
186 | * connecting. The default setup is to use a new database per tenant.
187 | * In case you prefer to use the same database with a table prefix,
188 | * set the mode to 'prefix'.
189 | *
190 | * @see src/Database/Connection.php
191 | */
192 | 'tenant-division-mode' => env('TENANCY_DATABASE_DIVISION_MODE', 'database'),
193 |
194 | /**
195 | * The database password generator takes care of creating a valid hashed
196 | * string used for tenants to connect to the specific database. Do
197 | * note that this will only work in 'division modes' that set up
198 | * a connection to a separate database.
199 | */
200 | 'password-generator' => Hyn\Tenancy\Generators\Database\DefaultPasswordGenerator::class,
201 |
202 | /**
203 | * The tenant migrations to be run during creation of a tenant. Specify a directory
204 | * to run the migrations from. If specified these migrations will be executed
205 | * whenever a new tenant is created.
206 | *
207 | * @info set to false to disable auto migrating.
208 | *
209 | * @warn this has to be an absolute path, feel free to use helper methods like
210 | * base_path() or database_path() to set this up.
211 | */
212 | 'tenant-migrations-path' => database_path('migrations/tenant'),
213 |
214 | /**
215 | * The default Seeder class used on newly created databases and while
216 | * running artisan commands that fire seeding.
217 | *
218 | * @info requires tenant-migrations-path in order to seed newly created websites.
219 | * @info seeds stored in `database/seeds/tenants` need to be configured in your composer.json classmap.
220 | *
221 | * @warn specify a valid fully qualified class name.
222 | */
223 | 'tenant-seed-class' => false,
224 | // eg an admin seeder under `app/Seeders/AdminSeeder.php`:
225 | // 'tenant-seed-class' => App\Seeders\AdminSeeder::class,
226 |
227 | /**
228 | * Automatically generate a tenant database based on the random id of the
229 | * website.
230 | *
231 | * @info set to false to disable.
232 | */
233 | 'auto-create-tenant-database' => true,
234 |
235 | /**
236 | * Automatically generate the user needed to access the database.
237 | *
238 | * @info Useful in case you use root or another predefined user to access the
239 | * tenant database.
240 | * @info Only creates in case tenant databases are set to be created.
241 | *
242 | * @info set to false to disable.
243 | */
244 | 'auto-create-tenant-database-user' => true,
245 |
246 | /**
247 | * Automatically rename the tenant database when the random id of the
248 | * website changes. This should not be too common, but in case it happens
249 | * we automatically want to move databases accordingly.
250 | *
251 | * @info set to false to disable.
252 | */
253 | 'auto-rename-tenant-database' => true,
254 |
255 | /**
256 | * Automatically deletes the tenant specific database and all data
257 | * contained within.
258 | *
259 | * @info set to true to enable.
260 | */
261 | 'auto-delete-tenant-database' => env('TENANCY_DATABASE_AUTO_DELETE', false),
262 |
263 | /**
264 | * Automatically delete the user needed to access the tenant database.
265 | *
266 | * @info Set to false to disable.
267 | * @info Only deletes in case tenant database is set to be deleted.
268 | */
269 | 'auto-delete-tenant-database-user' => env('TENANCY_DATABASE_AUTO_DELETE_USER', false),
270 |
271 | /**
272 | * Define a list of classes that you wish to force onto the tenant or system connection.
273 | * The connection will be forced when the Model has booted.
274 | *
275 | * @info Useful for overriding the connection of third party packages.
276 | */
277 | 'force-tenant-connection-of-models' => [
278 | // App\User::class
279 | ],
280 | 'force-system-connection-of-models' => [
281 | // App\User::class
282 | ],
283 | ],
284 |
285 | /**
286 | * Global tenant specific routes.
287 | * Making it easier to distinguish between landing and tenant routing.
288 | *
289 | * @info only works with `tenancy.hostname.auto-identification` or identification happening
290 | * before the application is booted (eg inside middleware or the register method of
291 | * service providers).
292 | */
293 | 'routes' => [
294 | /**
295 | * Routes file to load whenever a tenant was identified.
296 | *
297 | * @info Set to false or null to disable.
298 | */
299 | 'path' => base_path('routes/tenants.php'),
300 |
301 | /**
302 | * Set to true to flush all global routes before setting the routes from the
303 | * tenants.php routes file.
304 | */
305 | 'replace-global' => false,
306 | ],
307 |
308 | /**
309 | * Folders configuration specific per tenant.
310 | * The following section relates to configuration to files inside the tenancy/
311 | * tenant directory.
312 | */
313 | 'folders' => [
314 | 'config' => [
315 | /**
316 | * Merge configuration files from the config directory
317 | * inside the tenant directory with the global configuration files.
318 | */
319 | 'enabled' => true,
320 |
321 | /**
322 | * List of configuration files to ignore, preventing override of crucial
323 | * application configurations.
324 | */
325 | 'blacklist' => ['database', 'tenancy', 'webserver'],
326 | ],
327 | 'routes' => [
328 | /**
329 | * Allows adding and overriding URL routes inside the tenant directory.
330 | */
331 | 'enabled' => true,
332 |
333 | /**
334 | * Prefix all tenant routes.
335 | */
336 | 'prefix' => null,
337 | ],
338 | 'trans' => [
339 | /**
340 | * Allows reading translation files from a trans directory inside
341 | * the tenant directory.
342 | */
343 | 'enabled' => true,
344 |
345 | /**
346 | * Will override the global translations with the tenant translations.
347 | * This is done by overriding the laravel default translator with the new path.
348 | */
349 | 'override-global' => true,
350 |
351 | /**
352 | * In case you disabled global override, specify a namespace here to load the
353 | * tenant translation files with.
354 | */
355 | 'namespace' => 'tenant',
356 | ],
357 | 'vendor' => [
358 | /**
359 | * Allows using a custom vendor (composer driven) folder inside
360 | * the tenant directory.
361 | */
362 | 'enabled' => true,
363 | ],
364 | 'media' => [
365 | /**
366 | * Mounts the assets directory with (static) files for public use.
367 | */
368 | 'enabled' => true,
369 | ],
370 | 'views' => [
371 | /**
372 | * Adds the vendor directory of the tenant inside the application.
373 | */
374 | 'enabled' => true,
375 |
376 | /**
377 | * Specify a namespace to use with which to load the views.
378 | *
379 | * @eg setting `tenant` will allow you to use `tenant::some.blade.php`
380 | * @info set to null to add to the global namespace.
381 | */
382 | 'namespace' => null,
383 |
384 | /**
385 | * If `namespace` is set to null (thus using the global namespace)
386 | * make it override the global views. Disable by setting to false.
387 | */
388 | 'override-global' => true,
389 | ]
390 | ]
391 | ];
392 |
--------------------------------------------------------------------------------