我有一个雄辩的模型,即使用来自用户表的自定义表。带自定义表的模型不保存,在Laravel 3
是这样的...
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;
我可以拉,并查看数据与此设置完美的罚款。所以每个用户都有自己的预约表。
但是,如果我改变任何东西,然后使用雄辩的save()方法。我得到一个递归调用,永远不会结束。
我需要更改laravels save()方法才能使其工作?
我必须改变它在核心?或者我可以重写当前模型中的save()方法吗?如果是这样,怎么样?
你真的在使用Laravel 3吗? Laravel 5现在不在了。 – ceejayoz
@ceejayoz Im意识到....但我并不是要移植整个网站而已。只需添加一些多租户添加。没有时间或资源。 – KyleK
好问题。我不知道有多少人还记得Laravel 3 :) –