1
|
|
|
<?php namespace App\Services\Routing; |
2
|
|
|
|
3
|
|
|
use Illuminate\Routing\ResourceRegistrar; |
4
|
|
|
|
5
|
|
|
class LocalizedResourceRegistrar extends ResourceRegistrar |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The default actions for a resourceful controller. |
9
|
|
|
* |
10
|
|
|
* @var array |
11
|
|
|
*/ |
12
|
|
|
protected $resourceDefaults = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy']; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Add the create method for a resourceful route. |
16
|
|
|
* |
17
|
|
|
* @param string $name |
18
|
|
|
* @param string $base |
19
|
|
|
* @param string $controller |
20
|
|
|
* @param array $options |
21
|
|
|
* |
22
|
|
|
* @return \Illuminate\Routing\Route |
23
|
|
|
*/ |
24
|
19 |
|
protected function addResourceCreate($name, $base, $controller, $options) |
25
|
|
|
{ |
26
|
19 |
|
$uri = $this->getResourceUri($name) . '/' . app('translator')->get('routes..resources.create'); |
27
|
|
|
|
28
|
19 |
|
$action = $this->getResourceAction($name, $controller, 'create', $options); |
29
|
|
|
|
30
|
19 |
|
return $this->router->get($uri, $action); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Add the edit method for a resourceful route. |
35
|
|
|
* |
36
|
|
|
* @param string $name |
37
|
|
|
* @param string $base |
38
|
|
|
* @param string $controller |
39
|
|
|
* @param array $options |
40
|
|
|
* |
41
|
|
|
* @return \Illuminate\Routing\Route |
42
|
|
|
*/ |
43
|
|
|
protected function addResourceEdit($name, $base, $controller, $options) |
44
|
|
|
{ |
45
|
|
|
$uri = $this->getResourceUri($name) . '/{' . $base . '}/' . app('translator')->get('routes..resources.edit'); |
46
|
|
|
|
47
|
|
|
$action = $this->getResourceAction($name, $controller, 'edit', $options); |
48
|
|
|
|
49
|
|
|
return $this->router->get($uri, $action); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|