Skip to content

Commit 5074e49

Browse files
committed
Refactor test Model
1 parent 1958030 commit 5074e49

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/Stubs/Model.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,28 @@
33
namespace CodeZero\LocalizedRoutes\Tests\Stubs;
44

55
use Illuminate\Database\Eloquent\Model as BaseModel;
6+
use Illuminate\Support\Facades\App;
67

78
class Model extends BaseModel
89
{
10+
/**
11+
* Fake localized slugs.
12+
*
13+
* @var array
14+
*/
15+
protected $slugs = [
16+
'en' => 'en-slug',
17+
'nl' => 'nl-slug',
18+
];
19+
20+
/**
21+
* Fake localized route key.
22+
*
23+
* @return mixed
24+
*/
925
public function getRouteKey()
1026
{
11-
$slugs = [
12-
'en' => 'en-slug',
13-
'nl' => 'nl-slug',
14-
];
27+
return $this->slugs[App::getLocale()];
1528

16-
return $slugs[app()->getLocale()];
1729
}
1830
}

0 commit comments

Comments
 (0)