我有一個雄辯的模型,即使用來自用戶表的自定義表。帶自定義表的模型不保存,在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 :) –