added remote db source
This commit is contained in:
24
app/Models/RemoteEmail.php
Normal file
24
app/Models/RemoteEmail.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RemoteEmail extends Model
|
||||
{
|
||||
protected $connection = 'mysql_remote';
|
||||
protected $table = 'emails';
|
||||
|
||||
public static function fetchEmailFromDB($email)
|
||||
{
|
||||
$validator = Validator::make(['email' => $email], [
|
||||
'email' => 'required|email'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return [];
|
||||
}
|
||||
return self::whereJsonContains('to', $email)->orderBy('timestamp', 'desc')->get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user