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

Add support for models without all columns #385

Merged
merged 1 commit into from
Mar 24, 2023
Merged

Add support for models without all columns #385

merged 1 commit into from
Mar 24, 2023

Conversation

martio
Copy link
Contributor

@martio martio commented Mar 21, 2023

Support for models without all columns.

Example:

$model = Team::query()
    ->with(relations: [
        'user:id,name',
        'club:id,name,country',
        'ranking:id,team_id,rank,rating',
     ])
     ->find(id: $id);

Currently throwing an error: Illuminate\Database\Eloquent\MissingAttributeException: The attribute [created_at] either does not exist or was not retrieved for model [App\Models\Ranking]. in /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:469 in Laravel 10.

@rubenvanassche
Copy link
Member

Thanks!

@rubenvanassche rubenvanassche merged commit b6b9d96 into spatie:main Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants