Files
sprinkle-organisations/src/Database/Models/Interfaces/OrganisationInterface.php

65 lines
1.8 KiB
PHP

<?php
/*
* AVSDev UF Organisations (https://avsdev.uk)
*
* @link https://git.avsdev.uk/avsdev/sprinkle-organisations
* @license https://git.avsdev.uk/avsdev/sprinkle-organisations/blob/master/LICENSE.md (LGPL-3.0 License)
*/
namespace UserFrosting\Sprinkle\Organisations\Database\Models\Interfaces;
use Illuminate\Database\Eloquent\Builder;
/**
* Organisation Interface.
*
* Represents a Organisation object as stored in the database.
*/
interface OrganisationInterface
{
/**
* Delete this organisation from the database, along with any linked objects.
*
* @param bool $hardDelete Set to true to completely remove the organisation and all associated objects.
*
* @return bool true if the deletion was successful, false otherwise.
*/
public function delete($hardDelete = false);
/**
* Return this organisations's members.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function members();
/**
* Return this organisations's admins.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function administrators();
/**
* Performs tasks to be done before an organisation is merged
*
* By default, adds a new sign-in activity and updates any legacy hash.
*
* @param OrganisationInterface $target The organisation that will be merged towards.
* @param mixed[] $params Optional array of parameters used for this event handler.
*
* @todo Transition to Laravel Event dispatcher to handle this
*/
public function beforeMerge($target, $params = []);
/**
* Joins the organisation's member count, so we can do things like sort, search, paginate, etc.
*
* @param Builder $query
*
* @return Builder
*/
public function scopeJoinMemberCounts($query);
}