Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining database in $table no longer works? #1552

Open
Liingon opened this issue May 29, 2024 · 3 comments
Open

Defining database in $table no longer works? #1552

Liingon opened this issue May 29, 2024 · 3 comments
Labels

Comments

@Liingon
Copy link

Liingon commented May 29, 2024

Versions:

  • ide-helper Version: 3.0.0
  • Laravel Version: 11.9.1
  • PHP Version: 8.3

Question:

Before updating to Laravel 11 and ide-helper 3.0.0 I could define a database in the $table field on a Model like protected $table = 'alternate_db.table. Both databases use the same connection.

After the update this no longer generates any documentation that relies on the database table.

Is this intended? Are there any workarounds?

Before 3.0.0:

<?php

namespace App\Models;

use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Example
 *
 * @property int $id
 * @property int $example_int
 * @property string|null $example_string
 *
 * @method static Builder|Example newModelQuery()
 * @method static Builder|Example newQuery()
 * @method static Builder|Example query()
 * @method static Builder|Example whereExampleInt($value)
 * @method static Builder|Example whereExampleString($value)
 * @method static Builder|Example whereId($value)
 *
 * @mixin Eloquent
 */
class Example extends Model {
    protected $table = 'alternate_db.example';

    public $timestamps = false;
}

After 3.0.0:

<?php

namespace App\Models;

use Eloquent;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;

/**
 * @method static Builder|Example newModelQuery()
 * @method static Builder|Example newQuery()
 * @method static Builder|Example query()
 *
 * @mixin Eloquent
 */
class Example extends Model {
    protected $table = 'alternate_db.example';

    public $timestamps = false;
}
@Liingon
Copy link
Author

Liingon commented May 29, 2024

I did another search in issues and found #1487, no idea how I missed that before posting. So this seems to have been reintroduced in the latest release.

@kyoruni
Copy link

kyoruni commented Jan 7, 2025

Hello, I have the same problem.
Is there any update on this issue?

Thank you!

@hafezdivandari
Copy link
Contributor

hafezdivandari commented Jan 22, 2025

Fixed on Laravel 12.x via laravel/framework#54274.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants