
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Model\MailJob\MailService;
|
|
use App\Model\MailJob\QueueService;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class OutboundMailSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$mail = new MailService();
|
|
$mail_services = ['smtp' => 'SMTP', 'mail' => 'Php Mail', 'sendmail' => 'Send Mail', 'mailgun' => 'Mailgun', 'mandrill' => 'Mandrill', 'log' => 'Log file'];
|
|
foreach ($mail_services as $key => $value) {
|
|
$mail->create([
|
|
'name' => $value,
|
|
'short_name' => $key,
|
|
]);
|
|
}
|
|
|
|
$queue = new QueueService();
|
|
$services = ['sync' => 'Sync', 'database' => 'Database', 'beanstalkd' => 'Beanstalkd', 'sqs' => 'SQS', 'iron' => 'Iron', 'redis' => 'Redis'];
|
|
foreach ($services as $key => $value) {
|
|
$queue->create([
|
|
'name' => $value,
|
|
'short_name' => $key,
|
|
'status' => 0,
|
|
]);
|
|
}
|
|
$q = $queue->where('short_name', 'sync')->first();
|
|
if ($q) {
|
|
$q->status = 1;
|
|
$q->save();
|
|
}
|
|
}
|
|
}
|