@@ -6,42 +6,42 @@ |
||
6 | 6 | class AclGroup extends Model |
7 | 7 | { |
8 | 8 | |
9 | - use SoftDeletes; |
|
10 | - protected $table = 'groups'; |
|
11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | - protected $hidden = ['deleted_at']; |
|
13 | - protected $guarded = ['id']; |
|
14 | - protected $fillable = ['name']; |
|
15 | - public $searchable = ['name']; |
|
16 | - |
|
17 | - public function getCreatedAtAttribute($value) |
|
18 | - { |
|
19 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | - } |
|
21 | - |
|
22 | - public function getUpdatedAtAttribute($value) |
|
23 | - { |
|
24 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | - } |
|
26 | - |
|
27 | - public function getDeletedAtAttribute($value) |
|
28 | - { |
|
29 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | - } |
|
31 | - |
|
32 | - public function users() |
|
33 | - { |
|
34 | - return $this->belongsToMany('\App\Modules\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
35 | - } |
|
36 | - |
|
37 | - public function permissions() |
|
38 | - { |
|
39 | - return $this->belongsToMany('\App\Modules\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
40 | - } |
|
41 | - |
|
42 | - public static function boot() |
|
43 | - { |
|
44 | - parent::boot(); |
|
45 | - AclGroup::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
46 | - } |
|
9 | + use SoftDeletes; |
|
10 | + protected $table = 'groups'; |
|
11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | + protected $hidden = ['deleted_at']; |
|
13 | + protected $guarded = ['id']; |
|
14 | + protected $fillable = ['name']; |
|
15 | + public $searchable = ['name']; |
|
16 | + |
|
17 | + public function getCreatedAtAttribute($value) |
|
18 | + { |
|
19 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | + } |
|
21 | + |
|
22 | + public function getUpdatedAtAttribute($value) |
|
23 | + { |
|
24 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | + } |
|
26 | + |
|
27 | + public function getDeletedAtAttribute($value) |
|
28 | + { |
|
29 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | + } |
|
31 | + |
|
32 | + public function users() |
|
33 | + { |
|
34 | + return $this->belongsToMany('\App\Modules\Acl\AclUser', 'users_groups', 'group_id', 'user_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
35 | + } |
|
36 | + |
|
37 | + public function permissions() |
|
38 | + { |
|
39 | + return $this->belongsToMany('\App\Modules\Acl\AclPermission', 'groups_permissions', 'group_id', 'permission_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
40 | + } |
|
41 | + |
|
42 | + public static function boot() |
|
43 | + { |
|
44 | + parent::boot(); |
|
45 | + AclGroup::observe(\App::make('App\Modules\Acl\ModelObservers\AclGroupObserver')); |
|
46 | + } |
|
47 | 47 | } |
@@ -8,133 +8,133 @@ |
||
8 | 8 | class AclUser extends User |
9 | 9 | { |
10 | 10 | |
11 | - use SoftDeletes, HasApiTokens; |
|
12 | - protected $table = 'users'; |
|
13 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
14 | - protected $hidden = ['password', 'remember_token', 'deleted_at']; |
|
15 | - protected $guarded = ['id']; |
|
16 | - protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'time_zone']; |
|
17 | - public $searchable = ['name', 'email']; |
|
11 | + use SoftDeletes, HasApiTokens; |
|
12 | + protected $table = 'users'; |
|
13 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
14 | + protected $hidden = ['password', 'remember_token', 'deleted_at']; |
|
15 | + protected $guarded = ['id']; |
|
16 | + protected $fillable = ['profile_picture', 'name', 'email', 'password', 'locale', 'time_zone']; |
|
17 | + public $searchable = ['name', 'email']; |
|
18 | 18 | |
19 | - public function getCreatedAtAttribute($value) |
|
20 | - { |
|
21 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
22 | - } |
|
23 | - |
|
24 | - public function getUpdatedAtAttribute($value) |
|
25 | - { |
|
26 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
27 | - } |
|
28 | - |
|
29 | - public function getDeletedAtAttribute($value) |
|
30 | - { |
|
31 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
32 | - } |
|
33 | - |
|
34 | - /** |
|
35 | - * Get the profile picture url. |
|
36 | - * @return string |
|
37 | - */ |
|
38 | - public function getProfilePictureAttribute($value) |
|
39 | - { |
|
40 | - return url(\Storage::url($value)); |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * Encrypt the password attribute before |
|
45 | - * saving it in the storage. |
|
46 | - * |
|
47 | - * @param string $value |
|
48 | - */ |
|
49 | - public function setPasswordAttribute($value) |
|
50 | - { |
|
51 | - $this->attributes['password'] = bcrypt($value); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Get the entity's notifications. |
|
56 | - */ |
|
57 | - public function notifications() |
|
58 | - { |
|
59 | - return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Get the entity's read notifications. |
|
64 | - */ |
|
65 | - public function readNotifications() |
|
66 | - { |
|
67 | - return $this->notifications()->whereNotNull('read_at'); |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * Get the entity's unread notifications. |
|
72 | - */ |
|
73 | - public function unreadNotifications() |
|
74 | - { |
|
75 | - return $this->notifications()->whereNull('read_at'); |
|
76 | - } |
|
77 | - |
|
78 | - public function groups() |
|
79 | - { |
|
80 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
81 | - } |
|
82 | - |
|
83 | - public function oauthClients() |
|
84 | - { |
|
85 | - return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Return fcm device tokens that will be used in sending fcm notifications. |
|
90 | - * |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - public function routeNotificationForFCM() |
|
94 | - { |
|
95 | - $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
96 | - $tokens = []; |
|
97 | - |
|
98 | - foreach ($devices as $device) { |
|
99 | - if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
100 | - $device->forceDelete(); |
|
101 | - continue; |
|
102 | - } |
|
103 | - |
|
104 | - $tokens[] = $device->device_token; |
|
105 | - } |
|
106 | - |
|
107 | - return $tokens; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * The channels the user receives notification broadcasts on. |
|
112 | - * |
|
113 | - * @return string |
|
114 | - */ |
|
115 | - public function receivesBroadcastNotificationsOn() |
|
116 | - { |
|
117 | - return 'users.'.$this->id; |
|
118 | - } |
|
119 | - |
|
120 | - /** |
|
121 | - * Custom password validation. |
|
122 | - * |
|
123 | - * @param string $password |
|
124 | - * @return boolean |
|
125 | - */ |
|
126 | - public function validateForPassportPasswordGrant($password) |
|
127 | - { |
|
128 | - if ($password == config('skeleton.social_pass')) { |
|
129 | - return true; |
|
130 | - } |
|
131 | - |
|
132 | - return \Hash::check($password, $this->password); |
|
133 | - } |
|
19 | + public function getCreatedAtAttribute($value) |
|
20 | + { |
|
21 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
22 | + } |
|
23 | + |
|
24 | + public function getUpdatedAtAttribute($value) |
|
25 | + { |
|
26 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
27 | + } |
|
28 | + |
|
29 | + public function getDeletedAtAttribute($value) |
|
30 | + { |
|
31 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
32 | + } |
|
33 | + |
|
34 | + /** |
|
35 | + * Get the profile picture url. |
|
36 | + * @return string |
|
37 | + */ |
|
38 | + public function getProfilePictureAttribute($value) |
|
39 | + { |
|
40 | + return url(\Storage::url($value)); |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * Encrypt the password attribute before |
|
45 | + * saving it in the storage. |
|
46 | + * |
|
47 | + * @param string $value |
|
48 | + */ |
|
49 | + public function setPasswordAttribute($value) |
|
50 | + { |
|
51 | + $this->attributes['password'] = bcrypt($value); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Get the entity's notifications. |
|
56 | + */ |
|
57 | + public function notifications() |
|
58 | + { |
|
59 | + return $this->morphMany('\App\Modules\Notifications\Notification', 'notifiable')->orderBy('created_at', 'desc'); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Get the entity's read notifications. |
|
64 | + */ |
|
65 | + public function readNotifications() |
|
66 | + { |
|
67 | + return $this->notifications()->whereNotNull('read_at'); |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * Get the entity's unread notifications. |
|
72 | + */ |
|
73 | + public function unreadNotifications() |
|
74 | + { |
|
75 | + return $this->notifications()->whereNull('read_at'); |
|
76 | + } |
|
77 | + |
|
78 | + public function groups() |
|
79 | + { |
|
80 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'users_groups', 'user_id', 'group_id')->whereNull('users_groups.deleted_at')->withTimestamps(); |
|
81 | + } |
|
82 | + |
|
83 | + public function oauthClients() |
|
84 | + { |
|
85 | + return $this->hasMany('App\Modules\Acl\OauthClient', 'user_id'); |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Return fcm device tokens that will be used in sending fcm notifications. |
|
90 | + * |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + public function routeNotificationForFCM() |
|
94 | + { |
|
95 | + $devices = \Core::pushNotificationDevices()->findBy(['user_id' => $this->id]); |
|
96 | + $tokens = []; |
|
97 | + |
|
98 | + foreach ($devices as $device) { |
|
99 | + if (\Core::users()->accessTokenExpiredOrRevoked($device->access_token)) { |
|
100 | + $device->forceDelete(); |
|
101 | + continue; |
|
102 | + } |
|
103 | + |
|
104 | + $tokens[] = $device->device_token; |
|
105 | + } |
|
106 | + |
|
107 | + return $tokens; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * The channels the user receives notification broadcasts on. |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
115 | + public function receivesBroadcastNotificationsOn() |
|
116 | + { |
|
117 | + return 'users.'.$this->id; |
|
118 | + } |
|
119 | + |
|
120 | + /** |
|
121 | + * Custom password validation. |
|
122 | + * |
|
123 | + * @param string $password |
|
124 | + * @return boolean |
|
125 | + */ |
|
126 | + public function validateForPassportPasswordGrant($password) |
|
127 | + { |
|
128 | + if ($password == config('skeleton.social_pass')) { |
|
129 | + return true; |
|
130 | + } |
|
131 | + |
|
132 | + return \Hash::check($password, $this->password); |
|
133 | + } |
|
134 | 134 | |
135 | - public static function boot() |
|
136 | - { |
|
137 | - parent::boot(); |
|
138 | - AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
139 | - } |
|
135 | + public static function boot() |
|
136 | + { |
|
137 | + parent::boot(); |
|
138 | + AclUser::observe(\App::make('App\Modules\Acl\ModelObservers\AclUserObserver')); |
|
139 | + } |
|
140 | 140 | } |
@@ -6,37 +6,37 @@ |
||
6 | 6 | class AclPermission extends Model |
7 | 7 | { |
8 | 8 | |
9 | - use SoftDeletes; |
|
10 | - protected $table = 'permissions'; |
|
11 | - protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | - protected $hidden = ['deleted_at']; |
|
13 | - protected $guarded = ['id']; |
|
14 | - protected $fillable = ['name', 'model']; |
|
15 | - public $searchable = ['name', 'model']; |
|
9 | + use SoftDeletes; |
|
10 | + protected $table = 'permissions'; |
|
11 | + protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
12 | + protected $hidden = ['deleted_at']; |
|
13 | + protected $guarded = ['id']; |
|
14 | + protected $fillable = ['name', 'model']; |
|
15 | + public $searchable = ['name', 'model']; |
|
16 | 16 | |
17 | - public function getCreatedAtAttribute($value) |
|
18 | - { |
|
19 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | - } |
|
17 | + public function getCreatedAtAttribute($value) |
|
18 | + { |
|
19 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
20 | + } |
|
21 | 21 | |
22 | - public function getUpdatedAtAttribute($value) |
|
23 | - { |
|
24 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | - } |
|
22 | + public function getUpdatedAtAttribute($value) |
|
23 | + { |
|
24 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
25 | + } |
|
26 | 26 | |
27 | - public function getDeletedAtAttribute($value) |
|
28 | - { |
|
29 | - return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | - } |
|
27 | + public function getDeletedAtAttribute($value) |
|
28 | + { |
|
29 | + return \Carbon\Carbon::parse($value)->tz(\Session::get('time-zone'))->toDateTimeString(); |
|
30 | + } |
|
31 | 31 | |
32 | - public function groups() |
|
33 | - { |
|
34 | - return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
35 | - } |
|
32 | + public function groups() |
|
33 | + { |
|
34 | + return $this->belongsToMany('\App\Modules\Acl\AclGroup', 'groups_permissions', 'permission_id', 'group_id')->whereNull('groups_permissions.deleted_at')->withTimestamps(); |
|
35 | + } |
|
36 | 36 | |
37 | - public static function boot() |
|
38 | - { |
|
39 | - parent::boot(); |
|
40 | - AclPermission::observe(\App::make('App\Modules\Acl\ModelObservers\AclPermissionObserver')); |
|
41 | - } |
|
37 | + public static function boot() |
|
38 | + { |
|
39 | + parent::boot(); |
|
40 | + AclPermission::observe(\App::make('App\Modules\Acl\ModelObservers\AclPermissionObserver')); |
|
41 | + } |
|
42 | 42 | } |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $factory->define(App\Modules\Core\Settings::class, function (Faker\Generator $faker) { |
4 | - return [ |
|
5 | - 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
|
6 | - 'value' => $faker->word(), |
|
7 | - 'key' => $faker->word(), |
|
8 | - 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
9 | - 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
10 | - ]; |
|
4 | + return [ |
|
5 | + 'name' => $faker->randomElement(['Company Name', 'Title', 'Header Image']), |
|
6 | + 'value' => $faker->word(), |
|
7 | + 'key' => $faker->word(), |
|
8 | + 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
|
9 | + 'updated_at' => $faker->dateTimeBetween('-1 years', 'now') |
|
10 | + ]; |
|
11 | 11 | }); |
@@ -5,30 +5,30 @@ |
||
5 | 5 | |
6 | 6 | class Settings extends Migration |
7 | 7 | { |
8 | - /** |
|
9 | - * Run the migrations. |
|
10 | - * |
|
11 | - * @return void |
|
12 | - */ |
|
13 | - public function up() |
|
14 | - { |
|
15 | - Schema::create('settings', function (Blueprint $table) { |
|
16 | - $table->increments('id'); |
|
17 | - $table->string('name', 100); |
|
18 | - $table->string('key', 100)->unique(); |
|
19 | - $table->text('value')->nullable(); |
|
20 | - $table->softDeletes(); |
|
21 | - $table->timestamps(); |
|
22 | - }); |
|
23 | - } |
|
8 | + /** |
|
9 | + * Run the migrations. |
|
10 | + * |
|
11 | + * @return void |
|
12 | + */ |
|
13 | + public function up() |
|
14 | + { |
|
15 | + Schema::create('settings', function (Blueprint $table) { |
|
16 | + $table->increments('id'); |
|
17 | + $table->string('name', 100); |
|
18 | + $table->string('key', 100)->unique(); |
|
19 | + $table->text('value')->nullable(); |
|
20 | + $table->softDeletes(); |
|
21 | + $table->timestamps(); |
|
22 | + }); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * Reverse the migrations. |
|
27 | - * |
|
28 | - * @return void |
|
29 | - */ |
|
30 | - public function down() |
|
31 | - { |
|
32 | - Schema::dropIfExists('settings'); |
|
33 | - } |
|
25 | + /** |
|
26 | + * Reverse the migrations. |
|
27 | + * |
|
28 | + * @return void |
|
29 | + */ |
|
30 | + public function down() |
|
31 | + { |
|
32 | + Schema::dropIfExists('settings'); |
|
33 | + } |
|
34 | 34 | } |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | class CoreDatabaseSeeder extends Seeder |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the database seeds. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function run() |
|
15 | - { |
|
16 | - $this->call(ClearDataSeeder::class); |
|
17 | - $this->call(SettingsTableSeeder::class); |
|
18 | - $this->call(AssignRelationsSeeder::class); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + $this->call(ClearDataSeeder::class); |
|
17 | + $this->call(SettingsTableSeeder::class); |
|
18 | + $this->call(AssignRelationsSeeder::class); |
|
19 | + } |
|
20 | 20 | } |
@@ -6,27 +6,27 @@ |
||
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 | - /** |
|
19 | - * Assign the permissions to the admin group. |
|
20 | - */ |
|
21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['settings'])->each(function ($permission) use ($adminGroupId) { |
|
22 | - \DB::table('groups_permissions')->insert( |
|
23 | - [ |
|
24 | - 'permission_id' => $permission->id, |
|
25 | - 'group_id' => $adminGroupId, |
|
26 | - 'created_at' => \DB::raw('NOW()'), |
|
27 | - 'updated_at' => \DB::raw('NOW()') |
|
28 | - ] |
|
29 | - ); |
|
30 | - }); |
|
31 | - } |
|
18 | + /** |
|
19 | + * Assign the permissions to the admin group. |
|
20 | + */ |
|
21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['settings'])->each(function ($permission) use ($adminGroupId) { |
|
22 | + \DB::table('groups_permissions')->insert( |
|
23 | + [ |
|
24 | + 'permission_id' => $permission->id, |
|
25 | + 'group_id' => $adminGroupId, |
|
26 | + 'created_at' => \DB::raw('NOW()'), |
|
27 | + 'updated_at' => \DB::raw('NOW()') |
|
28 | + ] |
|
29 | + ); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | } |
@@ -6,76 +6,76 @@ |
||
6 | 6 | |
7 | 7 | class SettingsTableSeeder 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 settings table. |
|
18 | - */ |
|
19 | - \DB::table('permissions')->insert( |
|
20 | - [ |
|
21 | - /** |
|
22 | - * Settings model permissions. |
|
23 | - */ |
|
24 | - [ |
|
25 | - 'name' => 'save', |
|
26 | - 'model' => 'settings', |
|
27 | - 'created_at' => \DB::raw('NOW()'), |
|
28 | - 'updated_at' => \DB::raw('NOW()') |
|
29 | - ], |
|
30 | - [ |
|
31 | - 'name' => 'find', |
|
32 | - 'model' => 'settings', |
|
33 | - 'created_at' => \DB::raw('NOW()'), |
|
34 | - 'updated_at' => \DB::raw('NOW()') |
|
35 | - ], |
|
36 | - [ |
|
37 | - 'name' => 'search', |
|
38 | - 'model' => 'settings', |
|
39 | - 'created_at' => \DB::raw('NOW()'), |
|
40 | - 'updated_at' => \DB::raw('NOW()') |
|
41 | - ], |
|
42 | - [ |
|
43 | - 'name' => 'list', |
|
44 | - 'model' => 'settings', |
|
45 | - 'created_at' => \DB::raw('NOW()'), |
|
46 | - 'updated_at' => \DB::raw('NOW()') |
|
47 | - ], |
|
48 | - [ |
|
49 | - 'name' => 'findby', |
|
50 | - 'model' => 'settings', |
|
51 | - 'created_at' => \DB::raw('NOW()'), |
|
52 | - 'updated_at' => \DB::raw('NOW()') |
|
53 | - ], |
|
54 | - [ |
|
55 | - 'name' => 'first', |
|
56 | - 'model' => 'settings', |
|
57 | - 'created_at' => \DB::raw('NOW()'), |
|
58 | - 'updated_at' => \DB::raw('NOW()') |
|
59 | - ], |
|
60 | - [ |
|
61 | - 'name' => 'paginate', |
|
62 | - 'model' => 'settings', |
|
63 | - 'created_at' => \DB::raw('NOW()'), |
|
64 | - 'updated_at' => \DB::raw('NOW()') |
|
65 | - ], |
|
66 | - [ |
|
67 | - 'name' => 'paginateby', |
|
68 | - 'model' => 'settings', |
|
69 | - 'created_at' => \DB::raw('NOW()'), |
|
70 | - 'updated_at' => \DB::raw('NOW()') |
|
71 | - ], |
|
72 | - [ |
|
73 | - 'name' => 'saveMany', |
|
74 | - 'model' => 'settings', |
|
75 | - 'created_at' => \DB::raw('NOW()'), |
|
76 | - 'updated_at' => \DB::raw('NOW()') |
|
77 | - ] |
|
78 | - ] |
|
79 | - ); |
|
80 | - } |
|
9 | + /** |
|
10 | + * Run the database seeds. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function run() |
|
15 | + { |
|
16 | + /** |
|
17 | + * Insert the permissions related to settings table. |
|
18 | + */ |
|
19 | + \DB::table('permissions')->insert( |
|
20 | + [ |
|
21 | + /** |
|
22 | + * Settings model permissions. |
|
23 | + */ |
|
24 | + [ |
|
25 | + 'name' => 'save', |
|
26 | + 'model' => 'settings', |
|
27 | + 'created_at' => \DB::raw('NOW()'), |
|
28 | + 'updated_at' => \DB::raw('NOW()') |
|
29 | + ], |
|
30 | + [ |
|
31 | + 'name' => 'find', |
|
32 | + 'model' => 'settings', |
|
33 | + 'created_at' => \DB::raw('NOW()'), |
|
34 | + 'updated_at' => \DB::raw('NOW()') |
|
35 | + ], |
|
36 | + [ |
|
37 | + 'name' => 'search', |
|
38 | + 'model' => 'settings', |
|
39 | + 'created_at' => \DB::raw('NOW()'), |
|
40 | + 'updated_at' => \DB::raw('NOW()') |
|
41 | + ], |
|
42 | + [ |
|
43 | + 'name' => 'list', |
|
44 | + 'model' => 'settings', |
|
45 | + 'created_at' => \DB::raw('NOW()'), |
|
46 | + 'updated_at' => \DB::raw('NOW()') |
|
47 | + ], |
|
48 | + [ |
|
49 | + 'name' => 'findby', |
|
50 | + 'model' => 'settings', |
|
51 | + 'created_at' => \DB::raw('NOW()'), |
|
52 | + 'updated_at' => \DB::raw('NOW()') |
|
53 | + ], |
|
54 | + [ |
|
55 | + 'name' => 'first', |
|
56 | + 'model' => 'settings', |
|
57 | + 'created_at' => \DB::raw('NOW()'), |
|
58 | + 'updated_at' => \DB::raw('NOW()') |
|
59 | + ], |
|
60 | + [ |
|
61 | + 'name' => 'paginate', |
|
62 | + 'model' => 'settings', |
|
63 | + 'created_at' => \DB::raw('NOW()'), |
|
64 | + 'updated_at' => \DB::raw('NOW()') |
|
65 | + ], |
|
66 | + [ |
|
67 | + 'name' => 'paginateby', |
|
68 | + 'model' => 'settings', |
|
69 | + 'created_at' => \DB::raw('NOW()'), |
|
70 | + 'updated_at' => \DB::raw('NOW()') |
|
71 | + ], |
|
72 | + [ |
|
73 | + 'name' => 'saveMany', |
|
74 | + 'model' => 'settings', |
|
75 | + 'created_at' => \DB::raw('NOW()'), |
|
76 | + 'updated_at' => \DB::raw('NOW()') |
|
77 | + ] |
|
78 | + ] |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | } |
@@ -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', ['settings']); |
|
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', ['settings']); |
|
17 | + \DB::table('groups_permissions')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
18 | + $permissions->delete(); |
|
19 | + } |
|
20 | 20 | } |