Is this a correct way to achieve this? What is the simplest to do this? Do you know any kind of resources/packages/libraries for this?
You could look into <github.com/orchestral/tenanti> to handle migrations/schema for tenants.
As for model, I would most likely use
<?php
class Customer extends Eloquent {
public function getTable()
{
return Session::get('tenant.id').'_customers';
}
}
What if there is a scenario that admin needs to view all the customers(or sales) in the entire database? How can I read from all the tables?
Could consider a daily/hourly cron to fetch records for denormalization for reporting purpose. Otherwise it could be a costly process and might affect app performance.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community