Camron Cade

Artisan web development, mostly using Laravel.


Finally have some time to take a look at this... I think you're off to a good start, here are a few thoughts...— Steve Schoger (@steveschoger) June 20, 2017 I would also consider constraining it a bit. A good rule of thumb is 45 to 90 characters on a line. Here&...

Read More

Laravel Eloquent's ->firstOr() method

I stumbled on another hidden gem today. I've know that Laravel has both ->firstOrNew() and firstOrCreate() queries. But for more complicated scenarios, you can run firstOr() which accepts a callback as the first argument that is run if the query does not turn up any results. This is really useful if you...

Read More

Cloud Scanner with Raspberry Pi & Fujitsu ix500

My end goal here is to have a completely headless Raspberry Pi. Push the scan button, and the Pi does all the work scanning, processing, and putting the outputted files in a shared network folder. Here's what I did to get this working. 1. Install Raspbian Follow any guide - there're everywhere. I bought...

Read More

Blade shortcut for echoing variables that may not be set

Laravel is one of those frameworks that has hidden tricks that are a delight to stumble across. This is one of them. In your blade templates, you've probably done something like this: {{ $day->common_sense }} This is all fine and dandy, but what if the day doesn't exist? What if the day doesn't...

Read More

Things to note when using Dompdf

While using Dompdf for a project I came across two small things that are worth noting. Dompdf is a PHP package that converts html/css markup into a PDF. It's not super stable and can be gimmicky at times, but it works. 1. Image widths After struggling to get Dompdf to respond to CSS,...

Read More

The list() function [PHP]

The list() function was one of those functions that I didn't learn about in any PHP course, but has stumbled across while looking at others code. It's not really a function, but is a language construct but can be very handy. Basically, it unpacks arrays and assigns the keys individual variables. Here's an example...

Read More