LocalizedResourceRegistrar::addResourceCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 4
crap 1
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