FEATURE: add seed and enumeration for action log types
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace App\Enumerations;
|
||||
|
||||
use App\Models\ActionLogType;
|
||||
|
||||
class ActionLogTypes extends BaseEnumeration
|
||||
{
|
||||
/**
|
||||
* Init list of all action log types
|
||||
*
|
||||
* @throws Exceptions\EnumerationExistsException
|
||||
*/
|
||||
protected static function init()
|
||||
{
|
||||
$types = ActionLogType::all(['id', 'name']);
|
||||
|
||||
foreach ($types as $type) {
|
||||
self::push($type->id, $type->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,6 @@ class DatabaseSeeder extends Seeder
|
||||
// fill up custom field types
|
||||
$this->call(SeedCustomFieldTypes::class);
|
||||
$this->call(SeedCustomFieldResources::class);
|
||||
$this->call(SeedActionLogTypes::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class SeedActionLogTypes extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$types = [
|
||||
'login',
|
||||
'logout',
|
||||
'selfUserEdit',
|
||||
'userEdit',
|
||||
'changePassword',
|
||||
'newCustomField',
|
||||
'editCustomField',
|
||||
'deleteCustomField',
|
||||
'changeSettings'
|
||||
];
|
||||
|
||||
foreach ($types as $type) {
|
||||
\DB::table('action_log_types')
|
||||
->insert([
|
||||
'name' => 'admin/actionLog.name' . ucfirst($type),
|
||||
'value' => 'admin/actionLog.' . $type
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
return [
|
||||
'login' => 'Logged in',
|
||||
'logout' => 'Logged out',
|
||||
'selfUserEdit' => 'Updated self user',
|
||||
'userEdit' => 'Updated someone\'s profile',
|
||||
'changePassword' => 'Changed password',
|
||||
'newCustomField' => 'Added new custom field',
|
||||
'editCustomField' => 'Edited custom field',
|
||||
'deleteCustomField' => 'Deleted custom field',
|
||||
'changeSettings' => 'Changes settings',
|
||||
|
||||
// list of names
|
||||
'nameLogin' => 'Logged in',
|
||||
'nameLogout' => 'Logged out',
|
||||
'nameSelfUserEdit' => 'Updated self user',
|
||||
'nameUserEdit' => 'Updated someone\'s profile',
|
||||
'nameChangePassword' => 'Changed password',
|
||||
'nameNewCustomField' => 'Added new custom field',
|
||||
'nameEditCustomField' => 'Edited custom field',
|
||||
'nameDeleteCustomField' => 'Deleted custom field',
|
||||
'nameChangeSettings' => 'Changes settings',
|
||||
];
|
||||
Reference in New Issue
Block a user