From 60282b75b348c59f6e46d05c890848a284cce0f7 Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Mon, 5 Mar 2018 09:02:20 +0800 Subject: [PATCH] Update model stub for nameLink method Changed $this->id to $this, so laravel will figured out the route name key by it self --- src/stubs/model.stub | 2 +- tests/Generators/ModelGeneratorTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/stubs/model.stub b/src/stubs/model.stub index f36440c..761c0a7 100644 --- a/src/stubs/model.stub +++ b/src/stubs/model.stub @@ -11,7 +11,7 @@ class Master extends Model public function nameLink() { - return link_to_route('masters.show', $this->name, [$this->id], [ + return link_to_route('masters.show', $this->name, [$this], [ 'title' => trans( 'app.show_detail_title', ['name' => $this->name, 'type' => trans('master.master')] diff --git a/tests/Generators/ModelGeneratorTest.php b/tests/Generators/ModelGeneratorTest.php index e2aea6d..1f71dd8 100644 --- a/tests/Generators/ModelGeneratorTest.php +++ b/tests/Generators/ModelGeneratorTest.php @@ -26,7 +26,7 @@ class {$this->model_name} extends Model public function nameLink() { - return link_to_route('{$this->table_name}.show', \$this->name, [\$this->id], [ + return link_to_route('{$this->table_name}.show', \$this->name, [\$this], [ 'title' => trans( 'app.show_detail_title', ['name' => \$this->name, 'type' => trans('{$this->lang_name}.{$this->lang_name}')] @@ -63,7 +63,7 @@ class Category extends Model public function nameLink() { - return link_to_route('categories.show', \$this->name, [\$this->id], [ + return link_to_route('categories.show', \$this->name, [\$this], [ 'title' => trans( 'app.show_detail_title', ['name' => \$this->name, 'type' => trans('category.category')]