This package includes what I often miss in Laravel and newer stubs.
composer require norman-huth/muetze-site
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
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
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/',
],
],
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',
];
}
No more problem with duplicate class names
php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="laravel-stubs"
php artisan vendor:publish --provider="NormanHuth\Muetze\SiteServiceProvider" --tag="nova-stubs"
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"
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')" />
How can I help you explore Laravel packages today?