Code Monkey home page Code Monkey logo

multitenancy's Introduction

Hi there, I'm Ollie Read


I do a bunch of stuff with PHP & Laravel, which I will endevaour to update this readme with when I can, but right now I'm working on a course for Multitenancy with Laravel.

Here are some stats

Mastodon

multitenancy's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multitenancy's Issues

Tenant identifier appended to the end of URL

When calling Multitenancy::url() the tenant identifier being appended to the end of URL.

Multitenancy::url();
// http://foo.domain.com/foo.domain.com`
Multitenancy::url('/path');
// http://foo.domain.com/path/foo.domain.com`

Error when using session.multi driver

Hi,

First of all thanks for this awesome package! Love it, probably the best and easiest multitenant package so far.

Everything works perfectly except when using session.multi driver, after logged in I got following error.

FatalThrowableError in SessionGuard.php line 23:
Call to a member function getPrimaryIdentifier() on null

Demo

Hi,

Is it possible that you create a little Demo app for better understanding?

Undefined method getTenantKey()

Hello @ollieread thanks for this package. I think it's actually the best Laravel multitenancy package.

Inside your Eloquent global scope TenantOwnedScope there is a call to an unimplemented method getTenantKey() to retrieve the FK to the tenant table in the current eloquent model.

public function apply(Builder $builder, Model $model)
    {
        $builder->where(   $model->getTenantKey()    , '=', Multitenancy::tenant()->id);
    }

It's not implemented and you do not talk about it in documentation. For now I resolved implementing another trait called BelongsToTenant that use your original eloquent trait and implement getTenantKey() method.

trait BelongsToTenant
{
    use TenantOwned;

    public function getTenantKey()
    {
        return 'company_id';
    }
}

I think that tenant FK should be the same in any table and could be a good idea to implement this method yourself in TenantOwned trait to return a fixed value from config file for example.

if i understand something wrong i thank you if you want to help me.

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.