@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class Notifications extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('notifications', function (Blueprint $table) { |
|
17 | - $table->uuid('id')->primary(); |
|
18 | - $table->string('type'); |
|
19 | - $table->morphs('notifiable'); |
|
20 | - $table->text('data'); |
|
21 | - $table->timestamp('read_at')->nullable(); |
|
22 | - $table->timestamps(); |
|
23 | - }); |
|
24 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('notifications', function (Blueprint $table) { |
|
17 | + $table->uuid('id')->primary(); |
|
18 | + $table->string('type'); |
|
19 | + $table->morphs('notifiable'); |
|
20 | + $table->text('data'); |
|
21 | + $table->timestamp('read_at')->nullable(); |
|
22 | + $table->timestamps(); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('notifications'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('notifications'); |
|
34 | + } |
|
35 | 35 | } |
@@ -6,30 +6,30 @@ |
||
6 | 6 | |
7 | 7 | class CreateFailedJobsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('failed_jobs', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->text('connection'); |
|
19 | - $table->text('queue'); |
|
20 | - $table->longText('payload'); |
|
21 | - $table->longText('exception'); |
|
22 | - $table->timestamp('failed_at')->useCurrent(); |
|
23 | - }); |
|
24 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('failed_jobs', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->text('connection'); |
|
19 | + $table->text('queue'); |
|
20 | + $table->longText('payload'); |
|
21 | + $table->longText('exception'); |
|
22 | + $table->timestamp('failed_at')->useCurrent(); |
|
23 | + }); |
|
24 | + } |
|
25 | 25 | |
26 | - /** |
|
27 | - * Reverse the migrations. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - public function down() |
|
32 | - { |
|
33 | - Schema::dropIfExists('failed_jobs'); |
|
34 | - } |
|
26 | + /** |
|
27 | + * Reverse the migrations. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + public function down() |
|
32 | + { |
|
33 | + Schema::dropIfExists('failed_jobs'); |
|
34 | + } |
|
35 | 35 | } |
@@ -2,117 +2,117 @@ |
||
2 | 2 | |
3 | 3 | class CachingDecorator |
4 | 4 | { |
5 | - /** |
|
6 | - * The repo implementation. |
|
7 | - * |
|
8 | - * @var string |
|
9 | - */ |
|
10 | - public $repo; |
|
5 | + /** |
|
6 | + * The repo implementation. |
|
7 | + * |
|
8 | + * @var string |
|
9 | + */ |
|
10 | + public $repo; |
|
11 | 11 | |
12 | - /** |
|
13 | - * The cache implementation. |
|
14 | - * |
|
15 | - * @var object |
|
16 | - */ |
|
17 | - protected $cache; |
|
12 | + /** |
|
13 | + * The cache implementation. |
|
14 | + * |
|
15 | + * @var object |
|
16 | + */ |
|
17 | + protected $cache; |
|
18 | 18 | |
19 | - /** |
|
20 | - * The modelKey implementation. |
|
21 | - * |
|
22 | - * @var string |
|
23 | - */ |
|
24 | - public $modelKey; |
|
19 | + /** |
|
20 | + * The modelKey implementation. |
|
21 | + * |
|
22 | + * @var string |
|
23 | + */ |
|
24 | + public $modelKey; |
|
25 | 25 | |
26 | - /** |
|
27 | - * The model implementation. |
|
28 | - * |
|
29 | - * @var string |
|
30 | - */ |
|
31 | - public $model; |
|
26 | + /** |
|
27 | + * The model implementation. |
|
28 | + * |
|
29 | + * @var string |
|
30 | + */ |
|
31 | + public $model; |
|
32 | 32 | |
33 | - /** |
|
34 | - * The modelClass implementation. |
|
35 | - * |
|
36 | - * @var string |
|
37 | - */ |
|
38 | - public $modelClass; |
|
33 | + /** |
|
34 | + * The modelClass implementation. |
|
35 | + * |
|
36 | + * @var string |
|
37 | + */ |
|
38 | + public $modelClass; |
|
39 | 39 | |
40 | - /** |
|
41 | - * The cacheConfig implementation. |
|
42 | - * |
|
43 | - * @var array |
|
44 | - */ |
|
45 | - public $cacheConfig; |
|
40 | + /** |
|
41 | + * The cacheConfig implementation. |
|
42 | + * |
|
43 | + * @var array |
|
44 | + */ |
|
45 | + public $cacheConfig; |
|
46 | 46 | |
47 | - /** |
|
48 | - * The cacheTag implementation. |
|
49 | - * |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - public $cacheTag; |
|
47 | + /** |
|
48 | + * The cacheTag implementation. |
|
49 | + * |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + public $cacheTag; |
|
53 | 53 | |
54 | - /** |
|
55 | - * Create new CachingDecorator instance. |
|
56 | - */ |
|
57 | - public function __construct($repo, $cache) |
|
58 | - { |
|
59 | - $this->repo = $repo; |
|
60 | - $this->cache = $cache; |
|
61 | - $this->model = $this->repo->model; |
|
62 | - $this->modelClass = get_class($this->model); |
|
63 | - $repoClass = explode('\\', get_class($this->repo)); |
|
64 | - $repoName = end($repoClass); |
|
65 | - $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
66 | - } |
|
54 | + /** |
|
55 | + * Create new CachingDecorator instance. |
|
56 | + */ |
|
57 | + public function __construct($repo, $cache) |
|
58 | + { |
|
59 | + $this->repo = $repo; |
|
60 | + $this->cache = $cache; |
|
61 | + $this->model = $this->repo->model; |
|
62 | + $this->modelClass = get_class($this->model); |
|
63 | + $repoClass = explode('\\', get_class($this->repo)); |
|
64 | + $repoName = end($repoClass); |
|
65 | + $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Handle the cache mechanism for the called method |
|
70 | - * based the configurations. |
|
71 | - * |
|
72 | - * @param string $name the called method name |
|
73 | - * @param array $arguments the method arguments |
|
74 | - * @return object |
|
75 | - */ |
|
76 | - public function __call($name, $arguments) |
|
77 | - { |
|
78 | - $this->setCacheConfig($name); |
|
68 | + /** |
|
69 | + * Handle the cache mechanism for the called method |
|
70 | + * based the configurations. |
|
71 | + * |
|
72 | + * @param string $name the called method name |
|
73 | + * @param array $arguments the method arguments |
|
74 | + * @return object |
|
75 | + */ |
|
76 | + public function __call($name, $arguments) |
|
77 | + { |
|
78 | + $this->setCacheConfig($name); |
|
79 | 79 | |
80 | - if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
81 | - { |
|
82 | - $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
83 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
84 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
85 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
86 | - }); |
|
87 | - } |
|
88 | - else if ($this->cacheConfig) |
|
89 | - { |
|
90 | - $this->cache->tags($this->cacheConfig)->flush(); |
|
91 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
92 | - } |
|
80 | + if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
81 | + { |
|
82 | + $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
83 | + $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
84 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
85 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
86 | + }); |
|
87 | + } |
|
88 | + else if ($this->cacheConfig) |
|
89 | + { |
|
90 | + $this->cache->tags($this->cacheConfig)->flush(); |
|
91 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
92 | + } |
|
93 | 93 | |
94 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
95 | - } |
|
94 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Set cache config based on the called method. |
|
99 | - * |
|
100 | - * @param string $name |
|
101 | - * @return void |
|
102 | - */ |
|
103 | - private function setCacheConfig($name) |
|
104 | - { |
|
105 | - $config = \CoreConfig::getConfig(); |
|
106 | - $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
107 | - $this->cacheConfig = false; |
|
97 | + /** |
|
98 | + * Set cache config based on the called method. |
|
99 | + * |
|
100 | + * @param string $name |
|
101 | + * @return void |
|
102 | + */ |
|
103 | + private function setCacheConfig($name) |
|
104 | + { |
|
105 | + $config = \CoreConfig::getConfig(); |
|
106 | + $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
107 | + $this->cacheConfig = false; |
|
108 | 108 | |
109 | - if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
110 | - { |
|
111 | - $this->cacheConfig = 'cache'; |
|
112 | - } |
|
113 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
114 | - { |
|
115 | - $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
116 | - } |
|
117 | - } |
|
109 | + if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
110 | + { |
|
111 | + $this->cacheConfig = 'cache'; |
|
112 | + } |
|
113 | + else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
114 | + { |
|
115 | + $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
116 | + } |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | \ No newline at end of file |
@@ -13,21 +13,21 @@ discard block |
||
13 | 13 | public function up() |
14 | 14 | { |
15 | 15 | Schema::create('groups', function (Blueprint $table) { |
16 | - $table->increments('id'); |
|
17 | - $table->string('name',100)->unique(); |
|
18 | - $table->softDeletes(); |
|
19 | - $table->timestamps(); |
|
20 | - }); |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name',100)->unique(); |
|
18 | + $table->softDeletes(); |
|
19 | + $table->timestamps(); |
|
20 | + }); |
|
21 | 21 | |
22 | - Schema::create('users_groups', function (Blueprint $table) { |
|
23 | - $table->increments('id'); |
|
24 | - $table->integer('user_id'); |
|
25 | - $table->integer('group_id'); |
|
26 | - $table->softDeletes(); |
|
27 | - $table->timestamps(); |
|
22 | + Schema::create('users_groups', function (Blueprint $table) { |
|
23 | + $table->increments('id'); |
|
24 | + $table->integer('user_id'); |
|
25 | + $table->integer('group_id'); |
|
26 | + $table->softDeletes(); |
|
27 | + $table->timestamps(); |
|
28 | 28 | |
29 | - $table->index(['user_id']); |
|
30 | - }); |
|
29 | + $table->index(['user_id']); |
|
30 | + }); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Create Default groups. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'created_at' => \DB::raw('NOW()'), |
55 | 55 | 'updated_at' => \DB::raw('NOW()') |
56 | 56 | ] |
57 | - ); |
|
57 | + ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -6,94 +6,94 @@ |
||
6 | 6 | |
7 | 7 | class GroupsTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to groups table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Groups model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'save', |
|
26 | - 'model' => 'groups', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'delete', |
|
32 | - 'model' => 'groups', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'find', |
|
38 | - 'model' => 'groups', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'search', |
|
44 | - 'model' => 'groups', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'list', |
|
50 | - 'model' => 'groups', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'findby', |
|
56 | - 'model' => 'groups', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'first', |
|
62 | - 'model' => 'groups', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'paginate', |
|
68 | - 'model' => 'groups', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - [ |
|
73 | - 'name' => 'paginateby', |
|
74 | - 'model' => 'groups', |
|
75 | - 'created_at' => \DB::raw('NOW()'), |
|
76 | - 'updated_at' => \DB::raw('NOW()') |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'name' => 'assignpermissions', |
|
80 | - 'model' => 'groups', |
|
81 | - 'created_at' => \DB::raw('NOW()'), |
|
82 | - 'updated_at' => \DB::raw('NOW()') |
|
83 | - ], |
|
84 | - [ |
|
85 | - 'name' => 'deleted', |
|
86 | - 'model' => 'groups', |
|
87 | - 'created_at' => \DB::raw('NOW()'), |
|
88 | - 'updated_at' => \DB::raw('NOW()') |
|
89 | - ], |
|
90 | - [ |
|
91 | - 'name' => 'restore', |
|
92 | - 'model' => 'groups', |
|
93 | - 'created_at' => \DB::raw('NOW()'), |
|
94 | - 'updated_at' => \DB::raw('NOW()') |
|
95 | - ] |
|
96 | - ] |
|
97 | - ); |
|
98 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to groups table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Groups model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'save', |
|
26 | + 'model' => 'groups', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'delete', |
|
32 | + 'model' => 'groups', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'find', |
|
38 | + 'model' => 'groups', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'search', |
|
44 | + 'model' => 'groups', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'list', |
|
50 | + 'model' => 'groups', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'findby', |
|
56 | + 'model' => 'groups', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'first', |
|
62 | + 'model' => 'groups', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'paginate', |
|
68 | + 'model' => 'groups', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + [ |
|
73 | + 'name' => 'paginateby', |
|
74 | + 'model' => 'groups', |
|
75 | + 'created_at' => \DB::raw('NOW()'), |
|
76 | + 'updated_at' => \DB::raw('NOW()') |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'name' => 'assignpermissions', |
|
80 | + 'model' => 'groups', |
|
81 | + 'created_at' => \DB::raw('NOW()'), |
|
82 | + 'updated_at' => \DB::raw('NOW()') |
|
83 | + ], |
|
84 | + [ |
|
85 | + 'name' => 'deleted', |
|
86 | + 'model' => 'groups', |
|
87 | + 'created_at' => \DB::raw('NOW()'), |
|
88 | + 'updated_at' => \DB::raw('NOW()') |
|
89 | + ], |
|
90 | + [ |
|
91 | + 'name' => 'restore', |
|
92 | + 'model' => 'groups', |
|
93 | + 'created_at' => \DB::raw('NOW()'), |
|
94 | + 'updated_at' => \DB::raw('NOW()') |
|
95 | + ] |
|
96 | + ] |
|
97 | + ); |
|
98 | + } |
|
99 | 99 | } |
@@ -6,112 +6,112 @@ |
||
6 | 6 | |
7 | 7 | class UsersTableSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - /** |
|
17 | - * Insert the permissions related to users table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Users model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'save', |
|
26 | - 'model' => 'users', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'delete', |
|
32 | - 'model' => 'users', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'find', |
|
38 | - 'model' => 'users', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'list', |
|
44 | - 'model' => 'users', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'search', |
|
50 | - 'model' => 'users', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'findby', |
|
56 | - 'model' => 'users', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'first', |
|
62 | - 'model' => 'users', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'paginate', |
|
68 | - 'model' => 'users', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - [ |
|
73 | - 'name' => 'paginateby', |
|
74 | - 'model' => 'users', |
|
75 | - 'created_at' => \DB::raw('NOW()'), |
|
76 | - 'updated_at' => \DB::raw('NOW()') |
|
77 | - ], |
|
78 | - [ |
|
79 | - 'name' => 'assigngroups', |
|
80 | - 'model' => 'users', |
|
81 | - 'created_at' => \DB::raw('NOW()'), |
|
82 | - 'updated_at' => \DB::raw('NOW()') |
|
83 | - ], |
|
84 | - [ |
|
85 | - 'name' => 'block', |
|
86 | - 'model' => 'users', |
|
87 | - 'created_at' => \DB::raw('NOW()'), |
|
88 | - 'updated_at' => \DB::raw('NOW()') |
|
89 | - ], |
|
90 | - [ |
|
91 | - 'name' => 'unblock', |
|
92 | - 'model' => 'users', |
|
93 | - 'created_at' => \DB::raw('NOW()'), |
|
94 | - 'updated_at' => \DB::raw('NOW()') |
|
95 | - ], |
|
96 | - [ |
|
97 | - 'name' => 'group', |
|
98 | - 'model' => 'users', |
|
99 | - 'created_at' => \DB::raw('NOW()'), |
|
100 | - 'updated_at' => \DB::raw('NOW()') |
|
101 | - ], |
|
102 | - [ |
|
103 | - 'name' => 'deleted', |
|
104 | - 'model' => 'users', |
|
105 | - 'created_at' => \DB::raw('NOW()'), |
|
106 | - 'updated_at' => \DB::raw('NOW()') |
|
107 | - ], |
|
108 | - [ |
|
109 | - 'name' => 'restore', |
|
110 | - 'model' => 'users', |
|
111 | - 'created_at' => \DB::raw('NOW()'), |
|
112 | - 'updated_at' => \DB::raw('NOW()') |
|
113 | - ] |
|
114 | - ] |
|
115 | - ); |
|
116 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to users table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Users model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'save', |
|
26 | + 'model' => 'users', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'delete', |
|
32 | + 'model' => 'users', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'find', |
|
38 | + 'model' => 'users', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'list', |
|
44 | + 'model' => 'users', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'search', |
|
50 | + 'model' => 'users', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'findby', |
|
56 | + 'model' => 'users', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'first', |
|
62 | + 'model' => 'users', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'paginate', |
|
68 | + 'model' => 'users', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + [ |
|
73 | + 'name' => 'paginateby', |
|
74 | + 'model' => 'users', |
|
75 | + 'created_at' => \DB::raw('NOW()'), |
|
76 | + 'updated_at' => \DB::raw('NOW()') |
|
77 | + ], |
|
78 | + [ |
|
79 | + 'name' => 'assigngroups', |
|
80 | + 'model' => 'users', |
|
81 | + 'created_at' => \DB::raw('NOW()'), |
|
82 | + 'updated_at' => \DB::raw('NOW()') |
|
83 | + ], |
|
84 | + [ |
|
85 | + 'name' => 'block', |
|
86 | + 'model' => 'users', |
|
87 | + 'created_at' => \DB::raw('NOW()'), |
|
88 | + 'updated_at' => \DB::raw('NOW()') |
|
89 | + ], |
|
90 | + [ |
|
91 | + 'name' => 'unblock', |
|
92 | + 'model' => 'users', |
|
93 | + 'created_at' => \DB::raw('NOW()'), |
|
94 | + 'updated_at' => \DB::raw('NOW()') |
|
95 | + ], |
|
96 | + [ |
|
97 | + 'name' => 'group', |
|
98 | + 'model' => 'users', |
|
99 | + 'created_at' => \DB::raw('NOW()'), |
|
100 | + 'updated_at' => \DB::raw('NOW()') |
|
101 | + ], |
|
102 | + [ |
|
103 | + 'name' => 'deleted', |
|
104 | + 'model' => 'users', |
|
105 | + 'created_at' => \DB::raw('NOW()'), |
|
106 | + 'updated_at' => \DB::raw('NOW()') |
|
107 | + ], |
|
108 | + [ |
|
109 | + 'name' => 'restore', |
|
110 | + 'model' => 'users', |
|
111 | + 'created_at' => \DB::raw('NOW()'), |
|
112 | + 'updated_at' => \DB::raw('NOW()') |
|
113 | + ] |
|
114 | + ] |
|
115 | + ); |
|
116 | + } |
|
117 | 117 | } |
@@ -6,20 +6,20 @@ discard block |
||
6 | 6 | |
7 | 7 | class AssignRelationsSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $adminGroupId = \DB::table('groups')->where('name', 'admin')->select('id')->first()->id; |
|
17 | 17 | |
18 | - /** |
|
18 | + /** |
|
19 | 19 | * Assign the permissions to the admin group. |
20 | 20 | */ |
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
22 | - \DB::table('groups_permissions')->insert( |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients'])->each(function ($permission) use ($adminGroupId) { |
|
22 | + \DB::table('groups_permissions')->insert( |
|
23 | 23 | [ |
24 | 24 | 'permission_id' => $permission->id, |
25 | 25 | 'group_id' => $adminGroupId, |
@@ -27,6 +27,6 @@ discard block |
||
27 | 27 | 'updated_at' => \DB::raw('NOW()') |
28 | 28 | ] |
29 | 29 | ); |
30 | - }); |
|
31 | - } |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class ClearDataSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $permissions = \DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients']); |
|
17 | - \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
18 | - $permissions->delete(); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $permissions = \DB::table('permissions')->whereIn('model', ['users', 'permissions', 'groups', 'oauthClients']); |
|
17 | + \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
18 | + $permissions->delete(); |
|
19 | + } |
|
20 | 20 | } |
@@ -2,118 +2,118 @@ |
||
2 | 2 | |
3 | 3 | interface RepositoryInterface |
4 | 4 | { |
5 | - /** |
|
6 | - * Fetch all records with relations from the storage. |
|
7 | - * |
|
8 | - * @param array $relations |
|
9 | - * @param array $sortBy |
|
10 | - * @param array $desc |
|
11 | - * @param array $columns |
|
12 | - * @return collection |
|
13 | - */ |
|
14 | - public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
5 | + /** |
|
6 | + * Fetch all records with relations from the storage. |
|
7 | + * |
|
8 | + * @param array $relations |
|
9 | + * @param array $sortBy |
|
10 | + * @param array $desc |
|
11 | + * @param array $columns |
|
12 | + * @return collection |
|
13 | + */ |
|
14 | + public function all($relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
15 | 15 | |
16 | - /** |
|
17 | - * Fetch all records with relations from storage in pages |
|
18 | - * that matche the given query. |
|
19 | - * |
|
20 | - * @param string $query |
|
21 | - * @param integer $perPage |
|
22 | - * @param array $relations |
|
23 | - * @param array $sortBy |
|
24 | - * @param array $desc |
|
25 | - * @param array $columns |
|
26 | - * @return collection |
|
27 | - */ |
|
28 | - public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
16 | + /** |
|
17 | + * Fetch all records with relations from storage in pages |
|
18 | + * that matche the given query. |
|
19 | + * |
|
20 | + * @param string $query |
|
21 | + * @param integer $perPage |
|
22 | + * @param array $relations |
|
23 | + * @param array $sortBy |
|
24 | + * @param array $desc |
|
25 | + * @param array $columns |
|
26 | + * @return collection |
|
27 | + */ |
|
28 | + public function search($query, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Fetch all records with relations from storage in pages. |
|
32 | - * |
|
33 | - * @param integer $perPage |
|
34 | - * @param array $relations |
|
35 | - * @param array $sortBy |
|
36 | - * @param array $desc |
|
37 | - * @param array $columns |
|
38 | - * @return collection |
|
39 | - */ |
|
40 | - public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
30 | + /** |
|
31 | + * Fetch all records with relations from storage in pages. |
|
32 | + * |
|
33 | + * @param integer $perPage |
|
34 | + * @param array $relations |
|
35 | + * @param array $sortBy |
|
36 | + * @param array $desc |
|
37 | + * @param array $columns |
|
38 | + * @return collection |
|
39 | + */ |
|
40 | + public function paginate($perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
41 | 41 | |
42 | - /** |
|
43 | - * Fetch all records with relations based on |
|
44 | - * the given condition from storage in pages. |
|
45 | - * |
|
46 | - * @param array $conditions array of conditions |
|
47 | - * @param integer $perPage |
|
48 | - * @param array $relations |
|
49 | - * @param array $sortBy |
|
50 | - * @param array $desc |
|
51 | - * @param array $columns |
|
52 | - * @return collection |
|
53 | - */ |
|
54 | - public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
42 | + /** |
|
43 | + * Fetch all records with relations based on |
|
44 | + * the given condition from storage in pages. |
|
45 | + * |
|
46 | + * @param array $conditions array of conditions |
|
47 | + * @param integer $perPage |
|
48 | + * @param array $relations |
|
49 | + * @param array $sortBy |
|
50 | + * @param array $desc |
|
51 | + * @param array $columns |
|
52 | + * @return collection |
|
53 | + */ |
|
54 | + public function paginateBy($conditions, $perPage = 15, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
55 | 55 | |
56 | - /** |
|
57 | - * Save the given model/models to the storage. |
|
58 | - * |
|
59 | - * @param array $data |
|
60 | - * @return object |
|
61 | - */ |
|
62 | - public function save(array $data); |
|
56 | + /** |
|
57 | + * Save the given model/models to the storage. |
|
58 | + * |
|
59 | + * @param array $data |
|
60 | + * @return object |
|
61 | + */ |
|
62 | + public function save(array $data); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Update record in the storage based on the given |
|
66 | - * condition. |
|
67 | - * |
|
68 | - * @param var $value condition value |
|
69 | - * @param array $data |
|
70 | - * @param string $attribute condition column name |
|
71 | - * @return integer affected rows |
|
72 | - */ |
|
73 | - public function update($value, array $data, $attribute = 'id'); |
|
64 | + /** |
|
65 | + * Update record in the storage based on the given |
|
66 | + * condition. |
|
67 | + * |
|
68 | + * @param var $value condition value |
|
69 | + * @param array $data |
|
70 | + * @param string $attribute condition column name |
|
71 | + * @return integer affected rows |
|
72 | + */ |
|
73 | + public function update($value, array $data, $attribute = 'id'); |
|
74 | 74 | |
75 | - /** |
|
76 | - * Delete record from the storage based on the given |
|
77 | - * condition. |
|
78 | - * |
|
79 | - * @param var $value condition value |
|
80 | - * @param string $attribute condition column name |
|
81 | - * @return integer affected rows |
|
82 | - */ |
|
83 | - public function delete($value, $attribute = 'id'); |
|
75 | + /** |
|
76 | + * Delete record from the storage based on the given |
|
77 | + * condition. |
|
78 | + * |
|
79 | + * @param var $value condition value |
|
80 | + * @param string $attribute condition column name |
|
81 | + * @return integer affected rows |
|
82 | + */ |
|
83 | + public function delete($value, $attribute = 'id'); |
|
84 | 84 | |
85 | - /** |
|
86 | - * Fetch records from the storage based on the given |
|
87 | - * id. |
|
88 | - * |
|
89 | - * @param integer $id |
|
90 | - * @param array $relations |
|
91 | - * @param array $columns |
|
92 | - * @return object |
|
93 | - */ |
|
94 | - public function find($id, $relations = [], $columns = array('*')); |
|
85 | + /** |
|
86 | + * Fetch records from the storage based on the given |
|
87 | + * id. |
|
88 | + * |
|
89 | + * @param integer $id |
|
90 | + * @param array $relations |
|
91 | + * @param array $columns |
|
92 | + * @return object |
|
93 | + */ |
|
94 | + public function find($id, $relations = [], $columns = array('*')); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Fetch records from the storage based on the given |
|
98 | - * condition. |
|
99 | - * |
|
100 | - * @param array $conditions array of conditions |
|
101 | - * @param array $relations |
|
102 | - * @param array $sortBy |
|
103 | - * @param array $desc |
|
104 | - * @param array $columns |
|
105 | - * @return collection |
|
106 | - */ |
|
107 | - public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
96 | + /** |
|
97 | + * Fetch records from the storage based on the given |
|
98 | + * condition. |
|
99 | + * |
|
100 | + * @param array $conditions array of conditions |
|
101 | + * @param array $relations |
|
102 | + * @param array $sortBy |
|
103 | + * @param array $desc |
|
104 | + * @param array $columns |
|
105 | + * @return collection |
|
106 | + */ |
|
107 | + public function findBy($conditions, $relations = [], $sortBy = 'created_at', $desc = 0, $columns = array('*')); |
|
108 | 108 | |
109 | - /** |
|
110 | - * Fetch the first record fro the storage based on the given |
|
111 | - * condition. |
|
112 | - * |
|
113 | - * @param array $conditions array of conditions |
|
114 | - * @param array $relations |
|
115 | - * @param array $columns |
|
116 | - * @return object |
|
117 | - */ |
|
118 | - public function first($conditions, $relations = [], $columns = array('*')); |
|
109 | + /** |
|
110 | + * Fetch the first record fro the storage based on the given |
|
111 | + * condition. |
|
112 | + * |
|
113 | + * @param array $conditions array of conditions |
|
114 | + * @param array $relations |
|
115 | + * @param array $columns |
|
116 | + * @return object |
|
117 | + */ |
|
118 | + public function first($conditions, $relations = [], $columns = array('*')); |
|
119 | 119 | } |
120 | 120 | \ No newline at end of file |