Files
zemailnator/app/Models/RemoteEmail.php
2025-06-20 19:48:09 +05:30

25 lines
563 B
PHP

<?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();
}
}