Subiendo proyecto completo sin restricciones de git ignore
This commit is contained in:
38
vendor/laracasts/flash/composer.json
vendored
Normal file
38
vendor/laracasts/flash/composer.json
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "laracasts/flash",
|
||||
"description": "Easy flash notifications",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeffrey Way",
|
||||
"email": "jeffrey@laracasts.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"illuminate/support": "~5.0|^6.0|^7.0|^8.0|^9.0|^10.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "dev-master",
|
||||
"phpunit/phpunit": "^6.1|^9.5.10"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Laracasts\\Flash": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/Laracasts/Flash/functions.php"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laracasts\\Flash\\FlashServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Flash": "Laracasts\\Flash\\Flash"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
vendor/laracasts/flash/phpunit.xml
vendored
Normal file
18
vendor/laracasts/flash/phpunit.xml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Package Test Suite">
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
131
vendor/laracasts/flash/readme.md
vendored
Normal file
131
vendor/laracasts/flash/readme.md
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
# Easy Flash Messages for Your Laravel App
|
||||
|
||||
This composer package offers a Twitter Bootstrap optimized flash messaging setup for your Laravel applications.
|
||||
|
||||
## Installation
|
||||
|
||||
Begin by pulling in the package through Composer.
|
||||
|
||||
```bash
|
||||
composer require laracasts/flash
|
||||
```
|
||||
|
||||
Next, as noted above, the default CSS classes for your flash message are optimized for Twitter Bootstrap. As such, either pull in the Bootstrap's CSS within your HTML or layout file, or write your own CSS based on these classes.
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Within your controllers, before you perform a redirect, make a call to the `flash()` function.
|
||||
|
||||
```php
|
||||
public function store()
|
||||
{
|
||||
flash('Welcome Aboard!');
|
||||
|
||||
return home();
|
||||
}
|
||||
```
|
||||
|
||||
You may also do:
|
||||
|
||||
- `flash('Message')->success()`: Set the flash theme to "success".
|
||||
- `flash('Message')->error()`: Set the flash theme to "danger".
|
||||
- `flash('Message')->warning()`: Set the flash theme to "warning".
|
||||
- `flash('Message')->overlay()`: Render the message as an overlay.
|
||||
- `flash()->overlay('Modal Message', 'Modal Title')`: Display a modal overlay with a title.
|
||||
- `flash('Message')->important()`: Add a close button to the flash message.
|
||||
- `flash('Message')->error()->important()`: Render a "danger" flash message that must be dismissed.
|
||||
|
||||
With this message flashed to the session, you may now display it in your view(s). Because flash messages and overlays are so common, we provide a template out of the box to get you started. You're free to use - and even modify to your needs - this template how you see fit.
|
||||
|
||||
```html
|
||||
@include('flash::message')
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Document</title>
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
@include('flash::message')
|
||||
|
||||
<p>Welcome to my website...</p>
|
||||
</div>
|
||||
|
||||
<!-- If using flash()->important() or flash()->overlay(), you'll need to pull in the JS for Twitter Bootstrap. -->
|
||||
<script src="//code.jquery.com/jquery.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
|
||||
|
||||
<script>
|
||||
$('#flash-overlay-modal').modal();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
If you need to modify the flash message partials, you can run:
|
||||
|
||||
```bash
|
||||
php artisan vendor:publish --provider="Laracasts\Flash\FlashServiceProvider"
|
||||
```
|
||||
|
||||
The two package views will now be located in the `resources/views/vendor/flash/` directory.
|
||||
|
||||
```php
|
||||
flash('Welcome Aboard!');
|
||||
|
||||
return home();
|
||||
```
|
||||
|
||||
```php
|
||||
flash('Sorry! Please try again.')->error();
|
||||
|
||||
return home();
|
||||
```
|
||||
|
||||
```php
|
||||
flash()->overlay('You are now a Laracasts member!', 'Yay');
|
||||
|
||||
return home();
|
||||
```
|
||||
|
||||
> [Learn exactly how to build this very package on Laracasts!](https://laracasts.com/lessons/flexible-flash-messages)
|
||||
|
||||
## Hiding Flash Messages
|
||||
|
||||
A common desire is to display a flash message for a few seconds, and then hide it. To handle this, write a simple bit of JavaScript. For example, using jQuery, you might add the following snippet just before the closing `</body>` tag.
|
||||
|
||||
```html
|
||||
<script>
|
||||
$('div.alert').not('.alert-important').delay(3000).fadeOut(350);
|
||||
</script>
|
||||
```
|
||||
|
||||
This will find any alerts - excluding the important ones, which should remain until manually closed by the user - wait three seconds, and then fade them out.
|
||||
|
||||
## Multiple Flash Messages
|
||||
|
||||
Need to flash multiple flash messages to the session? No problem.
|
||||
|
||||
```php
|
||||
flash('Message 1');
|
||||
flash('Message 2')->important();
|
||||
|
||||
return redirect('somewhere');
|
||||
```
|
||||
|
||||
Done! You'll now see two flash messages upon redirect.
|
||||
|
||||
|
||||
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