問題:
I'm in the process of converting one of our web applications from CodeIgniter to Laravel.我正在將我們的一個 Web 應用程序從 CodeIgniter 轉換爲 Laravel。 However at this moment we don't want to add the updated_at
/ created_at
fields to all of our tables as we have a logging class that does all this in more depth for us already.然而,此時我們不想將updated_at
/ created_at
字段添加到我們所有的表中,因爲我們有一個日誌類已經爲我們更深入地完成了所有這些工作。
I'm aware I can set $timestamps = false;
我知道我可以設置$timestamps = false;
in:在:
Vendor\laravel\framework\src\illuminate\Datebase\Eloquent\Model.php
However I'd rather not change a core file for Laravel, or have everyone of my models have that at the top.但是,我寧願不更改 Laravel 的核心文件,也不想讓我的每個模型都將其放在頂部。 Is there any way to disable this elsewhere for all models?有沒有辦法在其他地方爲所有型號禁用此功能?
解決方案:
參考一: https://en.stackoom.com/question/1Lefd參考二: https://stackoom.com/question/1Lefd