PHP code example of ardenthq / nova-enhanced-markdown

1. Go to this page and download the library: Download ardenthq/nova-enhanced-markdown 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/ */

    

ardenthq / nova-enhanced-markdown example snippets



namespace App\Nova;

use Laravel\Nova\Http\Requests\NovaRequest;
use Laravel\Nova\Resource;
use Ardenthq\EnhancedMarkdown\EnhancedMarkdown;

final class ResourceName extends Resource
{
    // ....
    public function fields(NovaRequest $request)
    {
        return [
            // ....
            EnhancedMarkdown::make('body'),
            // ...
        ];
    }
    // ...
}

EnhancedMarkdown::make('Content', 'content')
    ->attachmentRules('dimensions:min_width=20,min_height:20', 'image'),

EnhancedMarkdown::make('Content', 'content')
    ->parseFile(function (EnhancedMarkdown $field, UploadedFile $file) {
        $image = \Spatie\Image\Image::load($file->getPathname());
        $image->fit(\Spatie\Image\Manipulations::FIT_MAX, 100, 100);
        $image->save();
    });

EnhancedMarkdown::make('Content', 'content')
    ->parseFile(function (EnhancedMarkdown $field, UploadedFile $file) {
        return new File('some/path');
    });

EnhancedMarkdown::make('Content', 'content')
    ->disk('s3')
    ->path('articles')
bash
composer analyse