Monthly Archives: December 2018

Customize tinymce in Voyager

Add additional_js:

https://docs.laravelvoyager.com/customization/additional-css-js

‘js/custom.js’ => ‘public/js/custom.js’

Add callback function in additional js:

https://docs.laravelvoyager.com/customization/tinymce

Rename or copy plugin.min.js to plugin.js

TinyMCE will find plugin.js of each plugins in public\vendor\tcg\voyager\assets\js\plugins
https://www.tiny.cloud/docs/advanced/creating-a-plugin/

Example:

 

Reference:

  1. https://github.com/the-control-group/voyager/issues/1945
  2. Remove doctype and html tags that generated by tinymce automatically: Remove fullpage plugin.
    https://stackoverflow.com/questions/17829239/how-can-i-stop-tinymce-from-adding-doctype-htmlhtmlhead-headbody-to-e
  3. https://stackoverflow.com/questions/6266487/tinymce-allow-all-html-tag
  4. https://stackoverflow.com/questions/7744903/tinymce-allow-data-attribute

Menu handler

 

Manipulate HTML tags with DOMDocument

Reference:

  1. https://www.awaimai.com/2113.html
  2. https://stackoverflow.com/questions/16127142/modify-html-attribute-with-php
  3. https://stackoverflow.com/questions/2385834/php-dom-get-all-attributes-of-a-node

Install npm packages for node.js 10 on windows

Install windows build tools

https://github.com/nodejs/node-gyp

Install  Visual Studio Build Tools

Install Visual C++ 2010 SP1 Dist

https://www.microsoft.com/zh-tw/download/details.aspx?id=13523

Reference:

  1. https://stackoverflow.com/questions/21658832/npm-install-error-msb3428-could-not-load-the-visual-c-component-vcbuild-ex
  2. https://blog.poychang.net/npm-install-error-could-not-load-the-visual-c-component-vcbuild/
  3. https://cnodejs.org/topic/510a98acdf9e9fcc58ee157b

Laravel Swiftmailer Example

Mailable:

Controller:

 

Using Swiftmail to send email in Laravel

  1. Configs must be in .env. Not working in /config/mail.php (Unknown reason)

2. Add ‘stream’ config in config/mail.php, or you won’t be able to send emails on local machine.

3. Debug: /vendor/laravel/framework/src/illuminate/Mail/TransportManager.php

4. Clear config cache. (Optional)

Mail Example

 

Controller to send email

 

Reference:

  1. https://stackoverflow.com/questions/36454920/swiftmailer-php-how-to-disable-ssl-certificate-validation
  2. Add custom subject:
    https://laracasts.com/discuss/channels/laravel/give-an-email-a-subject?page=1