Danven
2 months ago
330
2
Laravel

Go through config() secondary database connection

Posted 2 months ago by Danven

I have a main base and a secondary one. Depending on the environment, the type of secondary database changes.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MyModel extends Model
{
    
    protected $connection = config('database.secondary');

Please sign in or create an account to participate in this conversation.