mirror of
https://github.com/flarum/framework.git
synced 2025-02-16 06:12:44 +08:00
31 lines
592 B
PHP
31 lines
592 B
PHP
![]() |
<?php namespace Flarum\Core\Models;
|
||
|
|
||
|
class Guest extends User
|
||
|
{
|
||
|
public $id = 0;
|
||
|
|
||
|
/**
|
||
|
* Return an array containing the 'guests' group model.
|
||
|
*
|
||
|
* @return \Flarum\Core\Models\Group
|
||
|
*/
|
||
|
public function getGroupsAttribute()
|
||
|
{
|
||
|
if (! isset($this->attributes['groups'])) {
|
||
|
$this->attributes['groups'] = $this->relations['groups'] = Group::where('id', Group::GUEST_ID)->get();
|
||
|
}
|
||
|
|
||
|
return $this->attributes['groups'];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Check whether or not the user is a guest.
|
||
|
*
|
||
|
* @return boolean
|
||
|
*/
|
||
|
public function guest()
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
}
|