Laravel-medialibrary: Error after installation

Created on 8 Feb 2020  路  2Comments  路  Source: spatie/laravel-medialibrary

Hi,
After installation with composer, i receive an error:

Symfony\Component\Debug\Exception\FatalThrowableError : Class name must be a valid object or a string at /var/www/html/vendor/spatie/laravel-medialibrary/src/MediaLibraryServiceProvider.php:33

29| ], 'views');
30|
31| $mediaClass = config('medialibrary.media_model');
32|
33| $mediaClass::observe(new MediaObserver());
34|
35| $this->loadViewsFrom(__DIR__.'/../resources/views', 'medialibrary');
36| }
37|

Exception trace:

1 Spatie\MediaLibrary\MediaLibraryServiceProvider::boot()
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

2 call_user_func_array([])
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

Most helpful comment

I had this same problem on server with php 7.4.2 and removing config cache manually resolved this issue by running this command: rm bootstrap/cache/config.php

All 2 comments

+1 here. php v7.4.1

> @php artisan package:discover --ansi                                                                                                 

   Symfony\Component\Debug\Exception\FatalThrowableError  : Class name must be a valid object or a string                              

  at C:\Users\Mevlut Canvar\temp-repos\congress\vendor\spatie\laravel-medialibrary\src\MediaLibraryServiceProvider.php:33              
    29|         ], 'views');                                                                                                           
    30|                                                                                                                                
    31|         $mediaClass = config('medialibrary.media_model');                                                                      
    32|                                                                                                                                
  > 33|         $mediaClass::observe(new MediaObserver());                                                                             
    34|                                                                                                                                
    35|         $this->loadViewsFrom(__DIR__.'/../resources/views', 'medialibrary');                                                   
    36|     }                                                                                                                          
    37|                                                                                                                                

I had this same problem on server with php 7.4.2 and removing config cache manually resolved this issue by running this command: rm bootstrap/cache/config.php

Was this page helpful?
0 / 5 - 0 ratings

Related issues

intrepidws picture intrepidws  路  3Comments

jam1e picture jam1e  路  3Comments

ideadx picture ideadx  路  4Comments

eichgi picture eichgi  路  3Comments

netanelwebninja picture netanelwebninja  路  3Comments