SnappyPDF (mkhtlmtopdf) working in dev (Laravel)

Download the latest version of wkhtlmtopdf from https://wkhtmltopdf.org/downloads.html Run composer require barryvdh/laravel-snappy Copy wkhtmltopdf and mkhtmltoimage binaries to usr/local/bin with cp vendor/h4cc/wkhtmltoimage-amd64/bin/wkhtmltoimage-amd64 /usr/local/bin/ cp vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 /usr/local/bin/ Change permissions with chmod +x /usr/local/bin/wkhtmltoimage-amd64 chmod +x /usr/local/bin/wkhtmltopdf-amd64 Ensure you add setOption to $doc = Pdf::loadHtml($view)->setOption("enable-local-file-access", true)->setPaper('a4')->setOrientation('landscape')->download ($hours->user->name.' - ' .$week.'.pdf');

Laravel, Tailwindcss, and purgeCss

To start a Laravel project which will work correctly with purgeCss you can set up like in the following example. Install new Laravel app with Then install Tailwindcss Add the Tailwind helpers to your app.scss file: Create your Tailwind CSS config file by running: Install purgeCss for laravel Then you’ll need to edit your webpack.mix.js... » read more

Using joins in Eloquent

This query will join the engineers table and the courses table to the qualifications table and will make the engineers.name column available as engineers_name in the view. Remember relationships on this query (qualifications) will not be available in the view. Example will not work.

Selectboxes in Vue.js

When using selectboxes in Vue.js you often need to pre-select an option when presenting an edit form for example. The script then sets the original value on the mounted life-cycle hook.

Installing Valet+

When installing Valet+ on macos I always ran into errors complaining about apcu_bc modules. To fix this go to the php.ini file in each php folder in the /usr/local/etc/valet-php directory and remove all the lines above the line that begins with extension_dir=. Run valet fix && valet install and all will be good.

Foreign Keys in eloquent migrations

When writing your migrations in Eloquent you may want to define something like To do this (in version 6 of Laravel) you must define the foreign keys using the following syntax to match the new bigIncrements autoincrement key added by Laravel to all tables.

Pre selecting a selectbox option in vue.js

I made a vue.js component to populate a field of text dependant on what was selected in a dropdown box. When the component loaded it needed to display the currently associated option. In Laravel blade you would write a ternary that checked the current option being added by a foreach loop with the currently associated... » read more

Getting Vue.js to work with Laravel

I have recently started building Vue.js components for my Laravel apps. When I first tried I found it difficult to get Vue.js to work and also allow the use of the excellent Vue Devtools chrome extension. This is how I finally got it working with no errors. layouts\app.blade.php Note that the <script src=”{{ asset(‘js/app.js’) }}”></script>... » read more