Laracord has full support for Laravel's ORM Eloquent and utilizes it out of the box for the User model alongside SQLite.


For extensive documentation on Eloquent, we highly suggest taking a look at the Laravel documentation.

Using MySQL

To use MySQL instead of Laracord's default SQLite driver, you may set the DB_CONNECTION to mysql and provide the database credentials in your .env file:


Creating a Model

Creating a database model can be done using the laracord binary:

$ php laracord make:model Balance

If you would like to generate a database migration when creating the model, you may use the -m option:

$ php laracord make:model Balance -m

Models generated by the make:model command will be placed in the app/Models directory. The following is a basic example of a generated model:


namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Balance extends Model
    // ...

Creating a Migration

Outside of using the -m option on make:model, you may also generate a migration using the make:migration console command:

$ php laracord make:migration create_balances_table

Generated migrations will be placed in the database/migrations directory. Each migration filename contains a timestamp which allows Laravel to know the order of the migrations.

The following is a simple migration that would reflect a Balances table:


use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
     * Run the migrations.
    public function up(): void
        Schema::create('balances', function (Blueprint $table) {
            $table->unique(['discord_id', 'server_id']);

     * Reverse the migrations.
    public function down(): void

In the migration above, the User's discord_id and server_id are both stored and made unique when used in combination with one another. Alongside that is the amount consisting of the user's balance.