Page MenuHomePhorge

PlanObserver.php
No OneTemporary

Authored By
Unknown
Size
635 B
Referenced Files
None
Subscribers
None

PlanObserver.php

<?php
namespace App\Observers;
use App\Plan;
/**
* This is an observer for the Plan model definition.
*/
class PlanObserver
{
/**
* Handle the "creating" event on an Plan.
*
* Ensures that the entry uses a custom ID (uuid).
*
* @param Plan $plan The Plan being created.
*
* @return void
*/
public function creating(Plan $plan)
{
while (true) {
$allegedly_unique = \App\Utils::uuidStr();
if (!Plan::find($allegedly_unique)) {
$plan->{$plan->getKeyName()} = $allegedly_unique;
break;
}
}
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Apr 4, 8:24 AM (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
6f/42/6039af67029be82ef64e40c5794e
Default Alt Text
PlanObserver.php (635 B)

Event Timeline