4

I've just installed Entrust to add Role-based Permissions to my application based on Laravel 5.2. But when I try to execute

php artisan vendor:publish

I get this error :

PHP Fatal error: " Call to undefined method Illuminate\Foundation\Application::bindShared() in ../vendor/zizaco/entrust/src/Entrust/EntrustServiceProvider.php on line 72 "

can anyone help me?

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
devma
  • 43
  • 1
  • 4

3 Answers3

5

just repalce bindShared() with singleton()

Raihan Mahmud
  • 78
  • 1
  • 11
1

You are using previous version that is not compatible with Laravel 5.1.+. Make sure you are using latest version or run composer update zizaco/entrust to update this package to latest version that is defined in composer.json

If you look at this commit you will set it has been already changed a while ago.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
0

I have researched more and got solution you need update function name only.

vendor/illuminate/html/HtmlServiceProvider.php

$this->app->bindShared('form', function($app) 

To

$this->app->singleton('form', function($app)

on line number : 36 and 40

WitVault
  • 23,445
  • 19
  • 103
  • 133
  • I'm using laravel 5.2 and i can't find vendor/illuminate/html/HtmlServiceProvider.php, do you have any idea where this setting is? – radren Jun 17 '21 at 02:16