Lumen equivalent for laravel pluck method - php

Our project recently got converted from laravel to lumen and I am in charge of fixing the things that broke. I have little experience in Lumen, so forgive the lack of insight.
A simple pluck method from laravel
$mobile_phones= JobApplication::where('job_circular_id',$id)->pluck('mobile','id')->toArray();
is no longer working in Lumen. It keeps saying error: Call to a member function toArray() on string.
Googling Lumen equivalent for pluck method returns nothing relevant. And as far as I can see in the docs (https://lumen.laravel.com/docs/5.2/upgrade), lumen SHOULD have pluck method. What am I doing wrong?

Related

setlocale and getlocale in lumen 5.6

I was trying to localize my application and in the middleware, I am getting the locale from the request object. Now I need to access this outside the controller while running a job.
As from the documentation, I can see that the app() can hold this data. But app()->setLocale() and app()->getLocale() is not working for me in lumen 5.6.
Ant help will be much appreciable.
Finally, I found the answer. There is a translator object in the framework and you have to use the following code to set a locale
app('translator')->setLocale($locale);
and to get a locale in anywhere in the application using
app('translator')->getLocale();

Laravel - Declaration of Illuminate\Support\Carbon::__set_state(array $array) should be compatible with Carbon\Carbon::__set_state($state)

Got this weird error while trying to use laravel for the first time, look it up but couldn't find anything, could someone please help?
Laravel has a class that extends the official Carbon class. Carbon had changed their __set_state method signature, which broke Laravel's Carbon implementation. After Laravel fixed it and made a release, Carbon reverted their change to __set_state, which re-broke Laravel's implementation.
Basically, this is a temporary problem, and running composer update later should fix your issue.
Related GitHub issues:
https://github.com/laravel/framework/issues/23458
https://github.com/laravel/framework/issues/23465
The problem is already fixed: https://github.com/laravel/framework/pull/23464

Is Paginator::make still available in Laravel 5.5?

I am trying to use Paginator::make on my array data with Laravel 5.5. I found an answer on another question, but the function is not working.
I cannot find Paginator::make in the documentation either.

why isn't "between" available in a laravel schedule task?

I've got the manual in front of me, I've searched Google, and nothing. Why is this:
//update combined results cache
$schedule->call('App\Http\Controllers\CombinedYieldUpdater#index')
->everyFiveMinutes()
->between('02:00', '04:00');
causing this?
[2017-01-09 11:42:02] local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Illuminate\Console\Scheduling\CallbackEvent::between()
It looks like you don't use Laravel 5.3. Similar problem here where user wanted to use method available in Laravel 5.2. and he was using 5.1.
Are you sure you using 5.3? If not update your framework to 5.3 and it should work.

Setter error with Laravel 4.2, HHVM, and Carbon

I'm trying to run an application on an HHVM 3.2 server and I'm getting a 'InvalidArgumentException Unknown setter '_date_time' error. It seems to have something to do with the magic functions. It also looks like it's coming from Carbon and due to the sessions being created.
I'm using Redis database for session management since I'm using HAPROXY for load balancing. Anyone else come across this issue and is there a fix?
Oddly I have another Laravel 4.2 (earlier version) application running on the same setup and it runs fine.
Here is the stack error:
InvalidArgumentException …/­vendor/­nesbot/­carbon/­src/­Carbon/­Carbon.php542
Carbon\Carbon __set <#unknown>0
DateTime __sleep <#unknown>0
serialize …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Store.php222
Illuminate\Session\Store save …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Middleware.php126
Illuminate\Session\Middleware closeSession …/­vendor/­laravel/­framework/­src/­Illuminate/­Session/­Middleware.php79

Categories