| Server IP : 77.68.64.20 / Your IP : 216.73.217.31 Web Server : Apache System : Linux hp3-wp-1011317.hostingp3.local 3.10.0-1160.144.1.el7.tuxcare.els8.x86_64 #1 SMP Sun Jul 5 17:25:39 UTC 2026 x86_64 User : csh2392878 ( 2033753) PHP Version : 8.3.30 Disable Function : shell_exec,exec,system,popen,set_time_limit MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/domains/vol1/746/2880746/user/htdocs/wp-content/plugins/booknetic/app/Models/ |
Upload File : |
<?php
namespace BookneticApp\Models;
use BookneticApp\Providers\Core\Permission;
use BookneticApp\Providers\DB\Model;
use BookneticApp\Providers\DB\MultiTenant;
use BookneticApp\Providers\Translation\Translator;
/**
* @property-read int $id
* @property-read string $name
* @property-read string $image
* @property-read string $address
* @property-read string $phone_number
* @property-read string $notes
* @property-read string $latitude
* @property-read string $longitude
* @property-read int $is_active
* @property-read string $address_components
* @property-read int $category_id
* @property-read int $tenant_id
*/
class Location extends Model
{
use MultiTenant;
use Translator;
protected static bool $timeStamps = true;
protected static bool $enableOwnershipFields = true;
protected static $translations = [ 'name', 'address', 'notes' ];
public static function my()
{
if (Permission::isAdministrator()) {
return new self();
}
// Permission olan Stafflarin ID-lerini chekib, hemen stafflarin assign olundugu Locationlari gotururuk.
$allowedLocations = [];
$myStaffList = Staff::query()->fetchAll();
foreach ($myStaffList as $staffLocations) {
if (! empty($staffLocations->locations)) {
$allowedLocations = array_merge($allowedLocations, explode(',', $staffLocations->locations));
}
}
return Location::query()
->where('id', $allowedLocations ?: 0)
->orWhere('created_by', get_current_user_id());
}
}