1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 08:44:02 +00:00

Add documentation for tenant_asset()

This commit is contained in:
Samuel Štancl 2019-01-20 15:03:11 +01:00 committed by GitHub
parent 94aee1e485
commit a8523871db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,12 +4,14 @@
### *A Laravel multi-database tenancy implementation that respects your code.*
You won't have to change a thing in your application's code.
You won't have to change a thing in your application's code.\*
- :white_check_mark: No model traits to change database connection
- :white_check_mark: No replacing of Laravel classes (`Cache`, `Storage`, ...) with tenancy-aware classes
- :white_check_mark: Built-in tenant identification based on hostname
\* depending on how you use the filesystem. Be sure to read [that section](#Filesystem). Everything else will work out of the box.
## Installation
### Installing the package
@ -356,6 +358,23 @@ The `local` filesystem driver will be suffixed with a directory containing `tena
=> "/var/www/laravel/multitenancy/storage/app/tenantdbe0b330-1a6e-11e9-b4c3-354da4b4f339/"
```
`storage_path()` will also be suffixed in the same way. Note that this means that each tenant will have their own storage directory.
![The folder structure](https://i.imgur.com/GAXQOnN.png)
If you write to these directories, you will need to create them after you create the tenant. See the docs for [PHP's mkdir](http://php.net/function.mkdir).
Logs will be saved to `storage/logs` regardless of any changes to `storage_path()`.
One thing that you **will** have to change if you use storage similarly to the example on the image is your usage of the helper function `asset()` (that is, if you use it).
You need to make this change to your code:
```diff
- asset("storage/images/products/$product_id.png");
+ tenant_asset("images/products/$product_id.png");
```
## Artisan commands
```