ponepaste/includes/Models/User.php

25 lines
539 B
PHP
Raw Normal View History

<?php
2021-08-29 01:26:29 -04:00
namespace PonePaste\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model {
protected $table = 'users';
2021-11-01 16:56:17 -04:00
protected $fillable = [
'username', 'password', 'recovery_code_hash', 'date'
];
public function session() {
return $this->hasOne(UserSession::class);
}
public function favourites() {
2022-03-12 13:56:32 -05:00
return $this->belongsToMany(Paste::class, 'user_favourites')->withPivot('f_time');
}
2021-08-29 01:26:29 -04:00
public function pastes() {
return $this->hasMany(Paste::class);
2021-08-29 01:26:29 -04:00
}
}