/** * @return bool */ public function onUpdate() { if (!$this->exists()) { return $this->onCreate(); } elseif ($this->name() && $this->website->isDirty('identifier')) { return $this->onRename($this->website->getOriginal('identifier'), $this->website->name()); } }
/** * Writes the contents to disk on Update. * * @uses onCreate * * @return int */ public function onUpdate() { if ($this->website->isDirty('identifier')) { $new = $this->website->identifier; $this->website->identifier = $this->website->getOriginal('identifier'); $this->onDelete(); $this->website->identifier = $new; } return $this->onCreate(); }
public function __construct(Website $website) { $this->website = $website; if ($this->website->isDirty('identifier')) { $this->old_path = sprintf('%s/%d-%s/', Config::get('multi-tenant.tenant-directory') ? Config::get('multi-tenant.tenant-directory') : storage_path('multi-tenant'), $this->website->id, $this->website->getOriginal('identifier')); if (!File::isDirectory($this->old_path)) { $this->old_path = null; } } $this->base_path = sprintf('%s/%d-%s/', Config::get('multi-tenant.tenant-directory') ? Config::get('multi-tenant.tenant-directory') : storage_path('multi-tenant'), $this->website->id, $this->website->identifier); }