for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MAbadir\ElasticLaravel\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use MAbadir\ElasticLaravel\ElasticClient;
class IndexModel implements ShouldQueue
{
use InteractsWithQueue, Queueable, SerializesModels;
public $model, $params, $operation;
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.
/**
* Create a new job instance.
*
* @return void
@return
Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.
Please refer to the PHP core documentation on constructors.
*/
public function __construct($model, $params, $operation)
$this->model = $model;
$this->params = $params;
$this->operation = $operation;
}
* Execute the job.
public function handle()
$client = new ElasticClient();
$client->{$this->operation}($this->params);
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.