Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tjodalv committed Mar 20, 2024
1 parent 0f3b8aa commit cc86e02
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ Here's an example of our newly created class:
```php
namespace App\BladeExtenders;

use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\Support\Renderable;
use Kanuni\LaravelBladeAnchor\Contracts\AnchorExtender;

class WelcomePageExtender implements AnchorExtender
{
public function __invoke(?array $variables): string|Htmlable|Renderable
public function __invoke(?array $variables): string|Renderable|null
{
return '<p>This string will be injected at anchor point.</p>';
}
Expand All @@ -66,7 +65,7 @@ class WelcomePageExtender implements AnchorExtender
The `__invoke()` method can return a string or a View and accepts an optional array of variables available in your Blade template. If returning a Blade view, you can pass the variables to your view like this:

```php
public function __invoke(?array $variables): string|Htmlable|Renderable
public function __invoke(?array $variables): string|Renderable|null
{
return view('my-custom-blade-view', $variables);
}
Expand All @@ -82,7 +81,7 @@ class WelcomePageExtender implements AnchorExtender
)
{}

public function __invoke(?array $variables): string|Htmlable|Renderable
public function __invoke(?array $variables): string|Renderable|null
{
return "<p>This are the results of your service: {$this->service->getResults()}</p>";
}
Expand All @@ -107,7 +106,7 @@ public function boot(): void
}
```

That is it.
As demonstrated, anchor names are unique within each view. This means you can have anchors with the same name across two different views without any conflict.

## Changelog

Expand All @@ -117,10 +116,6 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## Credits

- [Zvonimir Lokmer](https://github.com/tjodalv)
Expand Down

0 comments on commit cc86e02

Please sign in to comment.