08-06-2023, 04:15 PM
When I tried to custom polymorphic types in a morph relationship, as the spec recommended,
> You may register the morphMap in the boot function of your
> AppServiceProvider or create a separate service provider if you wish.
I added the morpMap function in AppServiceProvider register function (I don't find the boot function in Lumen 5.3 which is used).
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$propertyConfig = include ('../config/config_property.php');
Relation::morphMap($propertyConfig['property_morph_map']);
}
}
Then, when I tried to run some php artisan commands, it threw this error,
> [ErrorException]
> include(../config/config_property.php): failed to open stream: No such
> file or directory
but the morphMap function does work, which means the address is correct when I run this code on Homestead.
This is my first Lumen project, and I'm still not familiar with the Service Provider. It's kind of weird to me how the register function can influence the artisan command...
> You may register the morphMap in the boot function of your
> AppServiceProvider or create a separate service provider if you wish.
I added the morpMap function in AppServiceProvider register function (I don't find the boot function in Lumen 5.3 which is used).
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$propertyConfig = include ('../config/config_property.php');
Relation::morphMap($propertyConfig['property_morph_map']);
}
}
Then, when I tried to run some php artisan commands, it threw this error,
> [ErrorException]
> include(../config/config_property.php): failed to open stream: No such
> file or directory
but the morphMap function does work, which means the address is correct when I run this code on Homestead.
This is my first Lumen project, and I'm still not familiar with the Service Provider. It's kind of weird to me how the register function can influence the artisan command...