corcel / acf

Advanced Custom Fields (ACF) plugin for Corcel
128 stars 100 forks source link

Call to a member function setConnection() on null #112

Closed rey-a-reyes closed 1 month ago

rey-a-reyes commented 1 month ago

Hi, I manage to setup the corcel and connect the database and it works perfectly however when it comes to CORCEL/ACF

when I try to use below command it keep showing ; error: Call to a member function setConnection() on null

the dd() command show me that acf data reflects perfectly , the issue only appears when we use ->fullname or text('fullname')

$page = Post::type('page')->slug('about-us')->first();
$page->acf->fullname
<?php // File: app/Post.php

namespace App\Models;

use Corcel\Model\Post as Corcel;

class Post extends Corcel
{

    protected $connection = 'wordpress';

    public function customMethod() {
        //
    }
}

        'wordpress' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'database' => env('DB_WPDATABASE', 'laravel'),
            'username' => env('DB_WPUSERNAME', 'root'),
            'password' => env('DB_WPPASSWORD', ''),
            'charset' => env('DB_CHARSET', 'utf8mb4'),
            'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
            'prefix' => 'wp_',
            'strict' => false,
            'engine' => null,
        ],
rey-a-reyes commented 1 month ago

$page->meta->fullname

works perfectly too.