I have an eloquent model, that is using a custom table, coming from the user table.
Like so...
class Appointment extends Eloquent
{
public static $table = null;
public function __construct()
{
parent::__construct();
// Here I load the custom table, from the user table
// Pull the prefix of the table, and append
// This works perfectly fine for viewing the data
static::$table = Auth::user()->tenantTable()."_appointments";
}
public static $connection = 'tenant-data';
public static $timestamps = true;
I can pull, and view the data perfectly fine with this setup. So every user, has their own appointment table.
However, if I change anything and then use eloquent save() method. I get a recursive call, that never ends.
What do I need to change in laravels save() method to get this to work?
And do I have to change it in the core?? Or can I override the save() method in the current model? And if so, how?