1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
<?php
namespace Scene7\Commands;
trait Id
{
/**
* Used to bust caches
*
* @param int|null $id null generates a random id
* @return $this
*/
public function setId($id = null)
{
$id = $id ?: rand(0, PHP_INT_MAX);
$this->addCommand(['id' => (int) $id]);
return $this;
}
}