Skip to content

Commit

Permalink
Add hash to page
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed May 3, 2024
1 parent 5f627b8 commit 8c2ca4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Views/Concerns/WithHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

namespace Foxws\WireUse\Views\Concerns;

use Livewire\Attributes\Computed;

trait WithHash
{
#[Computed]
public function hash(): string
{
return hash('crc32c', serialize($this));
}

#[Computed]
public function classHash(): string
{
return hash('crc32c', serialize(static::class));
Expand Down
2 changes: 2 additions & 0 deletions src/Views/Support/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

use Foxws\WireUse\Auth\Concerns\WithAuthentication;
use Foxws\WireUse\Auth\Concerns\WithAuthorization;
use Foxws\WireUse\Views\Concerns\WithHash;
use Foxws\WireUse\Views\Concerns\WithSeo;
use Livewire\Component;

abstract class Page extends Component
{
use WithAuthentication;
use WithAuthorization;
use WithHash;
use WithSeo;
}

0 comments on commit 8c2ca4a

Please sign in to comment.