Laravel 5 render() pagination error - laravel

->render() work fine.
I run: composer require illuminate/html
set config/app.php
add providers
'Illuminate\View\ViewServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
add aliases
'Form' => 'Illuminate\Html\FormFacade',
'Html' => 'Illuminate\Html\HtmlFacade',
now, ->render() do not work, I try ->render() with {!! !!} and <?php ?>
Whoops, looks like something went wrong.
1/1
FatalErrorException in LengthAwarePaginator.php line 126:
Access to undeclared static property: Illuminate\Pagination\LengthAwarePaginator::$presenterResolver
1. in LengthAwarePaginator.php line 126
2. at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Access to undeclared static property: Illuminate\Pagination\LengthAwarePaginator::$presenterResolver', 'file' => 'C:\wamp\www\laravel\vendor\laravel\framework\src\Illuminate\Pagination\LengthAwarePaginator.php', 'line' => '126')) in compiled.php line 1721
3. at HandleExceptions->handleShutdown()

Check your local and remote Laravel version by using artisan -v | grep version.
In my case, they were different. I had a hard time updating it to match my local though. I didn't catch it because composer update results to Nothing to install or update even if I had cleared composer cache by composer clear-cache and reinstalling all the dependencies in the vendor folder.
I ended up deleting the whole project directory and cloning from source.

Something is still out of date...
check version as suggested using:
php artisan -V
and compare with https://github.com/laravel/laravel
In my situation i was need to delete: compiled.php in storage dir
then run composer update -vvv
and ... error disrepair :-)

The $compiledPath variable has been changed in the 5.0.16 release.
To solve your problem, you need to update $compiledPath variable in your bootstrap/autoload.php file to:
$compiledPath = __DIR__.'/../vendor/compiled.php';

Related

Remove package from laravel-6.2 existing project an error occurred

Remove pragmarx/tracker package from laravel project by the following composer command
composer remove pragmarx/tracker
It's remove successfully but the below error shown. Even though composer update the error not fix.
Illuminate\Contracts\Container\BindingResolutionException
Target class [PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker] does not exist.
How can I fix this error ? and which method to follow to completely remove any unused packages from laravel?
From the documentation on the repo:
Installing
Require the tracker package by executing the following command in your command line:
composer require pragmarx/tracker
Add the service provider to your app/config/app.php:
PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class,
Add the alias to the facade on your app/config/app.php:
'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade',
Publish tracker configuration:
Laravel 4
php artisan config:publish pragmarx/tracker
Laravel 5
php artisan vendor:publish --provider="PragmaRX\Tracker\Vendor\Laravel\ServiceProvider"
Enable the Middleware (Laravel 5)
Open the newly published config file found at app/config/tracker.php and enable use_middleware:
'use_middleware' => true,
Add the Middleware to Laravel Kernel (Laravel 5)
Open the file app/Http/Kernel.php and add the following to your web middlewares:
\PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class,
...
If you removed the package, make sure to
delete the config/tracker.php file
remove the line PragmaRX\Tracker\Vendor\Laravel\ServiceProvider::class from config/app.php
remove the line 'Tracker' => 'PragmaRX\Tracker\Vendor\Laravel\Facade', from config/app.php
remove the line \PragmaRX\Tracker\Vendor\Laravel\Middlewares\Tracker::class, from app/Http/Kernel.php

In ProviderRepository.php line 208: Class 'Sentry\SentryLaravel\SentryLaravelServiceProvider' not found

I'm trying to install Sentry Error Tracking into my Laravel 5 Project. It throws an Error when i try publishing the Provider using the command
php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"
I added this into config/app.php
'providers' => array(
// ...
Sentry\SentryLaravel\SentryLaravelServiceProvider::class,
)
'aliases' => array(
// ...
'Sentry' => Sentry\SentryLaravel\SentryFacade::class,
)
Then i ran
php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider"
And it threw the Error
In ProviderRepository.php line 208:
Class 'Sentry\SentryLaravel\SentryLaravelServiceProvider' not found
I've been searching for various solutions but none of them worked for me. This is very important for my project. Can i please please get some assistance. Thank You.
I recommend official sentry documentation.
https://sentry.io/for/laravel/
Not sure what is your exact development environment.(OS, PHP version, laravel version etc).
Here are something you can check.
check your installed sentry laravel package. If you did not install it, use next command to install.
composer require sentry/sentry-laravel
check version of sentry/sentry-laravel from composer.json.
Please notice after version 1.x namespace has been changed to
'providers' => array(
Sentry\Laravel\ServiceProvider::class,
)
'aliases' => array(
'Sentry' => Sentry\Laravel\Facade::class,
)
Namespace update
version 0.x
Sentry\SentryLaravel\SentryLaravelServiceProvider::class
https://github.com/getsentry/sentry-laravel/blob/0.10.1/src/Sentry/SentryLaravel/SentryLaravelServiceProvider.php
version 1.x
Sentry\Laravel\ServiceProvider::class
https://github.com/getsentry/sentry-laravel/blob/1.0.0/src/Sentry/Laravel/ServiceProvider.php

Class 'Yajra\DataTables\DatatablesServiceProvider' not found

I've developed Laravel Project in my local computer.
I used Yajra Pakagebox for using bootstrap datatables on it.
Like this :
composer require yajra/laravel-datatables-oracle
php artisan vendor:publish
Then I pushed them all into Hosting Server but it displays errors like below.
(1/1) FatalThrowableError
Class 'Yajra\DataTables\DatatablesServiceProvider' not found
in ProviderRepository.php (line 208)
at ProviderRepository->createProvider('Yajra\\DataTables\\DatatablesServiceProvider')
in ProviderRepository.php (line 144)
at ProviderRepository->compileManifest(array('Illuminate\\Auth\\AuthServiceProvider', 'Illuminate\\Broadcasting\\BroadcastServiceProvider', 'Illuminate\\Bus\\BusServiceProvider', 'Illuminate\\Cache\\CacheServiceProvider', 'Illuminate\\Foundation\\Providers\\ConsoleSupportServiceProvider', 'Illuminate\\Cookie\\CookieServiceProvider', 'Illuminate\\Database\\DatabaseServiceProvider', 'Illuminate\\Encryption\\EncryptionServiceProvider', 'Illuminate\\Filesystem\\FilesystemServiceProvider', 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider', 'Illuminate\\Hashing\\HashServiceProvider', 'Illuminate\\Mail\\MailServiceProvider', 'Illuminate\\Notifications\\NotificationServiceProvider', 'Illuminate\\Pagination\\PaginationServiceProvider', 'Illuminate\\Pipeline\\PipelineServiceProvider', 'Illuminate\\Queue\\QueueServiceProvider', 'Illuminate\\Redis\\RedisServiceProvider', 'Illuminate\\Auth\\Passwords\\PasswordResetServiceProvider', 'Illuminate\\Session\\SessionServiceProvider', 'Illuminate\\Translation\\TranslationServiceProvider', 'Illuminate\\Validation\\ValidationServiceProvider', 'Illuminate\\View\\ViewServiceProvider', 'Yajra\\DataTables\\DatatablesServiceProvider', 'Laravel\\Tinker\\TinkerServiceProvider', 'App\\Providers\\AppServiceProvider', 'App\\Providers\\AuthServiceProvider', 'App\\Providers\\EventServiceProvider', 'App\\Providers\\RouteServiceProvider'))
in ProviderRepository.php (line 61)
The important thing is I can't execute any command on Hosting Server because it is Shared Hosting Server.
I saw many articles for solving this problem but they are all using "artisan" and "composer" command.
But I can't use this command at all.
I can only upload the source code to server with FTP.
Depending on what version of DataTables you are using, it may be simple capitalization issue. After version 8 you should use:
Yajra\DataTables\DataTablesServiceProvider
Before version 8 use:
Yajra\Datatables\DatatablesServiceProvider
Upgrade notes reference: https://yajrabox.com/docs/laravel-datatables/master/upgrade#namespace
Please run below command and try:
composer update
composer dump-autoload
php artisan config:cache
php artisan cache:clear
It is working for v#8.3
Yajra\DataTables\DataTablesServiceProvider::class,
'Datatables' => Yajra\DataTables\Facades\DataTables::class,
Please add this to the config/app.php file.
The first line goes under the "Package Service Providers" section
and the second line goes under the "Class Aliases" section
replace Datatables with DataTables
Re install with the plugin along with the buttons plugin and now it's working.
composer require yajra/laravel-datatables-buttons:^3.0
In the project's folder
rm -R vendor/
rm -R bootstrap/cache
mkdir bootstrap/cache
chmod -R 777 bootstrap/*
if your laravel version => 5.4
composer require yajra/laravel-datatables-oracle:"~8.0"
if your laravel version => 5.8
composer require yajra/laravel-datatables-oracle:"~9.0"
#config/app.php
'providers' => [
...,
Yajra\DataTables\DataTablesServiceProvider::class,
]
'aliases' => [
...,
'DataTables' => Yajra\DataTables\Facades\DataTables::class,
]
composer dumpautoload
composer install
It works for me.
Source: https://github.com/yajra/laravel-datatables[https://github.com/yajra/laravel-datatables][1]
REASON ITS NOT WORKING IS:
you installed the library. and added it in config/app.php in providers array.
don't forget to run
php artisan vendor:publish
after that.
Try below steps to resolve this issue:
Use composer show to check which version of packages you are using.
Delete all files under bootstrap/cache folder
Delete vendor folder and reinstall all packages using composer install.
all the files you know you're changing to ftp (migrations config controller...)
and replaced local files to server with ftp
/composer.json
/composer.lock
/bootstrap/*
/storage/framework/cache/*
/storage/framework/views/*
/vendor/composer/*
/vendor/autoload.php
If the problem persists, I'm need to relay the version of the Laravel.
Tested with
php artisan --version
Laravel Framework 5.4.19
In your [config/app.php] file, edit the aliases array. Change it from
'Datatables' => Yajra\Datatables\Facades\Datatables::class
to
'Datatables' => Yajra\Datatables\DatatablesServiceProvider::class

Laravel Class 'Socialite' not found

Using composer, I have installed Socialite package to my local machine. It works well. Then I upload all the vendor/laravel/socialite directory as it is to server. Then on server, in composer.json added the line -
"laravel/socialite": "^2.0"
Also, in config/app.php make below changes -
In provider section add the line -
Laravel\Socialite\SocialiteServiceProvider::class,
In aliases section add this line -
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
Then, as per documentation add below code in config/services.php file -
'facebook' => [
'client_id' => '{{my_client_id}}',
'client_secret' => '{{my_secret_key}}',
'redirect' => 'http://mydomain/public/callback',
],
The Controller, I am using has included use Socialite; at top.
Bur now, it gives me error as Class 'Socialite' not found on server. Where as it works fine on my local machine.
Am I missing something to upload on server?
Your help is appreciated.
Thanks.
You need to do dump autoload everytime you make changes in composer.json, composer dump-auto

Can not start laravel after trying to install library

I have web-app on Laravel and I tried to update yajra/datatables to last version, so it needed
'Maatwebsite\Excel\ExcelServiceProvider'
I tried composer update, so it didn't help.
Now I removed this line from composer.json
But on calling php artisan clear-compiled
It shows me an error:
PHP Fatal error: Class 'Maatwebsite\Excel\ExcelServiceProvider' not found in /var/www/html/talimger.xyz/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 575
Show where I should remove this Maatwebsite files
`
The instructions at https://github.com/Maatwebsite/Laravel-Excel tell you what to do, but not how to do it. The assumption is that you already know a bit about composer.
Here's the 'how to do it'...
1) Remove the service provider entries you made and delete any lines you added to composer and then type the following:
composer require "maatwebsite/excel"
2) After updating composer, add the ServiceProvider to the providers array in config/app.php
Laravel 5.1:
'Maatwebsite\Excel\ExcelServiceProvider',
Laravel 5.2:
Maatwebsite\Excel\ExcelServiceProvider::class,
3) You can use the facade for shorter code. Add this to your aliases:
Laravel 5.1:
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
Laravel 5.2:
'Excel' => Maatwebsite\Excel\Facades\Excel,::class
Comment out 'Maatwebsite\Excel\ExcelServiceProvider' from the providers array in app.php under config then run composer update when you are done then your uncomment it.

Resources