Last active
September 9, 2020 15:57
-
-
Save New0/a0077f2ec34706ad59d6519724151021 to your computer and use it in GitHub Desktop.
Query recent messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Console\Commands; | |
use App\Message; | |
use Carbon\Carbon; | |
use Illuminate\Console\Command; | |
class RecentlyUsedAccounts extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'account:recent'; | |
/** | |
* The console command description. | |
* | |
* @var string | |
*/ | |
protected $description = 'Get recently used accounts'; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function handle() | |
{ | |
$headers = [ | |
'id', | |
'account', | |
'layout', | |
'pdf', | |
'pdf_layout', | |
'to', | |
'reply', | |
'cc', | |
'bcc', | |
'content', | |
'subject', | |
'hash', | |
'opened', | |
'clicked', | |
'spammed', | |
'entry_data', | |
'local_id', | |
'attachments', | |
'spam_detected' | |
]; | |
$accounts = Message::all( $headers )->where( 'created_at', '<=', Carbon::now()->subMonth()->month )->toArray(); | |
$this->table($headers, $accounts); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment