diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index c8522beb..fc7b0380 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -1,5 +1,6 @@ exists or $this->original !== $this->attributes; } + /** + * Get the name of the table associated with the model. + * + * @return string + */ + public function table() + { + return static::$table ?: strtolower(Str::plural(basename(get_class($this)))); + } + /** * Get the dirty attributes for the model. * diff --git a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php index 7f3c01b0..23b8765a 100644 --- a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php +++ b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php @@ -1,5 +1,6 @@ model->get_timestamp(); $attributes['updated_at'] = $attributes['created_at'];