added remote db source

This commit is contained in:
Gitea
2025-06-20 19:48:09 +05:30
parent b43461e180
commit dbe6d49c49
7 changed files with 1495 additions and 5 deletions

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