Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ added ability to show embedded images in the resulting mail log + added command to clear old email entries
- Loading branch information
1 parent
38224ae
commit a3a7936
Showing
7 changed files
with
177 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
22 changes: 22 additions & 0 deletions
22
database/migrations/2020_01_22_215032_change_message_column.php
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class ChangeMessageColumn extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::table('mail_log', function (Blueprint $table) { | ||
$table->longText('message')->change(); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table('mail_log', function (Blueprint $table) { | ||
$table->text('message')->change(); | ||
}); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Giuga\LaravelMailLog\Commands; | ||
|
||
use Carbon\Carbon; | ||
use Giuga\LaravelMailLog\Models\MailLog; | ||
use Illuminate\Console\Command; | ||
|
||
class ClearOldEmails extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'giuga:purge-mail-log'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Remove mails saved before the time defined in the config'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
if (config('mail-log.purge')) { | ||
$beforeDate = Carbon::now()->subDays(config('mail-log.purge_after')); | ||
$toRemove = MailLog::where('created_at', '<', $beforeDate)->get(); | ||
foreach ($toRemove as $item) { | ||
$item->delete(); | ||
} | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.