F1NaL's avatar

add Queue from controller

I try to add new job into queue from controller:

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Queue\Queue;
class SaveController extends Controller
{
public function save(Request $request, Queue $queue)
{
    $q = $queue->pushOn('getSent', new \App\Jobs\SomeJobs('hello'));
    return $q;
}
}

but i catch error:

lumen.ERROR: exception 'Illuminate\Container\BindingResolutionException' with message 'Target [Illuminate\Queue\Queue] is not instantiable.' in /var/www/lumenlocal/lumen/vendor/illuminate/container/Container.php:785

What's wrong?

0 likes
2 replies
rikh's avatar
rikh
Best Answer
Level 3

Trying using the contract instead - replace your use statement with this...

use Illuminate\Contracts\Queue\Queue;

Sorry - had not noticed that this was Lumen specific, so I've no idea if this suggestion will help. I've left it here, just in case.

1 like

Please or to participate in this conversation.