Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
18
vendor/laracasts/flash/src/Laracasts/Flash/Flash.php
vendored
Normal file
18
vendor/laracasts/flash/src/Laracasts/Flash/Flash.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Flash extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the binding in the IoC container
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'flash';
|
||||
}
|
||||
}
|
||||
167
vendor/laracasts/flash/src/Laracasts/Flash/FlashNotifier.php
vendored
Normal file
167
vendor/laracasts/flash/src/Laracasts/Flash/FlashNotifier.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class FlashNotifier
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The session store.
|
||||
*
|
||||
* @var SessionStore
|
||||
*/
|
||||
protected $session;
|
||||
|
||||
/**
|
||||
* The messages collection.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
public $messages;
|
||||
|
||||
/**
|
||||
* Create a new FlashNotifier instance.
|
||||
*
|
||||
* @param SessionStore $session
|
||||
*/
|
||||
function __construct(SessionStore $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
$this->messages = collect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an information message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function info($message = null)
|
||||
{
|
||||
return $this->message($message, 'info');
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash a success message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function success($message = null)
|
||||
{
|
||||
return $this->message($message, 'success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an error message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function error($message = null)
|
||||
{
|
||||
return $this->message($message, 'danger');
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash a warning message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @return $this
|
||||
*/
|
||||
public function warning($message = null)
|
||||
{
|
||||
return $this->message($message, 'warning');
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash a general message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @param string|null $level
|
||||
* @return $this
|
||||
*/
|
||||
public function message($message = null, $level = null)
|
||||
{
|
||||
// If no message was provided, we should update
|
||||
// the most recently added message.
|
||||
if (! $message) {
|
||||
return $this->updateLastMessage(compact('level'));
|
||||
}
|
||||
|
||||
if (! $message instanceof Message) {
|
||||
$message = new Message(compact('message', 'level'));
|
||||
}
|
||||
|
||||
$this->messages->push($message);
|
||||
|
||||
return $this->flash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the most recently added message.
|
||||
*
|
||||
* @param array $overrides
|
||||
* @return $this
|
||||
*/
|
||||
protected function updateLastMessage($overrides = [])
|
||||
{
|
||||
$this->messages->last()->update($overrides);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash an overlay modal.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @param string $title
|
||||
* @return $this
|
||||
*/
|
||||
public function overlay($message = null, $title = 'Notice')
|
||||
{
|
||||
if (! $message) {
|
||||
return $this->updateLastMessage(['title' => $title, 'overlay' => true]);
|
||||
}
|
||||
|
||||
return $this->message(
|
||||
new OverlayMessage(compact('title', 'message'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an "important" flash to the session.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function important()
|
||||
{
|
||||
return $this->updateLastMessage(['important' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all registered messages.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->messages = collect();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash all messages to the session.
|
||||
*/
|
||||
protected function flash()
|
||||
{
|
||||
$this->session->flash('flash_notification', $this->messages);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
47
vendor/laracasts/flash/src/Laracasts/Flash/FlashServiceProvider.php
vendored
Normal file
47
vendor/laracasts/flash/src/Laracasts/Flash/FlashServiceProvider.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class FlashServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'Laracasts\Flash\SessionStore',
|
||||
'Laracasts\Flash\LaravelSessionStore'
|
||||
);
|
||||
|
||||
$this->app->singleton('flash', function () {
|
||||
return $this->app->make('Laracasts\Flash\FlashNotifier');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__ . '/../../views', 'flash');
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../../views' => base_path('resources/views/vendor/flash')
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
34
vendor/laracasts/flash/src/Laracasts/Flash/LaravelSessionStore.php
vendored
Normal file
34
vendor/laracasts/flash/src/Laracasts/Flash/LaravelSessionStore.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
use Illuminate\Session\Store;
|
||||
|
||||
class LaravelSessionStore implements SessionStore
|
||||
{
|
||||
/**
|
||||
* @var Store
|
||||
*/
|
||||
private $session;
|
||||
|
||||
/**
|
||||
* Create a new session store instance.
|
||||
*
|
||||
* @param Store $session
|
||||
*/
|
||||
function __construct(Store $session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flash a message to the session.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
*/
|
||||
public function flash($name, $data)
|
||||
{
|
||||
$this->session->flash($name, $data);
|
||||
}
|
||||
}
|
||||
117
vendor/laracasts/flash/src/Laracasts/Flash/Message.php
vendored
Normal file
117
vendor/laracasts/flash/src/Laracasts/Flash/Message.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
class Message implements \ArrayAccess
|
||||
{
|
||||
/**
|
||||
* The title of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title;
|
||||
|
||||
/**
|
||||
* The body of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* The message level.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $level = 'info';
|
||||
|
||||
/**
|
||||
* Whether the message should auto-hide.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $important = false;
|
||||
|
||||
/**
|
||||
* Whether the message is an overlay.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $overlay = false;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param array $attributes
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
$this->update($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the attributes.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @return $this
|
||||
*/
|
||||
public function update($attributes = [])
|
||||
{
|
||||
$attributes = array_filter($attributes);
|
||||
|
||||
foreach ($attributes as $key => $attribute) {
|
||||
$this->$key = $attribute;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether the given offset exists.
|
||||
*
|
||||
* @param mixed $offset
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->$offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the offset.
|
||||
*
|
||||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->$offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign the offset.
|
||||
*
|
||||
* @param mixed $offset
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->$offset = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the offset.
|
||||
*
|
||||
* @param mixed $offset
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
20
vendor/laracasts/flash/src/Laracasts/Flash/OverlayMessage.php
vendored
Normal file
20
vendor/laracasts/flash/src/Laracasts/Flash/OverlayMessage.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
class OverlayMessage extends Message
|
||||
{
|
||||
/**
|
||||
* The title of the message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $title = 'Notice';
|
||||
|
||||
/**
|
||||
* Whether the message is an overlay.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $overlay = true;
|
||||
}
|
||||
14
vendor/laracasts/flash/src/Laracasts/Flash/SessionStore.php
vendored
Normal file
14
vendor/laracasts/flash/src/Laracasts/Flash/SessionStore.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Laracasts\Flash;
|
||||
|
||||
interface SessionStore
|
||||
{
|
||||
/**
|
||||
* Flash a message to the session.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $data
|
||||
*/
|
||||
public function flash($name, $data);
|
||||
}
|
||||
23
vendor/laracasts/flash/src/Laracasts/Flash/functions.php
vendored
Normal file
23
vendor/laracasts/flash/src/Laracasts/Flash/functions.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
if (! function_exists('flash')) {
|
||||
|
||||
/**
|
||||
* Arrange for a flash message.
|
||||
*
|
||||
* @param string|null $message
|
||||
* @param string $level
|
||||
* @return \Laracasts\Flash\FlashNotifier
|
||||
*/
|
||||
function flash($message = null, $level = 'info')
|
||||
{
|
||||
$notifier = app('flash');
|
||||
|
||||
if (! is_null($message)) {
|
||||
return $notifier->message($message, $level);
|
||||
}
|
||||
|
||||
return $notifier;
|
||||
}
|
||||
|
||||
}
|
||||
27
vendor/laracasts/flash/src/views/message.blade.php
vendored
Normal file
27
vendor/laracasts/flash/src/views/message.blade.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
@foreach (session('flash_notification', collect())->toArray() as $message)
|
||||
@if ($message['overlay'])
|
||||
@include('flash::modal', [
|
||||
'modalClass' => 'flash-modal',
|
||||
'title' => $message['title'],
|
||||
'body' => $message['message']
|
||||
])
|
||||
@else
|
||||
<div class="alert
|
||||
alert-{{ $message['level'] }}
|
||||
{{ $message['important'] ? 'alert-important' : '' }}"
|
||||
role="alert"
|
||||
>
|
||||
@if ($message['important'])
|
||||
<button type="button"
|
||||
class="close"
|
||||
data-dismiss="alert"
|
||||
aria-hidden="true"
|
||||
>×</button>
|
||||
@endif
|
||||
|
||||
{!! $message['message'] !!}
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
{{ session()->forget('flash_notification') }}
|
||||
19
vendor/laracasts/flash/src/views/modal.blade.php
vendored
Normal file
19
vendor/laracasts/flash/src/views/modal.blade.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<div id="flash-overlay-modal" class="modal fade {{ isset($modalClass) ? $modalClass : '' }}">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
|
||||
<h4 class="modal-title">{{ $title }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<p>{!! $body !!}</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user