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

Muetze Site Laravel Package

norman-huth/muetze-site

View on GitHub
Deep Wiki
Context7

Laravel Package

This package includes what I often miss in Laravel and newer stubs.

Install

composer require norman-huth/muetze-site

Usage

Commands

Create Pivot Table

This command creates a migration for a many-to-many relationship between 2 models.
The 2 models of the relationship must be specified in the command.

php artisan make:migration:pivot User Role

Option if one or both primary column names are not id

php artisan make:migration:pivot User Role --id1=uui --id2=foo_bar

make:bundle Command

Create a model with a migration and policy
(The default can be adjusted in config.)

php artisan make:bundle Foo

Create with options to create resources disabled by config anyway.

// {--n : create with nova resource}
// {--m : create with migration}
// {--p : create with policy}
// {--r : create with resource}
// {--c : create with controller}
// {--a : create with api controller}
php artisan make:bundle Foo --n --m --p --r
Change the default details of the make:bundle command
php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="config"

Default:

    'make-bundle' => [
        'nova-resource' => false,
        'migration'      => true,
        'policy'         => true,
        'resource'       => true,
        'controller'     => false,
        'api-controller' => false,

        'namespaces' => [
            'controller'     => 'Web/',
            'api-controller' => 'Api/',
        ],
    ],


Traits

Encrypt Attributes

The attributes always stored encrypted in the database, but output decrypted.
For these attributes simply create a column text (nullable) and specify in the array encrypts.

<?php

namespace App\Models;

use NormanHuth\Muetze\Traits\EncryptsAttributes;
use Illuminate\Database\Eloquent\Model;

class UserData extends Model
{
    use EncryptsAttributes;

    /**
     * The attributes that are encrypted.
     *
     * @var array
     */
    protected array $encrypts = [
        'access_token',
        'address',
    ];
}

Publish

Newer Laravel Stubs

No more problem with duplicate class names

php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="laravel-stubs"

Newer Laravel Nova Stubs

php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="nova-stubs"

Additional Language File(s)

For example, to keep the Laravel translations in the original state and in case of an update they can be renewed without merge.

php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="translations"

Markdown Blade Component

Parse markdown

<x-site-markdown>
    {{ $markdown }}
</x-site-markdown>

Parse markdown without stripping whitespace (or other characters) from the beginning in each line of a string

<x-site-markdown :trim="false">
    {{ $markdown }}
</x-site-markdown>

Parse Markdown file

<x-site-markdown :file="$markdown" />

<!-- Don't forget the single quotes (:file) -->
<x-site-markdown :trim="false" :file="'/path/to/file.md'" />

<x-site-markdown :file="resource_path('views/markdowns/content.md')" />

Helper Functions

Helpers/functions.php

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.
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
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