functional

This commit is contained in:
vedatakd 2021-04-03 20:15:02 +03:00
parent c2720bd65f
commit 7024ee87c9
2 changed files with 47 additions and 54 deletions

View File

@ -10,10 +10,9 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
public function run() public function run()
{ {
if (is_module_installed('visiosoft.module.notifications')) { if (is_module_installed('visiosoft.module.notifications')) {
$template_repo = app(TemplateRepositoryInterface::class);
if (!$template_repo->findBySlug(Str::slug('Created Ad', '_'))) { $templates = [
$template_repo->create([ [
'en' => [ 'en' => [
'message' => '<p><strong>&nbsp;Your post <a href="{url}" target="_blank">{name}</a> has been created successfully.</strong></p>', 'message' => '<p><strong>&nbsp;Your post <a href="{url}" target="_blank">{name}</a> has been created successfully.</strong></p>',
'name' => 'Created Ad', 'name' => 'Created Ad',
@ -22,12 +21,8 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'advs', 'stream' => 'advs',
'slug' => Str::slug('Created Ad', '_') 'slug' => Str::slug('Created Ad', '_')
]); ],
} [
if (!$template_repo->findBySlug(Str::slug('Approved Ad', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>Your ad for&nbsp;<a href="{url}" target="_blank">{name}</a>&nbsp;has been approved.</strong></p>', 'message' => '<p><strong>Your ad for&nbsp;<a href="{url}" target="_blank">{name}</a>&nbsp;has been approved.</strong></p>',
'name' => 'Approved Ad', 'name' => 'Approved Ad',
@ -36,12 +31,8 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'advs', 'stream' => 'advs',
'slug' => Str::slug('Approved Ad', '_') 'slug' => Str::slug('Approved Ad', '_')
]); ],
} [
if (!$template_repo->findBySlug(Str::slug('Declined Ad', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>Your <a href="{url}" target="_blank">{name}</a>&nbsp;ad was rejected because it does not comply with the posting rules.</strong></p>', 'message' => '<p><strong>Your <a href="{url}" target="_blank">{name}</a>&nbsp;ad was rejected because it does not comply with the posting rules.</strong></p>',
'name' => 'Declined Ad', 'name' => 'Declined Ad',
@ -50,12 +41,8 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'advs', 'stream' => 'advs',
'slug' => Str::slug('Declined Ad', '_') 'slug' => Str::slug('Declined Ad', '_')
]); ],
} [
if (!$template_repo->findBySlug(Str::slug('Pending User Ad', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>You must confirm your <a href="{url}" target="_blank">{name}</a>&nbsp;posting to be published.</strong></p>', 'message' => '<p><strong>You must confirm your <a href="{url}" target="_blank">{name}</a>&nbsp;posting to be published.</strong></p>',
'name' => 'Pending User Ad', 'name' => 'Pending User Ad',
@ -64,12 +51,8 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'advs', 'stream' => 'advs',
'slug' => Str::slug('Pending User Ad', '_') 'slug' => Str::slug('Pending User Ad', '_')
]); ],
} [
if (!$template_repo->findBySlug(Str::slug('Pending Ad', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>Your <a href="{url}" target="_blank">{name}</a> post is checked by our editors.</strong></p>', 'message' => '<p><strong>Your <a href="{url}" target="_blank">{name}</a> post is checked by our editors.</strong></p>',
'name' => 'Pending Ad', 'name' => 'Pending Ad',
@ -78,9 +61,22 @@ class AdvsModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'advs', 'stream' => 'advs',
'slug' => Str::slug('Pending Ad', '_') 'slug' => Str::slug('Pending Ad', '_')
]); ]
];
foreach ($templates as $template) {
$this->createTemplate($template);
} }
} }
} }
public function createTemplate($params)
{
$template_repo = app(TemplateRepositoryInterface::class);
if (!$template_repo->findBySlug($params['slug'])) {
$template_repo->create($params);
}
}
} }

View File

@ -10,11 +10,9 @@ class ProfileModuleNotificationsTemplateSeeder extends Seeder
public function run() public function run()
{ {
if (is_module_installed('visiosoft.module.notifications')) { if (is_module_installed('visiosoft.module.notifications')) {
$template_repo = app(TemplateRepositoryInterface::class);
$templates = [
if (!$template_repo->findBySlug(Str::slug('Registered User', '_'))) { [
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>Your membership is activated.<br>Email:{email}</strong></p>', 'message' => '<p><strong>Your membership is activated.<br>Email:{email}</strong></p>',
'name' => 'Registered User', 'name' => 'Registered User',
@ -23,13 +21,8 @@ class ProfileModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'users', 'stream' => 'users',
'slug' => Str::slug('Registered User', '_') 'slug' => Str::slug('Registered User', '_')
]); ],
[
}
if (!$template_repo->findBySlug(Str::slug('New User Welcome', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<tr> 'message' => '<tr>
<td class="esd-structure es-p20t es-p20b es-p20r es-p20l" align="left"> <td class="esd-structure es-p20t es-p20b es-p20r es-p20l" align="left">
@ -94,13 +87,8 @@ class ProfileModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'users', 'stream' => 'users',
'slug' => Str::slug('New User Welcome', '_') 'slug' => Str::slug('New User Welcome', '_')
]); ],
} [
if (!$template_repo->findBySlug(Str::slug('Password Forget', '_'))) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<tr> 'message' => '<tr>
<td class="esd-structure es-p20t es-p20b es-p20r es-p20l" align="left"> <td class="esd-structure es-p20t es-p20b es-p20r es-p20l" align="left">
@ -165,12 +153,8 @@ class ProfileModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'users', 'stream' => 'users',
'slug' => Str::slug('Password Forget', '_') 'slug' => Str::slug('Password Forget', '_')
]); ],
} [
if (!$template_repo->findBySlug('password_changed')) {
$template_repo->create([
'en' => [ 'en' => [
'message' => '<p><strong>Your password has been changed</strong></p>', 'message' => '<p><strong>Your password has been changed</strong></p>',
'name' => 'Password Changed', 'name' => 'Password Changed',
@ -179,9 +163,22 @@ class ProfileModuleNotificationsTemplateSeeder extends Seeder
], ],
'stream' => 'users', 'stream' => 'users',
'slug' => 'password_changed' 'slug' => 'password_changed'
]); ],
}
];
foreach ($templates as $template) {
$this->createTemplate($template);
}
}
}
public function createTemplate($params)
{
$template_repo = app(TemplateRepositoryInterface::class);
if (!$template_repo->findBySlug($params['slug'])) {
$template_repo->create($params);
} }
} }
} }