This commit is contained in:
gholak tala
2026-01-24 14:03:11 +00:00
parent 7dcd83715a
commit eb26afbcb3
224 changed files with 32652 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Admin\PriceController;
use App\Models\Cnt;
use Illuminate\Console\Command;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class Price extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'price:price';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$service = Http::
withHeaders([
'accept' => 'application/json',
'Authorization' => 'Bearer ohxsrbjagqvbt0glaygt'
])->get('https://studio.persianapi.com/index.php/web-service/common/gold-currency-coin?format=json&limit=30&page=1')
->json();
$list = [];
if(isset($service['result'])){
foreach ($service['result'] as $item){
if ($item['key']== 137120 || $item['key']==137119) {
$list[] = $item;
if ($item['key']== 137120){
(new PriceController())->store(new Request(["price"=>$item['price']]));
}
}
}
Cnt::where('key','price')->update(['value_json'=>$list]);
}
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace App\Console;
use App\Console\Commands\Price;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected $commands = [
Price::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
+4
View File
@@ -0,0 +1,4 @@
[10-Jun-2024 08:45:45 UTC] PHP Fatal error: Uncaught Error: Class 'Illuminate\Foundation\Console\Kernel' not found in /home/montechi/public_html/server_app/app/Console/Kernel.php:9
Stack trace:
#0 {main}
thrown in /home/montechi/public_html/server_app/app/Console/Kernel.php on line 9