@65-99 If you set correctly the media library, can you try this?
php artisan cache:clear
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
$user = User::find(54); $path = $user->hasMedia(); dd($path);
respond: false // app\Http\Controllers\User\UserController.php:24
record in db:
INSERT INTO media (id, model_type, model_id, uuid, collection_name, name, file_name, mime_type, disk, conversions_disk, size, manipulations, custom_properties, generated_conversions, responsive_images, order_column, created_at, updated_at) VALUES
(27, 'App\Models\User', 54, '/uuid/', 'avatars', 'bmw2', 'bmw2.png', 'image/png', 'public', 'public', 2422290, '[]', '[]', '{"thumb":true}', '[]', 1, '2024-01-21 13:34:40', '2024-01-21 13:34:42');
user.php (model)
use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\MediaCollections\Models\Media; use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\InteractsWithMedia;
class User extends Authenticatable implements HasMedia { use HasApiTokens, HasFactory, Notifiable; use InteractsWithMedia;
public function registerMediaConversions(Media $media = null): void { $this->addMediaConversion('thumb') ->width(200) ->height(200); }
anyone have an idea why I don't get a response from the database that a user has a photo assigned to them?
Please or to participate in this conversation.