Browse Source

Update model stub for nameLink method

Changed $this->id to $this, so laravel will figured out
the route name key by it self
tags/1.0.3
Nafies Luthfi 8 years ago
parent
commit
60282b75b3
  1. 2
      src/stubs/model.stub
  2. 4
      tests/Generators/ModelGeneratorTest.php

2
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')]

4
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')]

Loading…
Cancel
Save