2015-02-24 18:03:18 +08:00
|
|
|
<?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
|
|
|
|
*/
|
2015-05-19 07:03:12 +08:00
|
|
|
public function getGroupsAttribute()
|
|
|
|
{
|
|
|
|
if (! isset($this->attributes['groups'])) {
|
|
|
|
$this->attributes['groups'] = $this->relations['groups'] = Group::where('id', Group::GUEST_ID)->get();
|
|
|
|
}
|
2015-02-24 18:03:18 +08:00
|
|
|
|
2015-05-19 07:03:12 +08:00
|
|
|
return $this->attributes['groups'];
|
|
|
|
}
|
2015-02-24 18:03:18 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether or not the user is a guest.
|
|
|
|
*
|
|
|
|
* @return boolean
|
|
|
|
*/
|
2015-05-19 07:03:12 +08:00
|
|
|
public function guest()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2015-02-24 18:03:18 +08:00
|
|
|
}
|