Giter VIP home page Giter VIP logo

Comments (4)

stancl avatar stancl commented on June 7, 2024 1

That's a good point, I'll add something like that to docs.

from tenancy.

stancl avatar stancl commented on June 7, 2024

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.

tamkeen-tms avatar tamkeen-tms commented on June 7, 2024

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.

stancl avatar stancl commented on June 7, 2024

stancl/tenancy-docs@cffbb8d

from tenancy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.