orchestral / tenanti

[Package] Multi-tenant Database Schema Manager for Laravel
MIT License
588 stars 52 forks source link

Noob question about getting data #53

Closed blomdahldaniel closed 7 years ago

blomdahldaniel commented 7 years ago

Hello! This might be bit out of scope but still very much relevant for this project and there should be more documentation for this.. Or am I just missing it..?

So, I have the project set up and for now it works perfectly! However I really don't understand how to retrieve the data/eloquent relationships..

Example:

I have users Each user has multiple posts. The posts are stored in tenant tables. So the user with id of 1 has his posts inside users_1_posts table.

How do I set up the relationship so that for class User

class User extends Authenticatable
{
    //...
    public function posts()
    {
        return $this->hasMany(\App\Post::class);
    }
}

It would be very fitting to give some examples of how to deal with the data fetching/connections together with this package.

crynobone commented 7 years ago

It not going to be covered by this packages as this requires deep modification of Eloquent, and I'm not up for that.

blomdahldaniel commented 7 years ago

Yes.. I understand that it means that Eloquent would have to be modified a lot.. So... Its pretty hard to actually use this package with a standard app for laravel...? At least if your going to use relationships..?