Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wireuse Laravel Package

foxws/wireuse

View on GitHub
Deep Wiki
Context7

title: Extending Components order: 2 tags:

  • blade
  • controllers
  • livewire
  • views

Introduction

WireUse offers a set of classes and traits that may be included on your Blade Component and Livewire Components.

Traits may also be used separately in own components.

Page Controllers

The Foxws\WireUse\Views\Support\Page extends Livewire\Component, and can serve as a Livewire controller:

use Foxws\WireUse\Views\Support\Page;

class PostViewController extends Page
{
    public Post $post;

    protected function authorizeAccess(): void
    {
        $this->canView($this->post);
    }

    protected function getTitle(): string
    {
        return (string) $this->post->name;
    }

    protected function getDescription(): string
    {
        return (string) $this->post->summary;
    }
}

The Page class and includes the following traits:

  • WithAuthentication - Can be used to retrieve the current user.
  • WithAuthorization - Can be used to authorize the current user.
  • WithHash - Can be used to generate a hash for the given component.
  • WithSeo - Can be used to generate SEO using artesaos/seotools.

Blade Component

The Foxws\WireUse\Views\Support\Component class extends Illuminate\View\Component, and may be usable for Blade components:

use Foxws\WireUse\Views\Support\Component;
use Illuminate\Contracts\Support\Htmlable;

class Button extends Component
{
    public function __construct(
        public string|Htmlable|null $label = '',
    ) {
    }
}

The Component class includes the following traits:

  • WithHash - This may be useful to generate unique hashes based on the class or class properties.
  • WithLivewire - Offers methods like wireKey() and wireModel() if a wire:model is injected as attribute.
  • Conditionable - This offers when like methods on the component.
  • Macroable - This allows component overruling and extending by mixins and macros.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope