Changeset View
Changeset View
Standalone View
Standalone View
src/app/UserSetting.php
<?php | <?php | ||||
namespace App; | namespace App; | ||||
use App\Traits\BelongsToUserTrait; | |||||
use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||
/** | /** | ||||
* A collection of settings for a User. | * A collection of settings for a User. | ||||
* | * | ||||
* @property int $id | * @property int $id | ||||
* @property int $user_id | * @property int $user_id | ||||
* @property string $key | * @property string $key | ||||
* @property string $value | * @property string $value | ||||
*/ | */ | ||||
class UserSetting extends Model | class UserSetting extends Model | ||||
{ | { | ||||
use BelongsToUserTrait; | |||||
/** @var array<int, string> The attributes that are mass assignable */ | /** @var array<int, string> The attributes that are mass assignable */ | ||||
protected $fillable = ['user_id', 'key', 'value']; | protected $fillable = ['user_id', 'key', 'value']; | ||||
/** | |||||
* The user to which this setting belongs. | |||||
* | |||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | |||||
*/ | |||||
public function user() | |||||
{ | |||||
return $this->belongsTo(User::class, 'user_id', 'id'); | |||||
} | |||||
} | } |