I am trying to convert digits to words in laravel 5.2 using Terbilang.
I first run the below CLI
composer require riskihajar/terbilang
and then added Providers & Aliases to config file:
Riskihajar\Terbilang\TerbilangServiceProvider::class,
'Terbilang' => Riskihajar\Terbilang\Facades\Terbilang::class,
then I used Terbilang::make(1000); to the controller and I got the following error
FatalThrowableError in PdfController.php line 78: Class 'App\Http\Controllers\Terbilang' not found.
Is there anything that Imissed. Thanks in advance.
You also need to add the following in your controller above the class declaration.
use Terbilang;
Related
When i put:
use Spatie\Analytics\Analytics;
It gives the error
'Non-static method should not be called statically'
But when I only put:
use Analytics;
I gives a white page on refresh or says
"The use statement with non-compound name 'Analytics' has no effect "
when starting.
I am using Laravel 5.5.4 and although it says the facade should be automatically setup, it wasn't working so I also added this manually to the // config/app.php:
'Analytics' => Spatie\Analytics\AnalyticsFacade::class,
But it still is not working.
from the package github. there was a solution
php artisan config:clear
but it did not work for me.
This package can be installed through Composer.
composer require spatie/laravel-analytics
In Laravel 5.5 and above the package will autoregister the service provider. In Laravel 5.4 you must install this service provider.
config/app.php
'providers' => [
...
Spatie\Analytics\AnalyticsServiceProvider::class,
...
];
In Laravel 5.5 and above the package will autoregister the facade. In Laravel 5.4 you must install the facade manually.
config/app.php
'aliases' => [
...
'Analytics' => Spatie\Analytics\AnalyticsFacade::class,
...
];
You want to use the facade to access the class, you will need to change:
use Spatie\Analytics\Analytics; to use Analytics;
Another way around just import this to your class:
use Spatie\Analytics\AnalyticsFacade as Analytics
It depends in what context you place the use statement.
In Laravel you also can use facades without having to import it with use.
The same class can be called by using \Analytics in your code call.
Example:
\Analytics::fetchMostVisitedPages(\Period::days(7));
I am using laravel lumen 5.2.
Target [Laravel\Socialite\Contracts\Factory] is not instantiable.
I came across this error when trying to get Laravel to login with Twitter using the Socialite package.
Work already done:
A) In config\app.php
1. Laravel\Socialite\SocialiteServiceProvider::class
2. 'Socialite' => Laravel\Socialite\Facades\Socialite::class
I followed this :
http://goodheads.io/2015/08/24/using-twitter-authentication-for-login-in-laravel-5/
You would need to add the following in config/app.php
In providers add this
Laravel\Socialite\SocialiteServiceProvider::class
In aliases add this
'Socialite' => Laravel\Socialite\Facades\Socialite::class
What helped me is writing
use Socialite;
in the controller (just the alias, not the full path). And then running
php artisan config:clear
in the terminal.
For me, it was to add $app->register( \Laravel\Socialite\SocialiteServiceProvider::class); to app.php in the bootstrap folder, using Lumen 5.6.
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.
I installed the extension https://github.com/GrahamCampbell/Laravel-Flysystem. I need to work with the cloud (Dropbox). I set up parameters for flysystem.php Dropboks. But when I try to send a file - an error.
use Illuminate\Support\Facades\App;
...
Flysystem::connection('dropbox')->put('test222.txt', 'bar');
FatalErrorException in DropboxConnector.php line 69: Class 'Dropbox\Client' not found
http://clip2net.com/s/3l0Hwe1
What could be the problem?
Sorry for bad english and thank you!
Have you installed Dropbox adapter?
composer require league/flysystem-dropbox
This will then install Dropbox SDK for PHP which contain Dropbox\Client class.
When I call any of the url helper functions, e.g
URL::asset('foo/bar')
from within a command the base URL is an empty string, and the url returned is
http://:/foo/bar
I am running the command by calling
php artisan myproject:MyCommand
from a command line. Where MyCommand is a class that extends Illuminate\Console\Command
I have set my url in config/app.php but I only get a fully qualified url when I run from an
HTTP Request
I am using Laravel Framework version 4.1.24
Where did you get URL::asset('') from? I don't see it mentioned on the documentation
Try this instead:
URL::to('foo/bar')
Found the issue.
My artisan file was missing this line
$app->setRequestForConsoleEnvironment();
The file I had was an older version. This line was added Oct 25, 2013