/** * Fired just before saving the entry. * * @param EntryInterface|PostInterface $entry */ public function creating(EntryInterface $entry) { if (!$entry->getStrId()) { $entry->setAttribute('str_id', str_random()); } parent::creating($entry); }
/** * Fired before saving the file. * * @param EntryInterface|FileInterface $entry * @return bool */ public function saving(EntryInterface $entry) { /** * Make sure the resource exists. */ if (!($resource = $entry->resource())) { return false; } return parent::saving($entry); }
/** * Fired after deleting the file. * * @param EntryInterface|FileInterface $entry */ public function deleted(EntryInterface $entry) { /** * Make sure the resource exists * and is deleted successfully. */ if ($entry->isForceDeleting() && ($resource = $entry->resource())) { $resource->delete(); } parent::deleted($entry); }
/** * Fire just before saving a folder. * * @param EntryInterface|FolderInterface $entry * @return bool */ public function saving(EntryInterface $entry) { $disk = $entry->getDisk(); /** * If the folder already exists then * skip it because even if it does not * exist on the server it'll be written * automatically soon. */ if ($this->folders->findByName($entry->getName(), $disk, $entry->getParent())) { return false; } return parent::saving($entry); }
/** * Fired after a page type is restored. * * @param EntryInterface|TypeInterface $entry */ public function restored(EntryInterface $entry) { $this->commands->dispatch(new RestorePages($entry)); parent::restored($entry); }
/** * Fired after a page type is deleted. * * @param EntryInterface|TypeInterface $entry */ public function deleted(EntryInterface $entry) { $this->commands->dispatch(new DeletePages($entry)); $this->commands->dispatch(new DeleteStream($entry)); parent::deleted($entry); }
/** * Fired after an entry is deleted. * * @param EntryInterface $entry */ public function deleted(EntryInterface $entry) { $this->dispatch(new UnsetChildLinks($entry)); parent::deleted($entry); }
/** * Fired after a page is deleted. * * @param EntryInterface|PageInterface $entry */ public function deleted(EntryInterface $entry) { $this->dispatch(new DeleteChildren($entry)); $this->dispatch(new DeleteEntry($entry)); parent::deleted($entry); }
/** * Fired after an entry is deleted. * * @param EntryInterface $entry */ public function deleted(EntryInterface $entry) { $this->dispatch(new DeleteMenuLinks($entry)); parent::deleted($entry); }
/** * Fire just before deleting an entry. * * @param EntryInterface|DiskInterface $entry * @return bool */ public function deleting(EntryInterface $entry) { $this->dispatch(new DeleteFolders($entry)); return parent::deleting($entry); }
/** * Fired after a redirect is deleted. * * @param EntryInterface|RedirectInterface $entry */ public function deleted(EntryInterface $entry) { $this->commands->dispatch(new GenerateRoutesFile()); parent::deleted($entry); }
/** * Fired after a user is deleted. * * @param EntryInterface $entry */ public function deleted(EntryInterface $entry) { $this->events->fire(new UserWasDeleted($entry)); parent::deleted($entry); }