Skip to content

Commit 6c7a60c

Browse files
author
KHOUBZA Younes
committed
update installation page
1 parent ca8fb09 commit 6c7a60c

File tree

1 file changed

+19
-159
lines changed

1 file changed

+19
-159
lines changed

docs/installation.md

Lines changed: 19 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ flash()
241241

242242
<p id="method-priority"><a href="#method-priority" class="anchor"><i class="fa-duotone fa-link"></i> priority</a></p>
243243

244+
Sets the priority of a flash message, the highest priority will be displayed first.
245+
244246
```php
245247
flash()->priority(int $priority);
246248
```
@@ -308,7 +310,9 @@ flash()
308310

309311
<p id="method-hops"><a href="#method-hops" class="anchor"><i class="fa-duotone fa-link"></i> hops</a></p>
310312

311-
Sometimes you may want a flash message to persist for longer than a single request. As an example, with a multi-page form, you may want to store messages until all pages have been filled.
313+
This method sets the number of requests that the flash message should persist for. By default, flash messages are only displayed for a single request and are then discarded. By setting the number of hops, the flash message will be persisted for multiple requests.
314+
315+
As an example, with a multi-page form, you may want to store messages until all pages have been filled.
312316

313317
{% assign id = '# usage hops' %}
314318
{% assign type = site.data.messages.types | sample %}
@@ -332,80 +336,11 @@ flash()
332336

333337
---
334338

335-
<p id="method-keep"><a href="#method-keep" class="anchor"><i class="fa-duotone fa-link"></i> keep</a></p>
336-
337-
```php
338-
flash()->keep();
339-
```
340-
341-
{% assign id = '# usage keep' %}
342-
{% assign type = site.data.messages.types | sample %}
343-
{% assign message = site.data.messages[type] | sample %}
344-
{% assign options = '{}' %}
345-
{% include example.html %}
346-
347-
```php
348-
flash()
349-
->keep()
350-
->add{{ type | capitalize }}('{{ message }}');
351-
```
352-
353-
| description |
354-
|----------------------------------------------------|
355-
| Keep the notification in the next session requests |
356-
357-
---
358-
359-
<p id="method-delay"><a href="#method-delay" class="anchor"><i class="fa-duotone fa-link"></i> delay</a></p>
360-
361-
```php
362-
flash()->delay(int $delay);
363-
```
364-
365-
{% assign id = '# usage delay' %}
366-
{% assign type = site.data.messages.types | sample %}
367-
{% assign message = site.data.messages[type] | sample %}
368-
{% assign options = '{}' %}
369-
{% include example.html %}
370-
371-
```php
372-
flash()
373-
->delay(2)
374-
->add{{ type | capitalize }}('{{ message }}');
375-
```
376-
377-
| param | description |
378-
|----------|------------------------------------------------------------------------------------|
379-
| `$delay` | The number of requests in which the message will be waiting before being displayed |
380-
381-
---
382-
383-
<p id="method-now"><a href="#method-now" class="anchor"><i class="fa-duotone fa-link"></i> now</a></p>
384-
385-
```php
386-
flash()->now();
387-
```
388-
389-
{% assign id = '# usage now' %}
390-
{% assign type = site.data.messages.types | sample %}
391-
{% assign message = site.data.messages[type] | sample %}
392-
{% assign options = '{}' %}
393-
{% include example.html %}
394-
395-
```php
396-
flash()
397-
->now()
398-
->add{{ type | capitalize }}('{{ message }}');
399-
```
400-
401-
| description |
402-
|---------------------------------|
403-
| Shortcut for flash()->delay(0) |
404-
405-
---
406-
407339
<p id="method-translate"><a href="#method-translate" class="anchor"><i class="fa-duotone fa-link"></i> translate</a></p>
408340

341+
This method sets the `locale` to be used for the translation of the flash message. If a non-null value is provided,
342+
the flash message will be translated into the specified language. If null is provided, the **default** `locale` will be used.
343+
409344
```php
410345
flash()->translate(string $locale = null);
411346
```
@@ -441,95 +376,20 @@ flash()
441376
->add{{ type | capitalize }}('Your request was processed successfully.', 'Congratulations!');
442377
```
443378

444-
| param | description |
445-
|-----------|-----------------------------------------------------------------------------|
446-
| `$locale` | The locale to be used for the translation or null to use the default locale |
447-
448-
---
449-
450-
<p id="method-preset"><a href="#method-preset" class="anchor"><i class="fa-duotone fa-link"></i> preset</a></p>
451-
452-
```php
453-
$builder = flash()->preset(string $preset, bool $flash = true);
454-
```
455-
456-
| param | description |
457-
|-----------|-----------------------------------------------------------------------|
458-
| `$preset` | The preset to be used for the notification |
459-
| `$flash` | If true, the notification will be flashed after the preset is applied |
460-
461-
---
379+
| param | description |
380+
|-----------|------------------------------------------------------------------------------|
381+
| `$locale` | The locale to be used for the translation, or null to use the default locale |
462382

463-
<p id="method-context"><a href="#method-context" class="anchor"><i class="fa-duotone fa-link"></i> context</a></p>
383+
It is **important** to note that the `translate()` method only sets the locale to be used for the translation of the flash message.
384+
It does not actually perform the translation itself.
464385

465-
```php
466-
$builder = flash()->context(array $context = []);
467-
```
468-
469-
| param | description |
470-
|------------|------------------------------------------------|
471-
| `$context` | Custom data to be available in javascript side |
472-
473-
---
474-
475-
<p id="method-withStamp"><a href="#method-withStamp" class="anchor"><i class="fa-duotone fa-link"></i> withStamp</a></p>
476-
477-
```php
478-
$builder = flash()->withStamp(StampInterface $stamp);
479-
```
480-
481-
| param | description |
482-
|----------|--------------------------------------------|
483-
| `$stamp` | Attach a stamp to the current notification |
484-
485-
---
386+
In order to translate the flash message, you will need to provide the appropriate translation keys in your translation files.
486387

487-
<p id="method-with"><a href="#method-with" class="anchor"><i class="fa-duotone fa-link"></i> with</a></p>
388+
In the above example, to translate the flash message into `Arabic`, If you are using **<i class="fa-brands fa-laravel text-red-900 fa-xl"></i> Laravel** you will need to add the following keys to the `resources/lang/ar/messages.php` file:
488389

489390
```php
490-
$builder = flash()->with(array $stamps);
391+
return [
392+
'Your request was processed successfully.' => 'تمت العملية بنجاح.',
393+
'Congratulations!' => 'تهانينا',
394+
];
491395
```
492-
493-
| param | description |
494-
|-----------|---------------------------------------------------------------------|
495-
| `$stamps` | Attach multiple stamps at the same time to the current notification |
496-
497-
---
498-
499-
<p id="method-handler"><a href="#method-handler" class="anchor"><i class="fa-duotone fa-link"></i> handler</a></p>
500-
501-
```php
502-
$builder = flash()->handler(string $handler);
503-
```
504-
505-
| param | description |
506-
|------------|---------------------------------------------------------------------------------------------------------|
507-
| `$handler` | The handler name it will be used to choose to correct js adapter to be used to display the notification |
508-
509-
---
510-
511-
<p id="method-getEnvelope"><a href="#method-getEnvelope" class="anchor"><i class="fa-duotone fa-link"></i> getEnvelope</a></p>
512-
513-
```php
514-
$envelope = flash()->getEnvelope();
515-
```
516-
517-
| param | description |
518-
|-------------|-------------------------------------------------------------------------|
519-
| `$envelope` | Get the current notification with all stamps and options attached to it |
520-
521-
---
522-
523-
<p id="method-flash"><a href="#method-flash" class="anchor"><i class="fa-duotone fa-link"></i> flash</a></p>
524-
525-
> <span class="text-orange-900">Call the **flash** method at the end when your notification is ready to be displayed</span>
526-
527-
528-
```php
529-
$envelope = flash()->flash(array $stamps = []);
530-
```
531-
532-
| param | description |
533-
|-------------|---------------------------------------------------------------------|
534-
| `$stamps` | Attach multiple stamps at the same time to the current notification |
535-
| `$envelope` | The current notification with all stamps and options attached to it |

0 commit comments

Comments
 (0)