Files
boursecu_server/app/Models/Cnt.php
T

50 lines
1.3 KiB
PHP
Raw Normal View History

2026-01-24 14:03:11 +00:00
<?php
namespace App\Models;
2026-05-17 16:27:50 +00:00
use App\Http\Controllers\Controller;
2026-01-24 14:03:11 +00:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
2026-03-10 15:39:30 +03:30
use Illuminate\Support\Facades\Http;
2026-01-24 14:03:11 +00:00
class Cnt extends Model
{
use HasFactory;
protected $table = 'const';
protected $fillable = [
'key',
'title_fa',
'value',
'value_json'
];
protected $casts = [
'value_json'=>'array'
];
2026-05-25 12:47:04 +03:30
/* public function goldir_login(){
2026-03-10 15:39:30 +03:30
$mobile = self::where('key', 'goldir_mobile')->value('value');
$password = self::where('key', 'goldir_password')->value('value');
2026-05-17 16:27:50 +00:00
$goldir_base_url=Controller::Config('goldir_base_url')??'https://gold.ir';
2026-03-10 15:39:30 +03:30
2026-04-01 10:58:08 +00:00
$goldir = Http::withOptions([
'curl' => [
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
CURLOPT_TCP_FASTOPEN => 1,
]
])
->withoutVerifying()
2026-05-17 16:27:50 +00:00
->post($goldir_base_url.'/server/auth/login', [
2026-03-10 15:39:30 +03:30
'mobile' => $mobile,
'password' => $password,
'provider' => 'customer',
'type_app' => 'client',
])->json();
Cnt::where('key', 'goldir')->update([
'value' => $goldir['access_token'],
'updated_at' => now()
]);
return $goldir['access_token'];
2026-05-25 12:47:04 +03:30
}*/
2026-03-10 15:39:30 +03:30
2026-01-24 14:03:11 +00:00
}