芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/vendor/brian2694/laravel-toastr/src/Toastr.php
session = $session; $this->config = $config; } public function message() { $messages = $this->session->get('toastr::messages'); if (! $messages) $messages = []; $script = ''; return $script; } /** * * Add a flash message to session. * * @param string $type Must be one of info, success, warning, error. * @param string $message The flash message content. * @param string $title The flash message title. * @param array $options The custom options. * * @return void */ public function add($type, $message, $title = null, $options = []) { $types = ['error', 'info', 'success', 'warning']; if (! in_array($type, $types)) { throw new Exception("The $type remind message is not valid."); } $this->messages[] = [ 'type' => $type, 'title' => $title, 'message' => $message, 'options' => $options, ]; $this->session->flash('toastr::messages', $this->messages); } /** * Add an info flash message to session. * * @param string $message The flash message content. * @param string $title The flash message title. * @param array $options The custom options. * * @return void */ public function info($message, $title = null, $options = []) { if($message instanceof MessageBag) { $messageString = ""; foreach ($message->getMessages() as $messageArray) { foreach ($messageArray as $currentMessage) $messageString .= $currentMessage."
"; } $this->add('info', rtrim($messageString, "
"), $title, $options); } else $this->add('info', $message, $title, $options); } /** * Add a success flash message to session. * * @param string $message The flash message content. * @param string $title The flash message title. * @param array $options The custom options. * * @return void */ public function success($message, $title = null, $options = []) { if($message instanceof MessageBag) { $messageString = ""; foreach ($message->getMessages() as $messageArray) { foreach ($messageArray as $currentMessage) $messageString .= $currentMessage."
"; } $this->add('success', rtrim($messageString, "
"), $title, $options); } else $this->add('success', $message, $title, $options); } /** * Add an warning flash message to session. * * @param string $message The flash message content. * @param string $title The flash message title. * @param array $options The custom options. * * @return void */ public function warning($message, $title = null, $options = []) { if($message instanceof MessageBag) { $messageString = ""; foreach ($message->getMessages() as $messageArray) { foreach ($messageArray as $currentMessage) $messageString .= $currentMessage."
"; } $this->add('warning', rtrim($messageString, "
"), $title, $options); } else $this->add('warning', $message, $title, $options); } /** * Add an error flash message to session. * * @param string $message The flash message content. * @param string $title The flash message title. * @param array $options The custom options. * * @return void */ public function error($message, $title = null, $options = []) { if($message instanceof MessageBag) { $messageString = ""; foreach ($message->getMessages() as $messageArray) { foreach ($messageArray as $currentMessage) $messageString .= $currentMessage."
"; } $this->add('error', rtrim($messageString, "
"), $title, $options); } else $this->add('error', $message, $title, $options); } /** * Clear messages * * @return void */ public function clear() { $this->messages = []; } }