Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable - php

I'm upgrading Laravel from 5.2 to 5.3
I followed the steps mentioned here:
https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
When I tried to to do composer update I kept getting:
[2021-04-12 06:15:52] build.ERROR: exception 'Illuminate\Contracts\Container\BindingResolutionException' with message 'Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable.' in XXXXXXXXXXXX/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php:763
#0 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('Illuminate\\Cont...', Array)
#1 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#2 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#3 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(175): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#4 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(144): Illuminate\Support\Facades\Facade::resolveFacadeInstance('Illuminate\\Cont...')
#5 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(231): Illuminate\Support\Facades\Facade::getFacadeRoot()
#6 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Facade::__callStatic('policy', Array)
#7 /Users/ahmad/Projects/admin/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/AuthServiceProvider.php(25): Illuminate\Support\Facades\Gate::policy('XXXXXX\\Model', 'XXXXXXX\\Polic...')
#8 /Users/ahmad/Projects/admin/app/Providers/AuthServiceProvider.php(26): Illuminate\Foundation\Support\Providers\AuthServiceProvider->registerPolicies()
#9 [internal function]: XXXXXX\Providers\AuthServiceProvider->boot()
I added the Gate to my providers array, and tried clearing the bootstrap cache folder and delete the vendor, and reinstall everything in the composer.json
Any advises?

When you upgrade from an older version of Laravel, it may contain some old files or code which are not needed. In my case, I needed to update config/app.php file as per the latest code and it fixed the error.

Related

array_merge(): Argument #2 is not an array after adding class into providers

I am using pbmedia/laravel-ffmpeg as soon as I installed and added the providers and alias, it shows me the following error. This code was simply working on another machine
array_merge(): Argument #2 is not an array
I have tried the following things
Composer update/ and Fresh install
Cleaning the bootstrap/cache/
Checked the config file for laravel-ffmpeg it's there and fine
Publish the config file using the artisan CLI tool: php artisan vendor:publish --provider="Pbmedia\LaravelFFMpeg\FFMpegServiceProvider"
Here is the portion from laravel.log when I tried to run.
[2019-06-19 00:34:40] local.ERROR: ErrorException: array_merge(): Argument #2 is not an array in /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:59
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'array_merge(): ...', '/Users/damanmok...', 59, Array)
#1 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php(59): array_merge(Array, 1)
#2 /Users/damanmokha/edetyv2/vendor/pbmedia/laravel-ffmpeg/src/FFMpegServiceProvider.php(25): Illuminate\Support\ServiceProvider->mergeConfigFrom('/Users/damanmok...', 'laravel-ffmpeg')
#3 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(565): Pbmedia\LaravelFFMpeg\FFMpegServiceProvider->register()
#4 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(74): Illuminate\Foundation\Application->register(Object(Pbmedia\LaravelFFMpeg\FFMpegServiceProvider))
#5 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(540): Illuminate\Foundation\ProviderRepository->load(Array)
#6 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#7 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(267): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /Users/damanmokha/edetyv2/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(113): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 /Users/damanmokha/edetyv2/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main}
if I don't add these providers it works fine, but then I am not able to use ffmpeg without that.
Laravel Version 5.3
pbmedia/laravel-ffmpeg 1.3
php version: 7.1

When I opened the project,I get back this error message

When I opened the project,I get back this error message :
Fatal error: Uncaught Error: Class 'String' not found in /dev/local/lib/Cake/Utility/Debugger.php:339 Stack trace: #0 /dev/local/lib/Cake/Utility/Debugger.php(741): Debugger::trace(Array) #1 /dev/local/lib/Cake/Error/ErrorHandler.php(219): Debugger->outputError(Array) #2 /dev/local/lib/Cake/Core/App.php(565): ErrorHandler::handleError(2, 'Declaration of ...', '/dev/local...', 25, Array) #3 /dev/local/lib/Cake/Core/App.php(565): include() #4 [internal function]: App::load('TradeLog') #5 [internal function]: spl_autoload_call('TradeLog') #6 /dev/local/lib/Cake/Utility/ClassRegistry.php(145): class_exists('TradeLog') #7 /dev/local/app/Controller/Component/UserComponent.php(61): ClassRegistry::init('TradeLog') #8 /dev/local/app/Controller/Component/PlatformAgentComponent.php(24): UserComponent->__construct(Object(ComponentCollection), Array) #9 /Us in /dev/local/lib/Cake/Utility/Debugger.php on line 339
The newly configured environment in mac os.
When I paste the project into a folder, this error occurs. What's the matter?
This is a compatibility issue between Cakephp 2.4 and PHP7 (because string became reserved word in PHP7, so Cakephp cannot use it as a class name). Using of newer version of Cakephp is suggested. Also downgrading your PHP to 5.6 could solve the problem.
You need to upgrade to CakePHP > 2.8 which is compatible with PHP7
https://github.com/cakephp/cakephp/releases/2.8.0

Laravel Excel Installation

I've just used composer to get Maatwebsite Laravel-Excel. I am about to use it but I am brand new to installing/using packages. So far I've only used what is shipped with Laravel.
I'm reading the documentation and am following the steps (I've done the first three steps) but I am confused by this line;
The class is binded to the ioC as excel
$excel = App::make('excel');
I don't really know what most of that means. I have read up a little on ioC and then Dependency Injection (also new to me). But I still don't know - is this part of the docs telling me to do something?? I ran php artisan on the command line (for another purpose) and I got this back;
[2015-04-23 13:42:09] local.ERROR: exception 'BadMethodCallException' with message 'Call to undefined method [package]' in /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php:226
Stack trace:
#0 /vagrant/source/laravel-excel/vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php(45): Illuminate\Support\ServiceProvider->__call('package', Array)
#1 /vagrant/source/laravel-excel/vendor/maatwebsite/excel/src/Maatwebsite/Excel/ExcelServiceProvider.php(45): Maatwebsite\Excel\ExcelServiceProvider->package('maatwebsite/exc...')
#2 [internal function]: Maatwebsite\Excel\ExcelServiceProvider->boot()
#3 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Container/Container.php(523): call_user_func_array(Array, Array)
#4 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(703): Illuminate\Container\Container->call(Array)
#5 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(685): Illuminate\Foundation\Application->bootProvider(Object(Maatwebsite\Excel\ExcelServiceProvider))
#6 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(Maatwebsite\Excel\ExcelServiceProvider), 19)
#7 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(686): array_walk(Array, Object(Closure))
#8 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(15): Illuminate\Foundation\Application->boot()
#9 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(181): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#10 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(195): Illuminate\Foundation\Application->bootstrapWith(Array)
#11 /vagrant/source/laravel-excel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(92): Illuminate\Foundation\Console\Kernel->bootstrap()
#12 /vagrant/source/laravel-excel/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}
php artisan ran sucessfully when I took out the maatwebsite references in config/app.php - so there must be more to do here but I don't know what.
Looks like the documentation is listing the wrong version. The 1.x branch is meant for Laravel 4.x. The GitHub page provides a better guide for Laravel 5 users. Try changing the version to 2.* in your composer.json and re-run composer update. Add the correct references back to your app.php you should be able to run php artisan without errors.
The App::make('excel') command should also work after that.

Upgrade CakePHP 1.2 to 2.4

What I have :
I have cakephp application,which is in CakePHP 1.2.12.
What I tried :
I use Upgrade Plugin : https://github.com/dereuromark/cakephp-upgrade
I have followed all the step
I have download new Cakephp 2.4
I have create Plugin in folder inside app of cakephp1.3 application
rename /app/config folder to /app/Config
write CakePlugin::loadAll(); in my app/Config bootstrap
What the error :
when I try to
..\lib\Cake\Console\cake Upgrade.Upgrade all
Its give me error like
Error: Plugin Upgrade could not be found.
#0 C:\xampp\htdocs\cakephp24\lib\Cake\Core\App.php(365): CakePlugin::path('Upgrade')
#1 C:\xampp\htdocs\cakephp24\lib\Cake\Core\App.php(226): App::pluginPath('Upgrade')
#2 C:\xampp\htdocs\cakephp24\lib\Cake\Core\App.php(547): App::path('Console/Command', 'Upgrade')
#3 [internal function]: App::load('UpgradeShell')
#4 [internal function]: spl_autoload_call('UpgradeShell')
#5 C:\xampp\htdocs\cakephp24\lib\Cake\Console\ShellDispatcher.php(247): class_exists('UpgradeShell')
#6 C:\xampp\htdocs\cakephp24\lib\Cake\Console\ShellDispatcher.php(198): ShellDispatcher->_getShell('Upgrade.Upgrade')
#7 C:\xampp\htdocs\cakephp24\lib\Cake\Console\ShellDispatcher.php(66): ShellDispatcher->dispatch()
#8 C:\xampp\htdocs\cakephp24\lib\Cake\Console\cake.php(49): ShellDispatcher::run(Array)
#9 {main}

Magento : Error on configuring

I'm Using Mangento Version : 1.7.0.2
When i tried to install with the sample data which magneto, it gives me the following error. Does any have faced similar kind of an issue.
Error in file: "C:\xampp\htdocs\magento\app\code\core\Mage\Sales\sql\sales_setup
\mysql4-upgrade-0.9.16-0.9.17.php" - Can't retrieve entity config:
sales/quote_shipping_rate
Trace:
#0 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(645):
Mage::exception('Mage_Core', 'Error in file: ...')
#1 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(437):
Mage_Core_Model_Resource_Setup->_modifyResourceDb('upgrade', '0.9.16', '1.6.0.7')
#2 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(320):
Mage_Core_Model_Resource_Setup->_upgradeResourceDb('0.9.16', '1.6.0.7')
#3 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\Resource\Setup.php(235):
Mage_Core_Model_Resource_Setup->applyUpdates()
#4 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(417):
Mage_Core_Model_Resource_Setup::applyAllUpdates()
#5 C:\xampp\htdocs\magento\app\code\core\Mage\Core\Model\App.php(343):
Mage_Core_Model_App->_initModules()
#6 C:\xampp\htdocs\magento\app\Mage.php(683): Mage_Core_Model_App->run(Array)
#7 C:\xampp\htdocs\magento\index.php(87): Mage::run('', 'store')
#8 {main}
I have found the answer for this problem. The Magento version which i was using was 1.7.0.2 and sample data used was magento-sample-data.1.1.2.zip which was not compatible with this version, hence i changed sample data to 1.6.1.zip.
After using this i could able to install the magento.
My issue was i did not update /app/etc/config.xml with the new file and it was lacking info on the core resource model. Make sure the config.xml fiel is the one that comes with the new version of magento.

Categories