This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
memberdb/app/MultiTenantObserver.php
2017-08-03 16:35:36 +10:00

22 lines
371 B
PHP

<?php
namespace App;
use Config;
class MultiTenantObserver
{
// Capture our saves and include a site ID
public function saving($model)
{
$so = Config::get('SITE_SETUP');
if (! $so instanceOf Setup OR ! $so->exists)
return;
if (is_null($model->site_id) OR $model->site_id != $so->id)
$model->site_id = $so->id;
else
dd(__METHOD__,$model,$so);
}
}