简体   繁体   中英

Laravel own package serviceprovider not found

I'm making a package in Laravel which requires another package. But I'm getting the following error

Fatal error: Class 'Spatie\\MediaLibrary\\MediaLibraryServiceProvider' not found

This is my folder structure

在此处输入图片说明

I included my fresh package to my composer, this looks as following

"psr-4": {
    "App\\": "app/",
    "Notflip\\Cld\\": "packages/Notflip/cld/src/"
}

This is what my service provider looks like

<?php namespace Notflip\Cld;


use Illuminate\Support\ServiceProvider;

class CldServiceProvider extends ServiceProvider {

    public function register()
    {
        $this->app->register(\Spatie\MediaLibrary\MediaLibraryServiceProvider::class);
    }
}

PHPStorm is complaining that there is multiple definitions of the ServiceProvider and the newly required package Spatie/ can't be found

Here's a screenshot for clarity 在此处输入图片说明

Any idea what I might be doing wrong?

Composer update --lock将解决问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM