PHP code example of rayzenai / gold-silver-price

1. Go to this page and download the library: Download rayzenai/gold-silver-price library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rayzenai / gold-silver-price example snippets


use RayzenAI\GoldSilverPrice\Jobs\FetchGoldPriceJob;

FetchGoldPriceJob::dispatch();

use Illuminate\Support\Facades\Schedule;
use RayzenAI\GoldSilverPrice\Jobs\FetchGoldPriceJob;

Schedule::job(FetchGoldPriceJob::class)
    ->everyFiveMinutes()
    ->between('10:00', '13:00');

use RayzenAI\GoldSilverPrice\Services\GoldPriceService;

$service = app(GoldPriceService::class);
$goldPrice = $service->fetchAndStore();

// Get latest prices
$latest = $service->getLatest();

use RayzenAI\GoldSilverPrice\GoldSilverPricePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            GoldSilverPricePlugin::make(),
        ]);
}
bash
php artisan vendor:publish --tag="gold-silver-price-migrations"
bash
php artisan migrate
bash
php artisan vendor:publish --tag="gold-silver-price-config"
bash
php artisan gold-silver-price:fetch