101 lines
3.3 KiB
PHP
Executable File
101 lines
3.3 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class SettingsSeeder extends Seeder
|
|
{
|
|
/**
|
|
* The settings to add.
|
|
*/
|
|
protected $settings = [
|
|
[
|
|
'key' => 'email_verification',
|
|
'name' => 'email_verification',
|
|
'description' => 'Controllable email verification',
|
|
'value' => true,
|
|
'field' => '{"name":"value", "label":"Value", "type":"checkbox"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'exp_month',
|
|
'name' => 'exp_month',
|
|
'description' => 'Months count to expire',
|
|
'value' => 12,
|
|
'field' => '{"name":"value", "label":"Value", "type":"number"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'smtp_host',
|
|
'name' => 'smtp_host',
|
|
'description' => 'SMTP host address',
|
|
'value' => 'smtp.gmail.com',
|
|
'field' => '{"name":"value", "label":"Value", "type":"text"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'smtp_port',
|
|
'name' => 'smtp_port',
|
|
'description' => 'SMTP port',
|
|
'value' => 587,
|
|
'field' => '{"name":"value","label":"Value","type":"number"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'smtp_encryption',
|
|
'name' => 'smtp_encryption',
|
|
'description' => 'SMTP encryption',
|
|
'value' => 'tls',
|
|
'field' => '{"name":"value","label":"Value","type":"text"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'smtp_username',
|
|
'name' => 'smtp_username',
|
|
'description' => 'SMTP username or login',
|
|
'value' => 'ilmedovamahri@gmail.com',
|
|
'field' => '{"name":"value","label":"Value","type":"text"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'smtp_password',
|
|
'name' => 'smtp_password',
|
|
'description' => 'SMTP password',
|
|
'value' => 'arnxowyiutbeaqce',
|
|
'field' => '{"name":"value","label":"Value","type":"text"}',
|
|
'active' => 1,
|
|
],
|
|
[
|
|
'key' => 'notification_mail_address',
|
|
'name' => 'notification_mail_address',
|
|
'description' => 'Notification mail address',
|
|
'value' => 'ilmedovamahri@gmail.com',
|
|
'field' => '{"name":"value","label":"Value","type":"text"}',
|
|
'active' => 1,
|
|
]
|
|
];
|
|
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
foreach ($this->settings as $index => $setting) {
|
|
$result = DB::table(config('backpack.settings.table_name'))->insert($setting);
|
|
|
|
if (!$result) {
|
|
$this->command->info("Insert failed at record $index.");
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
$this->command->info('Inserted '.count($this->settings).' records.');
|
|
}
|
|
}
|