Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117881239
UuidIntKeyTrait.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
UuidIntKeyTrait.php
View Options
<?php
namespace
App\Traits
;
trait
UuidIntKeyTrait
{
/**
* Boot function from Laravel.
*/
protected
static
function
bootUuidIntKeyTrait
()
{
static
::
creating
(
function
(
$model
)
{
if
(
empty
(
$model
->{
$model
->
getKeyName
()}))
{
$allegedly_unique
=
\App\Utils
::
uuidInt
();
// Verify if unique
if
(
in_array
(
'Illuminate
\D
atabase
\E
loquent
\S
oftDeletes'
,
class_uses
(
$model
)))
{
while
(
$model
->
withTrashed
()->
find
(
$allegedly_unique
))
{
$allegedly_unique
=
\App\Utils
::
uuidInt
();
}
}
else
{
while
(
$model
->
find
(
$allegedly_unique
))
{
$allegedly_unique
=
\App\Utils
::
uuidInt
();
}
}
$model
->{
$model
->
getKeyName
()}
=
$allegedly_unique
;
}
});
}
/**
* Get if the key is incrementing.
*
* @return bool
*/
public
function
getIncrementing
()
{
return
false
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Apr 5, 11:47 PM (1 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
46/5f/621fbc17b4be78a4df17d0e8b320
Default Alt Text
UuidIntKeyTrait.php (1 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline