laravel carbon isoFormat method does not exist - laravel

I tried to use the Laravel carbon isoFormat method. I received the error Method isoFormat does not exist. My Laravel implementation is 5.7. I tried composer update, and verified that it updated nesbot/carbon.
I copied and pasted code from Mr. Nesbot's manual to see if his code would work.
$mutable = Carbon::now();
var_dump($mutable->isoFormat('dddd D'));
Mr. Nesbot's code produces the same error.
How do I resolve this error, please?

Try the following:
$carbon = new Carbon('now');
$formatted = $carbon->toIso8601String();
var_dump($formatted);

Related

Laravel - Non-static method should not be called statically

I have recently started using laravel for work and I boumped into many issues I cannot stil solve.
I have looked over many many topics and already anwered questions but none of those have helped me with my issue
So, I get this error trying to do 'php artisan serve'
"Non-static method Illuminate\Cache\RateLimiter::for() should not be called statically"
So I went up looking at the code, this is the RateLimiter.php code that gives me the error
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
the error is at the 2nd line of this code, in the RateLimiter:: etc
I get those errors in the CMD
app/Providers/RouteServiceProvider.php:59
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Non-static method Illuminate\Cache\RateLimiter::for() should not be called statically", "myPathToTheProject/app/Providers/RouteServiceProvider.php", [])
app/Providers/RouteServiceProvider.php:38
App\Providers\RouteServiceProvider::configureRateLimiting()
the function is called like this
$this->configureRateLimiting();
hoping you can help me, I will give more infos if are needed
I found out the problem. You need to import the facade, and when you auto-import, it tends to get the wrong package.
Look at the imports. If you find:
use Illuminate\Cache\RateLimiter;
You should replace with
use Illuminate\Support\Facades\RateLimiter;
Worked for me!

Laravel 5.8 Call to undefined method Illuminate\Events\Dispatcher::fire()

I get this error on user registration. I have searched for this problem a lot and still couldn't solve the problem on my side. In laravel 5.8 upgrade, it's written that function fire() is changed to dispatch(), but I can't find any fire() function in any file of my app, so I can see what's happening.
Would appreciate any help. Thanks.
From: https://laravel.com/docs/5.8/events#dispatching-events
Instead of:
Event::fire(new \App\Events\NewUserSignup($new_user));
Do instead:
event(new \App\Events\NewUserSignup($new_user));
The fire method (which was deprecated in Laravel 5.4) of the Illuminate\Events\Dispatcher class has been removed(https://github.com/laravel/framework/pull/26392). You should use the dispatch method instead.
Instead of:
Event::dispatch('customer.created', $customer);
Do this:
Event::dispatch('customer.created', $customer);
OR:
event('customer.created', $customer);

confide laravel Declaration of Zizaco\Confide\ConfideUser::save() should be compatible with Arde

I've modified upon the excellent Laravel 4 bootstrap and suddenly I am getting the error when I go to the route user/login:
Declaration of Zizaco\Confide\ConfideUser::save() should be compatible with
LaravelBook\Ardent\Ardent::save(array $rules = Array, array $customMessages = Array,
array $options = Array, Closure $beforeSave = NULL, Closure
$afterSave = NULL, $force = false)
I had added HybridAuth to composer and updated so I wonder if that had caused incompatibility issues with Confide or Ardent but when I remove it and update (as well as reverting to previous commits) I still get the error.
Any ideas?
Thanks a lot
Jon.
Ardent has added an additional $force parameter to their save() method.
The solution, for now, is to require a specific commit in your composer file:
"laravelbook/ardent": "dev-master#2d1d70ea835b8c53cfe4fc60315a8ee5c672ba19"
You can follow the discussion in issue #113 on GitHub.

Queued Events in Laravel 4: Event::flusher() method not found

According to the Laravel 4 Documentation on queued Events, I tried to register an event flusher this way:
Event::flusher('foo.bar', function($data)
{
Mail::send(array('emails.notification', 'emails.notification_text'), array('content' => $data), function($message)
{
$message
->to('email#example.com', 'My Name')
->bcc('test#example.com')
->subject('Message from Listener');
});
});
But I am getting the following error upon loading of the script:
Call to undefined method Illuminate\Events\Dispatcher::flusher()
I also couldn't find this method in the source codes of L4. But when I change this from Event::flusher() to Event::listen(), everything works as expected.
So my guess is, that the documentation isn't up to date and the Event::flusher() method has been dropped, since Event::listen() does the same work. Or are there any differences between those two methods and I have an error in my code?
You may need to update your libraries using:
$ composer update
If that doesn't work, let us know what your composer.json file looks like - you might be using a beta version if the framework. It was updated very often before the first stable release.

codeigniter image reader prob

Hi im making a image gallery in useing the following tutorial at
http://superdit.com/2010/06/27/basic-image-gallery-with-codeigniter/
i keep getting this error
wrong parameter count for strstr()
google'd and tried this and found i needed to remove a third parameter.
I removed the third parameter from line38 $ext = strrev(strstr(strrev($file), ".", TRUE));
now all errors are gone but the image uploading will not work any ideas why this is now failing ?????
Thanks Alan
hi I think that tutorial using PHP 5.3 so the strstr function has the third parameter

Resources