Posts tagged with laravel
Directly assigning view variable
🔥 Applications often have the most lines of code within controller actions.
— Jason McCreary (@gonedark) April 13, 2020
One practice to streamline your code is directly assigning view variables.
This also limits the use of temporarily variables and promotes abstractions which make the code more readable. pic.twitter.com/m0JGsybQ9k
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"As a Laravel developer, this is the one newsletter I most look forward to. Freek has a talent for distilling packages or techniques down to something immediately useful - one tip can save you hours and even weeks. It's concise and practical and highly relevant."
Query time casting in Laravel
🧙♂️ One of my favorite Laravel 7 features is query time casting. This is super handy when using a subquery to get extra "non-model" data, such as a date. By default it would be a string. This feature lets you cast it to a Carbon instance "on the fly". 👌https://t.co/Kd94iMsomA pic.twitter.com/VIzowGy3um
— Jonathan Reinink (@reinink) April 15, 2020
Read more [twitter.com]
Using PEST in Laravel
My buddy Nuno is working on an interesting project to improve the experience of writing tests.
Read more [nunomaduro.com]
6 Eloquent Secrets
At Laravel News, Stefan Bauer shared some cool Eloquent tips and tricks
Read more [laravel-news.com]
A first look at laravel-backup-server
At Spatie we have 100+ servers that we manage for our clients. The past few weeks, I've invested some time in creating a new Laravel package, called laravel-backup-server that can back them all up. In the video below you'll get a first look at the package.
A package to dump anything to the log original
In this post, I'd like to show you a quick demo of our new package called laravel-log-dumper.
Using Blade components for layouts
🔥 You can use @laravelphp’s Blade components for layouts too. Way cleaner than extending imho. pic.twitter.com/Ol29sCsOci
— Freek Van der Herten (@freekmurze) April 10, 2020
Replacing websockets with Livewire original
Up until a few days ago, the real-time UI of Oh Dear (an uptime monitoring SaaS I run) was powered with web sockets. We recently replaced this with Livewire components.
In this blog post, I'd like to explain why and how we did that.
I'm going to assume that you already know what Livewire is. If not, head over to the Livewire docs. There's even a short video course on there. In short, Livewire enables you to create dynamic UIs using server-rendered partials.
The Beauty of Single Action Controllers
– driesvints.com - submitted by Dries Vints
Dries Vints wrote a bost on why he uses single action controllers.
Read more [driesvints.com]
How CSRF protection, CORS and authentication work in Laravel
Mohammed Said tweeted out a couple of very interesting videos on some of Laravel's security related features.
Testing Cashier
– driesvints.com - submitted by Dries Vints
Here are three different ways you could test Laravel Cashier.
Read more [driesvints.com]
Using the 1-click-installer to set up Mailcoach in no time original
A couple of weeks ago, we released Mailcoach: an affordable, self-hosted solution to send out newsletters. Installing it into an existing Laravel application is quite easy if you have experience with Laravel.
We wanted to make getting started with Mailcoach easier for those without experience with Laravel or PHP. Using our a 1-click-installer on the Digital Ocean marketplace you can set up an entire Mailcoach installation in a couple of minutes.
In this blogpost I'd like to show you how you can use the installer and how we built it.
Date Ranges in Laravel
– medium.com - submitted by Pavol Perdik
In this article Pavol Perdik writes about the native PostgreSQL type daterange and how to easily use it in Laravel.
Read more [medium.com]
Some cool Laravel 7 Blade components original
One of my favourite new features of Laravel 7 are Blade components. The allow you to define custom html tags that are backed by Blade partials. In this blogpost I'd like to show you a couple very handy components.
This blogpost assumes that you already know how you can use Blade components.
🐟 A package to execute a random artisan command original
Aren't you tired of having to think about which artisan command to execute? The spatie/laravel-random-command package takes that pain away. It provides a random command that will pick a random command and execute it.
Blade Heroicons
– driesvints.com - submitted by Dries Vints
A package by Dries Vints to easily make use of the Heroicons built by Steve Schoger & Adam Wathan in your Laravel Blade views.
Read more [driesvints.com]
Building complex forms with Laravel Livewire in Oh Dear original
Together with my buddy Mattias Geniar, I run Oh Dear, an uptime checker service on steroids.
Unlike most uptime trackers, Oh Dear doesn't only check your homepage, but every single page of your site. When we detect a broken link or some mixed content, we send a notification. Oh, and we provide status pages, like this one from Laravel and Flare too.
In this blog post, I'd like to show you how we use Livewire to render some complex forms in the UI of Oh Dear.
Opting Out: A Simple Solution for Conditionally Cancelling Laravel Notifications
– tighten.co - submitted by Matt Stauffer
The average Laravel app sends between a few and a few dozen notifications to users, but what happens when they want to opt out? With legal regulations like GDPR, it's more important than ever to give users control over the emails they receive.
Read more [tighten.co]
Explaining Laravel Queue configuration keys
In this series of video tweets, Mohammend Said explains some of the most confusing Queue configuration keys.
Read more [divinglaravel.com]