Comments (4)
That's a good point, I'll add something like that to docs.
from tenancy.
storage_path()
is fixed now, but asset()
is problematic.
asset("storage/images/products/$product_id.png");
This shows that any tenant can access any other tenant's files in the public storage. Therefore, a controller is likely necessary. Changing the symlink wouldn't work because there would be issues if two users were connected to two different tenant sites at the same time.
from tenancy.
Using a controller fixes the issue, but consider this: if one of these assets is the tenant's logo, now you require to call that controller also when the logo is requested, which will be at least one time on the page! This means that the whole app will run at least twice, one for the requested controller, and another for the logo itself! Which I think isn't efficient.
My solution is to separate files like this into a global (public) disk, where "logos" (in this scenario) is stored all together, and each tenant's logo is requested by its id.
/**
* @return string
*/
public static function logo(){
return \Storage::disk('app-public')->url('tenants/logos/' . tenant()->id . '.png');
}
What do you think?
from tenancy.
from tenancy.
Related Issues (20)
- Laravel 11 cannot access subdomain on multi-database setup HOT 1
- Issue with Laravel Nova Image not compatible with subdomain HOT 1
- Reset Password for Tenant not working HOT 1
- Preventing Timestamps from Being Auto-inserted into the data Column HOT 1
- Unable to seed spatie/laravel permission across multiple tenancy databases HOT 5
- Undefined constant RedisCluster::OPT_PREFIX HOT 5
- With laravel breeze and react ,Inertia.js not working after installing the package HOT 1
- Wrong domain url when on queue HOT 2
- Jestream Laravel Tenacy HOT 5
- InitializeTenancyByPath with livewire within tenant context throws exception HOT 8
- Make runForMultiple yield the callbacks return HOT 5
- Sugestion new Middleware
- Pass tenant to handle when using TenantAwareCommand trait HOT 2
- Route helper in job doesn't use tenant context domain HOT 5
- Tenancy is not working for Livewire HOT 4
- Nested sub domain HOT 3
- Could Not Switch tenants when using Aritsan command HOT 1
- 3.8.3 ViteBundler incompatibility with Laravel 9 HOT 3
- laravel 10 support HOT 1
- LOG.warning tenantIdColumn is deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tenancy.