|
1
|
|
|
<?php namespace Arcanesoft\Core\Bases; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider; |
|
4
|
|
|
use Closure; |
|
5
|
|
|
use Illuminate\Support\Arr; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class RouteServiceProvider |
|
9
|
|
|
* |
|
10
|
|
|
* @package Arcanesoft\Support\Providers |
|
11
|
|
|
* @author ARCANEDEV <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
|
abstract class RouteServiceProvider extends ServiceProvider |
|
14
|
|
|
{ |
|
15
|
|
|
/* ----------------------------------------------------------------- |
|
16
|
|
|
| Properties |
|
17
|
|
|
| ----------------------------------------------------------------- |
|
18
|
|
|
*/ |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* The admin controller namespace for the application. |
|
22
|
|
|
* |
|
23
|
|
|
* @var string|null |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $adminNamespace; |
|
26
|
|
|
|
|
27
|
|
|
/* ----------------------------------------------------------------- |
|
28
|
|
|
| Getters & Setters |
|
29
|
|
|
| ----------------------------------------------------------------- |
|
30
|
|
|
*/ |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Get the config repository instance. |
|
34
|
|
|
* |
|
35
|
|
|
* @return \Illuminate\Contracts\Config\Repository |
|
36
|
|
|
*/ |
|
37
|
|
|
protected function config() |
|
38
|
|
|
{ |
|
39
|
|
|
return $this->app['config']; |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Get the admin route attributes. |
|
44
|
|
|
* |
|
45
|
|
|
* @return array |
|
46
|
|
|
*/ |
|
47
|
|
|
protected function getAdminAttributes() |
|
48
|
|
|
{ |
|
49
|
|
|
return $this->config()->get('arcanesoft.core.admin', []); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/* ----------------------------------------------------------------- |
|
53
|
|
|
| Main Methods |
|
54
|
|
|
| ----------------------------------------------------------------- |
|
55
|
|
|
*/ |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* Group the routes with admin attributes. |
|
59
|
|
|
* |
|
60
|
|
|
* @param \Closure $callback |
|
61
|
|
|
*/ |
|
62
|
|
|
protected function adminGroup(Closure $callback) |
|
63
|
|
|
{ |
|
64
|
|
|
$attributes = $this->getAdminAttributes(); |
|
65
|
|
|
|
|
66
|
|
|
$this->prefix(Arr::get($attributes, 'prefix', 'dashboard')) |
|
67
|
|
|
->name(Arr::get($attributes, 'name', 'admin::')) |
|
68
|
|
|
->namespace($this->adminNamespace) |
|
69
|
|
|
->middleware(Arr::get($attributes, 'middleware', ['web', 'auth', 'admin'])) |
|
70
|
|
|
->group($callback); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|