mirror of
https://github.com/flarum/framework.git
synced 2025-02-14 00:12:46 +08:00
31 lines
643 B
PHP
Executable File
31 lines
643 B
PHP
Executable File
<?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;
|
|
}
|
|
}
|