PHP code example of bayareawebpro / nova-field-ckeditor

1. Go to this page and download the library: Download bayareawebpro/nova-field-ckeditor 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/ */

    

bayareawebpro / nova-field-ckeditor example snippets


CkEditor::make('Content')
    ->rules('er()
    ->linkBrowser()
    ->height(60)
    ->stacked()
    ->snippets([
        ['name' =>'Cool Snippet1', 'html'=> view('snippets.1')->render()],
        ['name' =>'Cool Snippet2', 'html'=> view('snippets.2')->render()],
        ['name' =>'Cool Snippet3', 'html'=> view('snippets.3')->render()],
    ])
    ->toolbar([
        'heading',
        'horizontalLine',
        '|',
        'link',
        'linkBrowser',
        '|',
        'bold',
        'italic',
        'alignment',
        'subscript',
        'superscript',
        'underline',
        'strikethrough',
        '|',
        'blockQuote',
        'bulletedList',
        'numberedList',
        '|',
        'insertTable',
        'mediaEmbed',
        'mediaBrowser',
        'insertSnippet',
        '|',
        'undo',
        'redo'
    ]),

FeaturedMedia::make('Image','media_id')
    ->rules('nullable')
    ->sizeOnDetail(800, 600)
    ->sizeOnForms(600, 400)
    ->sizeOnIndex(100,100)
    ->stacked(),

MediaUpload::make('File', $disk='media')
    ->rules('

'media' => [
    'driver' => 'local',
    'root' => storage_path('app/public/media'),
    'url' => env('APP_URL').'/storage/media',
    'visibility' => 'public',
],

'media' => [
    'driver' => 's3',
    'key' => env('SPACES_KEY'),
    'secret' => env('SPACES_SECRET'),
    'endpoint' => env('SPACES_ENDPOINT'),
    'region' => env('SPACES_REGION'),
    'bucket' => env('SPACES_BUCKET'),
    'root' => 'media',
    'url' => 'https://'.env('SPACES_BUCKET').'.'.env('SPACES_REGION').'.cdn.digitaloceanspaces.com/media',
    'options' => [ 'CacheControl' => 'max-age=31536000, public' ],
],

use Illuminate\Http\Request;
use BayAreaWebPro\NovaFieldCkEditor\MediaStorage;
class MyMediaStorage extends MediaStorage
{
    public function __invoke(Request $request)
    {
        // TODO: Change the default implementation.
    }
}
$this->app->bind('ckeditor-media-storage', MyMediaStorage::class);
shell script
php artisan vendor:publish --tag=nova-ckeditor-stubs