Handy testing macro for getting data from views
? Handy lil testing macro for getting data from views pic.twitter.com/50dn2jCfSy
— Caleb Porzio (@calebporzio) March 30, 2018
Read more [twitter.com]
Posts tagged with laravel
? Handy lil testing macro for getting data from views pic.twitter.com/50dn2jCfSy
— Caleb Porzio (@calebporzio) March 30, 2018
Read more [twitter.com]
? Quick Tip for @laravelphp: It's easy to show Horizon metrics somewhere else. pic.twitter.com/SIUfwfAsKX
— hans ? (@hanspagel) March 27, 2018
Read more [twitter.com]
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.
"Freek publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
Over at Laravel News Povilas Korop wrote a nice tutorial on how to use our medialibrary (we released a new major version a couple of days ago).
By default, the Laravel registration form contains only the name, email, and password, but often it’s useful to allow the user to upload a photo or an avatar. In this tutorial we will show you an easy way to add it, using Spatie’s Media Library package.
https://laravel-news.com/uploading-avatar-images
It's a good tutorial but there's a few things not mentioned. At the end of the post you'll see this line of code:
Auth::user()->getMedia('avatars')->first()->getUrl('thumb');
That can be written a bit shorter as :
Auth::user()->getFirstMediaUrl('avatars', 'thumb');
The new v7 of the medialibrary has a new feature called "single file collections", which is just perfect for this example. Take a look at the docs: https://docs.spatie.be/laravel-medialibrary/v7/working-with-media-collections/defining-media-collections#single-file-collections
laravel-medialibrary is a powerful package that can help handle media in a Laravel application. It can organise your files across multiple filesystems, generate thumbnails, optimize images and much much more. At Spatie we use this package in nearly every project. The last few months our team has…
#30daysWithEloquent customize relations on your models as necessary in your domain. Don't be afraid to add more relations that describe your logic better.
— DRY, DRY, DRY, DRY (@SOFTonSOFA) February 22, 2018
With @laravelphp it's a cinch ??? pic.twitter.com/m3TJXp9C2l
Read more [twitter.com]
In case you have a one off section of code where you don't want to change the timestamps on save. #laraveltips pic.twitter.com/1XMwNwQNIz
— Eric L. Barnes (@ericlbarnes) March 11, 2018
Read more [twitter.com]
Last week Laravel Excel v3 was released. In a post on his company blog Patrick Brouwers writes the story of why and how v3 was released.
Laravel Excel (https://github.com/Maatwebsite/Laravel-Excel) turned 4 years last November and has reached almost 6 million Packagist downloads. A good time to reflect on 4,5 years of open source development.
https://medium.com/@maatwebsite/laravel-excel-lessons-learned-7fee2812551
My colleague Seb did some amazing work with the creation of two packages that make it easy to get started with server side rendering in PHP. In a new post on his blog he'll tell you all about it.
Server side rendering is a hot topic when it comes to client side applications. Unfortunately, it's not an easy thing to do, especially if you're not building things in a Node.js environment.
I published two libraries to enable server side rendering JavaScript from PHP: spatie/server-side-rendering and spatie/laravel-server-side-rendering for Laravel apps.
Let's review some server side rendering concepts, benefits and tradeoffs, and build a server renderer in PHP from first principles.
https://sebastiandedeyne.com/posts/2018/server-side-rendering-javascript-from-php
For the past few years Spatie, the company where I work, has released many Laravel and PHP packages. Those packages are primarily built to be used in our own projects. We do not operate in a void. We have a community around us. They use our work. They help to make our packages better by submitting…
Our team is currently prepping a new version of our medialibrary. One of the highlights is support for responsive images. On his blog my colleague Brent explains what it entails and why it is important.
I want to share some thoughts on responsive images. I'll write about a certain mindset which many projects could benefit from: small- and mid-sized web projects that don't need a full blown CDN setup, but would enjoy the performance gain of responsive images.
https://www.stitcher.io/blog/responsive-images-done-right
Blade components are pretty cool for scoped-slot-like stuff when you're not in a JS environment pic.twitter.com/pjp4ycOPKm
— Sebastian De Deyne (@sebdedeyne) March 2, 2018
Read more [twitter.com]
When the db structure changes, it's sometimes easy to perform the data migration inside a database migration.
— Freek Van der Herten (@freekmurze) February 24, 2018
Migration 1: do the db migration + restructure the data
Migration 2: drop the old columns
I'd only do this for simple stuff. pic.twitter.com/v2roA6OxBc
Read more [twitter.com]
By default all scripts on a webpage are allowed to send and fetch data from and to any site they want. If you think about it, that's kinda scary. Imagine that one of your JavaScript dependencies would send all keystrokes, including passwords, to a third party website. That would be pretty bad. In…
? Ever wanted to use the same controller to serve multiple formats?
— Adam Wathan (@adamwathan) February 15, 2018
Check out this set of macros that let you hit a single endpoint with different extensions to request the format you want:https://t.co/2sFGNf97be pic.twitter.com/HMNdicUWAy
?? Here's what it looks like in use: pic.twitter.com/zHo0GlAU6w
— Adam Wathan (@adamwathan) February 15, 2018
Read more [twitter.com]
???? Forgot about this little validation trick that had snuck by undocumented. pic.twitter.com/Hb5QUJY3ix
— Taylor Otwell ????♂️ (@taylorotwell) February 11, 2018
Read more [twitter.com]
Dries Vints, maintainer of Laravel.io, posted a step-by-step guide on how to get started with Laravel Horizon on a Forge provisioned server.
I recently installed Horizon for Laravel.io and while it wasn’t that hard to install, I still had to figure some things out. Since this was the first time setting everything up I thought I’d write up the steps to take to get started with Horizon and set everything up with Forge and Envoyer.
https://medium.com/@driesvints/laravel-horizon-with-forge-and-envoyer-82a7e819d69f
Imagine you want to have an Eloquent model hold a status. It's easily solved by just adding a status field to that model and be done with it. But in case you need a history of status changes or need to store some extra info on why a status changed, only adding a single field won't cut it. To handle…
Laravel has a very powerful notification system. From the docs:
Laravel 5.6 will probably ship this wednesday. One of the cool new features is the ability to register Blade component aliases, which was PRed by my colleague Seb. On his blog Seb guides you through the new functionality.
Laravel 5.6 adds the ability to register alias directives for Blade components. Let's review some background information and examples.
https://sebastiandedeyne.com/posts/2018/blade-component-aliases-in-laravel-56
At Spatie, we have created a dashboard powered by Laravel, Pusher and Vue that displays a lot of information useful for our company. We opensourced the dashboard a while ago.
In a new post on his company blog Chris Sherry explains how they customized our dashboard.
We use Laravel because its a well-known framework among backend developers, meaning there’s a bigger community (including lots of open source libraries), great documentation and a tonne of experience of using the framework.
Vue.js is our first choice because it lets our frontend developers build components for a project without being to be locked into building the whole project on the framework, meaning we can use the right tools for the right job.
The fact that the Spatie dashboard used these meant that all the developers at CUBE would be able to build their own components for it, which was one of my key objectives.
https://3sidedcube.com/blog/2018/02/building-dashboard-laravel-vuejs/
It's really great to see that people customize and use our stuff!