File manager - Edit - /home/linknsbh/cecil-hotel.net/vendor/botble/platform/acl/src/Concerns/HasPreferences.php
Back
<?php namespace Botble\ACL\Concerns; use Botble\ACL\Models\UserMeta; use Illuminate\Database\Eloquent\Relations\HasMany; trait HasPreferences { public function meta(): HasMany { return $this->hasMany(UserMeta::class, 'user_id'); } public function setMeta(string $key, mixed $value): bool { $meta = $this->meta()->firstOrCreate([ 'key' => $key, ]); return $meta->update(['value' => $value]); } public function getMeta(string $key, mixed $default = null): mixed { $meta = $this->meta() ->where('key', $key) ->select('value') ->first(); if (! empty($meta)) { return $meta->value; } return $default; } }
| ver. 1.4 |
Github
|
.
| PHP 8.2.31 | Generation time: 2.25 |
proxy
|
phpinfo
|
Settings