for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Gamer\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Gamer\Models\Customer;
use Log;
class RoutineTrackingUserDeviseJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $customer, $trackingType, $trackingData, $timestamp, $íp;
/**
* 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(Customer $customer, $trackingType, $trackingData, $timestamp = false, $ip = false)
$this->customer = $customer;
$this->trackingType = $trackingType;
$this->trackingData = $trackingData;
if (!$timestamp) { $timestamp = time();
}
$this->timestamp = $timestamp;
$this->ip = $ip;
ip
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
* Execute the job.
public function handle()
$this->customer->tracking->create(
TrackingType::createToTracking(
$this->trackingType,
$this->trackingData,
$this->timestamp,
$this->ip
)
);
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.