#laravel #inertia.js

Handling authorization in a Laravel and Inertia application

I last blogged about handling routes in a Laravel and Inertia app. The premise was that we don’t have access to Laravel’s URL generator functions with Inertia, so we need to pass our application’s routes down differently.

The same problem exists with authorization: we don’t have access to the can helper and other Gate methods. Here’s a short post about dealing with authorization on the frontend.

Read more


#laravel

Laravel Mix Preload v1

Today I tagged v1 of a new package: Laravel Mix Preload. It automatically generates preload and prefetch links based on the contents of your mix-manifest.json file.

Read more


#javascript #inertia.js #livewire #laravel

Inertia.js and Livewire: a high level comparison

Both Inertia.js and Livewire have been in the spotlight the past few months. The two libraries often get put next to each other because of their (coincidentally) simultaneous releases.

I’ve seen many people compare the two, or ask if they can be used together. This post showcases their similarities and differences, and should help you understand which problems they each solve best.

Read more


#laravel #inertia.js

Handling routes in a Laravel and Inertia app

If you’re building an app with Laravel and Inertia, you don’t have access to Laravel’s helper methods because you’re writing views in JavaScript. This means you lose the ability to generate URLs on the fly with Laravel’s route and action helpers.

This short post outlines two ways to deal with routes in a Laravel and Inertia app.

Read more


#laravel #javascript

Code splitting with Laravel Mix

Code splitting is bundler feature—if you’re using Laravel Mix, you’re bundling your assets with Webpack—that allows you to split application scripts in multiple files. These can then conditionally be loaded at a later stage.

Read more


#laravel #php #blade

Blade component aliases in Laravel 5.6

Laravel 5.6 adds the ability to register alias directives for Blade components. Let’s review some background information and examples.

Read more


#laravel #php / christoph-rumpel.com

Christoph Rumpel on rebuilding his site with Laravel

Christoph Rumpel published his revamped site last week, built with Laravel and Tailwind CSS. He based the site’s architecture on my personal site (yeah, the one you’re reading now). I open sourced it about a year ago, and I’m glad to see that it provided value to someone!

Read the full article on Christoph Rumpel’s new blog.


#laravel #php

Passing data to layouts in Blade through extends

Laravel quick tip! The @extends Blade directive accepts a second (undocumented) parameter to pass data to the parent layout.

Read more


#laravel #php

Debugging the dreaded "Class log does not exist" error in Laravel

Every now and then I come accross a Class log does not exist exception in Laravel. This particular exception is thrown when something goes wrong really early in the application, before the exception handler is instantiated.

Whenever I come across this issue I’m stumped. Mostly it’s related to an invalid configuration issue or an early service provider that throws an exception. I always forget how to debug this, so it’s time to document my solution for tracking down the underlying error.

Read more


#laravel #php #blade

Theme-based views in Laravel using vendor namespaces

I’m building a multi-tenant Laravel application. One of the requirements of the project is that every client can have their own theme based on their corporate guidelines. By default a few css adjustments will suffice, but some clients request a completely different template.

Conditionally loading a different stylesheet per client is pretty trivial, but in order to use a completely different view per theme you quickly end up typing the same thing over and over across various parts of your application.

Read more