laravel 4.2中找不到服务类错误?

时间:2016-10-03 07:32:43

标签: laravel

附图显示了我的确切问题:
Attached Image shows exact my problem 下面是我的app.php,其中定义了providers数组。****这是laravel 4.2。

 'providers' => array(

        'Illuminate\Foundation\Providers\ArtisanServiceProvider',
        'Illuminate\Auth\AuthServiceProvider',
        'Illuminate\Cache\CacheServiceProvider',
        'Illuminate\Session\CommandsServiceProvider',
        'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
        'Illuminate\Routing\ControllerServiceProvider',
        'Illuminate\Cookie\CookieServiceProvider',
        'Illuminate\Database\DatabaseServiceProvider',
        'Illuminate\Encryption\EncryptionServiceProvider',
        'Illuminate\Filesystem\FilesystemServiceProvider',
        'Illuminate\Hashing\HashServiceProvider',
        'Illuminate\Html\HtmlServiceProvider',
        'Illuminate\Log\LogServiceProvider',
        'Illuminate\Mail\MailServiceProvider',
        'Illuminate\Database\MigrationServiceProvider',
        'Illuminate\Pagination\PaginationServiceProvider',
        'Illuminate\Queue\QueueServiceProvider',
        'Illuminate\Redis\RedisServiceProvider',
        'Illuminate\Remote\RemoteServiceProvider',
        'Illuminate\Auth\Reminders\ReminderServiceProvider',
        'Illuminate\Database\SeedServiceProvider',
        'Illuminate\Session\SessionServiceProvider',
        'Illuminate\Translation\TranslationServiceProvider',
        'Illuminate\Validation\ValidationServiceProvider',
        'Illuminate\View\ViewServiceProvider',
        'Illuminate\Workbench\WorkbenchServiceProvider',
        'FanzoopMain\Theme\Provider\ThemeServiceProvider',
        'Creolab\LaravelModules\ServiceProvider',
        'FanzoopMain\Menu\MenuServiceProvider',
        'FanzoopMain\Image\ImageServiceProvider',
        'FanzoopMain\Hook\HookServiceProvider',
        /**
        * App base
        */
        'App\Providers\ConfigurationServiceProvider',
        'App\Providers\AddonServiceProvider',
        'App\Providers\PhotoServiceProvider',
        'App\Providers\AdmincpServiceProvider',
        'App\Providers\ThemeManagerServiceProvider',
        'App\Providers\NotificationServiceProvider',
        'App\Providers\MentionServiceProvider',
        'App\Providers\HashtagServiceProvider',
        'App\Providers\MenuServiceProvider',
        'App\Providers\EmoticonServiceProvider',
        'App\Providers\ConnectionServiceProvider',
        'App\Providers\PostServiceProvider',
        'Artdarek\OAuth\OAuthServiceProvider',
        'Maatwebsite\Excel\ExcelServiceProvider',
),

/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/

'manifest' => storage_path().'/meta',

/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/

'aliases' => array(

        'App'             => 'Illuminate\Support\Facades\App',
        'Artisan'         => 'Illuminate\Support\Facades\Artisan',
        'Auth'            => 'Illuminate\Support\Facades\Auth',
        'Blade'           => 'Illuminate\Support\Facades\Blade',
        'Cache'           => 'Illuminate\Support\Facades\Cache',
        'ClassLoader'     => 'Illuminate\Support\ClassLoader',
        'Config'          => 'Illuminate\Support\Facades\Config',
        'Controller'      => 'Illuminate\Routing\Controller',
        'Cookie'          => 'Illuminate\Support\Facades\Cookie',
        'Crypt'           => 'Illuminate\Support\Facades\Crypt',
        'DB'              => 'Illuminate\Support\Facades\DB',
        'Eloquent'        => 'Illuminate\Database\Eloquent\Model',
        'Event'           => 'Illuminate\Support\Facades\Event',
        'File'            => 'Illuminate\Support\Facades\File',
        'Form'            => 'Illuminate\Support\Facades\Form',
        'Hash'            => 'Illuminate\Support\Facades\Hash',
        'HTML'            => 'Illuminate\Support\Facades\HTML',
        'Input'           => 'Illuminate\Support\Facades\Input',
        'Lang'            => 'Illuminate\Support\Facades\Lang',
        'Log'             => 'Illuminate\Support\Facades\Log',
        'Mail'            => 'Illuminate\Support\Facades\Mail',
        'Paginator'       => 'Illuminate\Support\Facades\Paginator',
        'Password'        => 'Illuminate\Support\Facades\Password',
        'Queue'           => 'Illuminate\Support\Facades\Queue',
        'Redirect'        => 'Illuminate\Support\Facades\Redirect',
        'Redis'           => 'Illuminate\Support\Facades\Redis',
        'Request'         => 'Illuminate\Support\Facades\Request',
        'Response'        => 'Illuminate\Support\Facades\Response',
        'Route'           => 'Illuminate\Support\Facades\Route',
        'Schema'          => 'Illuminate\Support\Facades\Schema',
        'Seeder'          => 'Illuminate\Database\Seeder',
        'Session'         => 'Illuminate\Support\Facades\Session',
        'SSH'             => 'Illuminate\Support\Facades\SSH',
        'Str'             => 'Illuminate\Support\Str',
        'URL'             => 'Illuminate\Support\Facades\URL',
        'Validator'       => 'Illuminate\Support\Facades\Validator',
        'View'            => 'Illuminate\Support\Facades\View',


        'OAuth'           => 'Artdarek\OAuth\Facade\OAuth',
        'Addon'           => 'App\Facades\Addon',
        'ThemeManager'    => 'App\Facades\ThemeManager',
        'Excel'           => 'Maatwebsite\Excel\Facades\Excel',
),

这是我的另一个名为ConfigurationServiceProvider.php的文件,我正在使用错误代码。

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use App\Providers\ConfigurationServiceProvider;                
/**
 * Configuration service provider
 *
 * @author : Tiamiyu waliu kola
 * @webiste: procrea8.com
 */

class ConfigurationServiceProvider extends ServiceProvider
{
    public function register(){

    }

    public function boot(){        
        if (\Config::get('system.installed')) {            
            $repository = app('App\Repositories\ConfigurationRepository');

            foreach($repository->getAll() as $configuration) {
                \Config::set($configuration['slug'], $configuration['value']);
            }               
            /**
             * set image configuration
             */
            \Config::set('image::max-size', \Config::get('image-max-size'));
            \Config::set('image::save-original', \Config::get('keep-original-image'));
            \Config::set('image::allow-animated-gif', \Config::get('allow-animated-gif'));
            \Config::set('image::ext-allowed', \Config::get('image-allow-type', 'gif,png,jpg'));


            /**Assets***/
            \Config::set('theme::minifyAssets', \Config::get('minify-assets'));            
        }
    }
}

2 个答案:

答案 0 :(得分:0)

这个步骤

  1. 临时删除您的提供商和别名

  2. 键入命令composer update

  3. 然后添加此提供者和别名

  4. 因为当您更新作曲家时,他会在添加您的项目之前尝试找到这些类,更新您的作曲家后添加此类

答案 1 :(得分:0)

尝试

public class ImageAdapter extends BaseAdapter {
    private Context mContext;
    JSONObject jsonobject;
    DatabaseUserTable myDatadb;
    JSONArray jsonarray;
    String imageUrl = "";
    String id = "";
    ArrayList<String> Urls = new ArrayList<String>();
    // Keep all Images in array
    public Integer[] mThumbIds = {
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall,R.drawable.imagewall,
            R.drawable.imagewall
    };

    // Constructor
    public ImageAdapter(Context c){
        mContext = c;
    }

    @Override
    public int getCount() {
        return mThumbIds.length;
    }

    @Override
    public Object getItem(int position) {
        return mThumbIds[position];
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView imageView = new ImageView(mContext);
        imageView.setImageResource(mThumbIds[position]);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        imageView.setLayoutParams(new GridView.LayoutParams(220, 220));
        return imageView;
    }
}

或者

composer dump-autoload

确保您已在composer.json

上注册了您的提供者目录
php artisan dump-autoload