Пример #1
0
 /**
  * @param TransientPropertyInterface $transient
  * @param $property
  * @param $value
  * @param $expire
  * @return \Bmartel\Transient\Transient
  */
 public function generate(TransientPropertyInterface $transient, $property, $value, $expire)
 {
     $signature = $transient->signature($property);
     return $this->transient->store($transient, $signature, $property, $value, $expire);
 }
Пример #2
0
 /**
  * Delete all properties listed in the array and attached to the defined model.
  *
  * @param TransientPropertyInterface $transient
  * @param array $transientProperties
  * @param bool $expiredOnly
  * @return int
  */
 public function deleteByModelProperty(TransientPropertyInterface $transient, array $transientProperties, $expiredOnly = true)
 {
     if ($transientProperties) {
         $query = $transient->transientProperties()->whereIn('property', $transientProperties);
         if ($expiredOnly) {
             $query->expired();
         }
         return $query->delete();
     }
     // If no arguments are provided, dont delete anything.
     return 0;
 }