mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-12 22:49:41 -06:00
- using `Model::where('download', '=', 1)` over`Model::where('download', 1)`
- decided is easier for new devs to understand.
- thanks to @werrpy for helping with the regex to mass update.
64 lines
1.3 KiB
PHP
Executable File
64 lines
1.3 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D
|
|
*
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
* @author HDVinnie
|
|
*/
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Group extends Model
|
|
{
|
|
/**
|
|
* The Attributes That Aren't Mass Assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $guarded = ['id'];
|
|
|
|
/**
|
|
* Indicates If The Model Should Be Timestamped.
|
|
*
|
|
* @var bool
|
|
*/
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* Has Many Users.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function users()
|
|
{
|
|
return $this->hasMany(User::class);
|
|
}
|
|
|
|
/**
|
|
* Has Many Permissions.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function permissions()
|
|
{
|
|
return $this->hasMany(Permission::class);
|
|
}
|
|
|
|
/**
|
|
* Returns The Requested Row From The Permissions Table.
|
|
*/
|
|
public function getPermissionsByForum($forum)
|
|
{
|
|
return Permission::where('forum_id', '=', $forum->id)
|
|
->where('group_id', '=', $this->id)
|
|
->first();
|
|
}
|
|
}
|