FEATURE: add seed and enumeration for action log types

This commit is contained in:
Michal Kváček
2016-01-28 17:01:54 +01:00
parent 703adfcb78
commit 0c7a138e43
4 changed files with 79 additions and 0 deletions
+21
View File
@@ -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);
}
}
}
+1
View File
@@ -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);
}
}
+34
View File
@@ -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
]);
}
}
}
+23
View File
@@ -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',
];