Taglaravel

Inline form validation with InertiaJS, Vue, and Laravel

In this post, we’ll go over how we can handle inline form validation with InertiaJS, Vue, and Laravel. As an example, we’ll take a basic todo list where we can edit each item using an inline form. All we have above is a v-for that loops through a todos array and displays the form whenever […]

Active routes in Inertia with Laravel and VueJS

One of the problems I ran into in my Inertia & Laravel applications and saw other people do the same, was how to accurately determine the active route so you can style it accordingly. In the PingCRM demo, we have a sidebar containing a menu whose items are highlighted every time you visit a specific […]

Actions in Laravel beyond CRUD

In the past couple of months, I’ve been enjoying reading Brent’s writing on PHP & Laravel. The test and types article is one of my favorites, as it highlights the importance of types and creating objects that reflect precise concepts, rather than just using primitives for everything. Recently he’s been writing a mini-series titled “Laravel […]

Testing a Laravel app with hundreds of migration files

And stay sane while doing it. Testing Laravel is usually fast. You can use an in-memory database, and all your tests run hella fast; even going directly with MySQL is fast enough. But when you inherit an application (rarely for good reasons), and you find out it has more than 370 migration files adding up […]

4 ways to deal with complexity in your eloquent models

I think everyone loves to work on completely greenfield applications. You get to plan your own course, chose your current favourite technologies, structures, and patterns to follow. There is no legacy code, no technical debt, nothing that stands in your way. You can do whatever you want and building features is a breeze. But you […]

Displaying validation errors with InertiaJS and Laravel

The easiest way to get yourself accustomed with how inertia works is to stop thinking about inertia visits as being XHR requests where you *do something* when the request it’s completed, and think of your project more as traditional server-side application where everything that happens next is dictated by the server. The same is true […]

Paginating Laravel API resources in InertiaJS applications

Later edit: Paginating Laravel API resources now works as Reinink added support for Responsable props. If you’re a Laravel developer working with InertiaJS, there’s a good chance you played around with PingCRM, the application Jonathan build to illustrate how InertiaJS works. If not, I encourage you to have a look over it as it helps […]

Laravel not nullable timestamp without a default value

I ran into the following question today: Is there no way to create a timestamp as not null with no default using #laravel migrations? I could get it to work making `shown_at` nullable, which… ok… but why? I’m OK w/ `created_at` using current but `shown_at` should always have a value. [1] For MySQL there is […]

VIN validation – Laravel custom validation rule

Working on a project involving dealerships and cars, I needed a way to validate car VIN (Vehicle Identification Number) so I came up with a custom Laravel validation rule.

Laravel: Why I gave up on $fillable

Mass-assignment is when you use an array to create/update eloquent models. The $fillable and $guarded model properties are part of Laravel’s solution to avoid mass-assigning unwanted attributes when someone passes an unexpected HTTP parameter through a request and ends up changing a column in your database you did not expect.

© 2020 cdruc

Theme by Anders NorénUp ↑