PHP code example of aweika / laravel-ueditor

1. Go to this page and download the library: Download aweika/laravel-ueditor 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/ */

    

aweika / laravel-ueditor example snippets


    Aweika\LaravelUeditor\LaravelUeditorServiceProvider::class,
    

    'LaravelUeditor' => Aweika\LaravelUeditor\LaravelUeditor::class,
    

    \LaravelUeditor::routes();
    

        @component(\LaravelUeditor::component(), ['field'=>'element'])
        @endcomponent
        

        @component(\LaravelUeditor::component(), ['field'=>'element', 'content'=>'default content'])
        @endcomponent
        

        @php
            $csrf_token = csrf_token();
            $custom_script = <<<EOD
            <script type="text/javascript">
                var ue = UE.getEditor('content', {
                    initialFrameHeight:300,
                    autoHeightEnabled: false,
                    autoFloatEnabled: false,
                    wordCount:false,
                    elementPathEnabled:false,
                    toolbars: [
                            ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', 'simpleupload', 'fullscreen']
                        ]
                });

                ue.ready(function() {
                    ue.execCommand('serverparam', '_token', '$csrf_token');
                });
            </script>
        EOD;
        @endphp
        
        @component(\LaravelUeditor::component(), ['field'=>'element', 'content'=>'default content', 'custom_script'=>$custom_script])
        @endcomponent
        
shell
    php artisan vendor:publish --provider="Aweika\LaravelUeditor\LaravelUeditorServiceProvider" --tag=first
    
shell
    php artisan vendor:publish --provider="Aweika\LaravelUeditor\LaravelUeditorServiceProvider" --tag=second