From 989b73c1eb4ad08cfb943f1cfc925913e284910c Mon Sep 17 00:00:00 2001 From: Roman Igoshin Date: Mon, 27 Nov 2017 13:58:10 +0200 Subject: [PATCH] set table name for better performance --- src/Illuminate/Database/Eloquent/Model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Database/Eloquent/Model.php b/src/Illuminate/Database/Eloquent/Model.php index 0e0c6f933e5b..9098616dc4d7 100644 --- a/src/Illuminate/Database/Eloquent/Model.php +++ b/src/Illuminate/Database/Eloquent/Model.php @@ -1155,7 +1155,9 @@ public static function unsetConnectionResolver() public function getTable() { if (! isset($this->table)) { - return str_replace('\\', '', Str::snake(Str::plural(class_basename($this)))); + $this->setTable(str_replace( + '\\', '', Str::snake(Str::plural(class_basename($this))) + )); } return $this->table;