initial commit
This commit is contained in:
30
app/Models/Setting.php
Normal file
30
app/Models/Setting.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends BaseModel
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'key',
|
||||
'value',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the user that owns the setting.
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public static function getUserSettings($userId)
|
||||
{
|
||||
return self::where('user_id', $userId)->pluck('value', 'key')->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user