PHP code example of bugo / moonshine-title-with-slug

1. Go to this page and download the library: Download bugo/moonshine-title-with-slug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bugo / moonshine-title-with-slug example snippets


use Bugo\MoonShine\TitleWithSlug\TitleSlug;

TitleSlug::make(
    titleColumn: 'custom_title',
    slugColumn: 'custom_slug',
);

TitleSlug::make(
    titleColumn: 'custom_title',
    slugColumn: 'custom_slug',
)
    ->titleOptions(label: 'Title')
    ->slugOptions(
        label: 'Permalink',
        labelPostfix: '.html',
    )
    ->urlOptions(
        path: '/posts/',
        hostVisible: false,
        visitLinkLabel: 'Open',
    );

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Support\Stringable;
use Illuminate\Validation\Rule;
use MoonShine\Contracts\Core\TypeCasts\DataWrapperContract;

protected function rules(DataWrapperContract $item): array
{
    return [
        'title' => ['