PHP code example of atoms / database-illuminate

1. Go to this page and download the library: Download atoms/database-illuminate 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/ */

    

atoms / database-illuminate example snippets


use Atoms\Atom;
use Atoms\DatabaseIlluminate\EloquentBridge;

class GameRoom extends Atom
{
    public function record(string $player, int $score): array
    {
        $db = EloquentBridge::boot($this->db());

        $db->table('scores')->insert(['player' => $player, 'score' => $score]);

        return Score::query()->orderByDesc('score')->limit(10)->get()->toArray();
    }
}