laravel

Laravel queue push listener - queue monitoring

假如想象 提交于 2021-02-19 04:16:13
问题 I am using the JobProcessing , JobProcessed and JobFailed to populate a queue logs table. I would like to also listen for an event as jobs are pushed to the queue. Does this exist? I see from running: \Redis::lrange('queues:mws', 0, -1) That a pushedAt parameter exists, but I am unsure how to get this in an event prior to the job actually being processed. This is fundamentally in order to check that my queues are all: a) actually running (the workers have not stopped). b) the job processing

Laravel queue push listener - queue monitoring

你说的曾经没有我的故事 提交于 2021-02-19 04:16:08
问题 I am using the JobProcessing , JobProcessed and JobFailed to populate a queue logs table. I would like to also listen for an event as jobs are pushed to the queue. Does this exist? I see from running: \Redis::lrange('queues:mws', 0, -1) That a pushedAt parameter exists, but I am unsure how to get this in an event prior to the job actually being processed. This is fundamentally in order to check that my queues are all: a) actually running (the workers have not stopped). b) the job processing

Laravel migration cannot find driver when using sqlsrv database in windows

十年热恋 提交于 2021-02-19 03:55:09
问题 I am using sqlsrv database connection in my project as I need to connect to Microsoft SQL Database. I have successfully installed the sqlsrv driver because I can connect to the Database to retrieve data. But when I try to do the Laravel Migration, it shows an error: Illuminate\Database\QueryException : could not find driver (SQL: select * from sysobjects where type = 'U' and name = migrations) Below is my .env DB_CONNECTION=sqlsrv DB_HOST=**********.database.windows.net DB_PORT=1433 DB

Laravel fatal error: Fatal error: Interface 'Illuminate\Auth\Illuminate\Contracts\Auth\Factory' not found

你。 提交于 2021-02-19 03:53:10
问题 I'm trying to start using laravel php framework. I'm trying to just call the index file and I get this error message. C:\xampp\php\php.exe C:\xampp\htdocs\tutorials\lara\application\public\index.php Fatal error: Interface 'Illuminate\Auth\Illuminate\Contracts\Auth\Factory' not found in C:\xampp\htdocs\tutorials\lara\application\bootstrap\cache\compiled.php on line 357 Process finished with exit code 255 Can anyone shine some light on what this means? 回答1: Your Illuminate\Auth\Illuminate

Laravel Vue SPA vs MPA/SSR

和自甴很熟 提交于 2021-02-19 03:51:21
问题 Many laravel/vue tutorials use ajax calls to get the data. It seems that the SPA is completely isolated from Laravel. I.e. Laravel is just a data API and the vue app could also simply be hosted on a third party external server (e.g. AWS S3). Is this the recommended way, or should I rather use Laravel for Routing and have separate views that implement individual components and already included data instead of using a SPA? 回答1: For an SPA, I would recommend just going with the standard setup,

How to run queue worker on shared hosting

早过忘川 提交于 2021-02-19 02:38:05
问题 My Laravel application has a queued event listener and I have also set up the cronjob to run schedule:run every minute. But I don't know how I can run the php artisan queue:worker command persistently in the background. I found this thread where it was the most voted approach: $schedule->command('queue:work --daemon')->everyMinute()->withoutOverlapping(); However, on a different thread some people complained that the above-mentioned command creates multiple queue worker. How can I safely run

Laravel 5 + Eloquent toJson/toArray causes Strange Segmentation Faults

﹥>﹥吖頭↗ 提交于 2021-02-19 02:28:51
问题 I hate to be answering my own question, so maybe you can help me find what fixed this. I have some eloquent models which belongTo each-other, and I set them up via association like this. It's all normal stuff. This process unfortunately causes $device to work erratically. Below you can see individual values are accessible but any form of jsonification destroys the server without error. $device = $truck->device; if(is_null($device) || empty($device)) { $device = new Devices; } $device->truck()

Laravel PHPUnit mock Request

泄露秘密 提交于 2021-02-19 02:04:12
问题 I'm doing a PHPUnit on my controller and I can't seem to mock the Request right. Here's the Controller: use Illuminate\Http\Request; public function insert(Request $request) { // ... some codes here if ($request->has('username')) { $userEmail = $request->get('username'); } else if ($request->has('email')) { $userEmail = $request->get('email'); } // ... some codes here } Then on the unit test, public function testIndex() { // ... some codes here $requestParams = [ 'username' => 'test', 'email'

Laravel flatten and pluck from multidimensional collection

我的未来我决定 提交于 2021-02-19 02:00:14
问题 I have to retrieve just an array of id from the given collection, something like [10,54,61,21,etc] . I've tried flatten , pluck , but nothing seems to work apart from a foreach which is something I would like to remove at this step. // Model class Children extends Eloquent { public function directChildrens(){ return $this->hasMany('App\Children','father_id','id')->select('id','father_id'); } public function childrens(){ return $this->directChildrens()->with('childrens'); } } // Controller

Laravel: Is it possible to log stack trace when exception caught, and continue the execution?

老子叫甜甜 提交于 2021-02-18 22:42:50
问题 Laravel has readable log and stacktrace when exception caught, for example: production.ERROR: Command "test" is not defined. Did you mean this? make:test {"exception":"[object] (Symfony\\Component\\Console\\Exception\\CommandNotFoundException(code: 0): Command \"test\" is not defined. Did you mean this? make:test at {root}/vendor/symfony/console/Application.php:618) [stacktrace] #0 {root}/vendor/symfony/console/Application.php(229): Symfony\\Component\\Console\\Application->find('test') #1