The Blog

Laravel

Laravel ViewErrorBag Public API: getBags

John Koster
John Koster
November 29, 2016

The getBags method in Laravel's ViewErrorBag class returns an associative array containing all MessageBag instances stored within it. These instances can hold error messages related to specific form fields or other sections of a webpage. This allows developers to easily manage and display error messages to users. To learn more about Laravel's View Error Bags and their public API, check out the articles in this mini-series.

Laravel

Laravel ViewErrorBag Public API: hasBag

John Koster
John Koster
November 29, 2016

The hasBag method is used to check if a MessageBag instance exists within the ViewErrorBag instance with the specified key. By default, the $key is set to default. This article is part of a series that explores Laravel's View Error Bags, including other methods such as count, getBag, getBags, and put.

Laravel

Laravel ViewErrorBag Public API: put

John Koster
John Koster
November 29, 2016

The put method is used to add a new MessageBag instance to the ViewErrorBag instance with a specified key. You can also dynamically set a MessageBag instance by assigning it to a property in ViewErrorBag. To remove or replace all messages in a MessageBag instance, you can use the put method with a new MessageBag instance.

Laravel

Default Laravel Classes That Support Macros

Learn about the Laravel classes that support macros. These classes include ResponseFactory for creating responses, Repository for working with cache stores, Str for text manipulation, Filesystem for filesystem interactions, Arr for array manipulation, and Router for route handling.

Laravel

Laravel Classes That Support Macros

John Koster
John Koster
November 21, 2016

This table lists framework classes that directly implement the __call method and indicates if they support macros. It does not include classes that implement __callStatic. The Illuminate\Cache\Repository and Illuminate\Database\Eloquent\Builder classes support macros. Though the Builder class does not use the Macroable trait, it provides methods for adding and retrieving macros.

Laravel

Laravel Facades Part Four: Facade Class Reference

John Koster
John Koster
November 21, 2016

Learn about Laravel facades in this four-part blog series. Part one provides an introduction to facades, part two covers how to use facades, part three explains how to create custom facades, and part four offers a reference to the facade classes. Each blog post provides detailed information on default Laravel facades, their corresponding class bindings, and any additional methods they provide.

Laravel

Laravel Facades Part One: An Introduction to Facades

John Koster
John Koster
November 21, 2016

This article is part of a four-part series on Laravel facades. Facades provide a convenient way to access components in Laravel. Each facade is bound to a component registered in the service container. Facades act like proxies, providing a static interface to an actual class instance.

Laravel

Laravel Facades Part Three: Creating Custom Facades

John Koster
John Koster
November 21, 2016

This article is part of a four part series all about Laravel facades. It covers how to create a facade class, register it with the service container, and use it in your application. The article also discusses creating a facade alias, which is optional. Examples are provided throughout the article to illustrate the concepts.

Laravel

Laravel Facades Part Two: Using Facades

John Koster
John Koster
November 21, 2016

Learn about Laravel facades in this four-part series. Part One provides an introduction to facades, while Part Two explains how to use them. Part Three dives into creating custom facades, and finally, Part Four offers a facade class reference. Facades are a convenient way to use static classes that redirect method calls to actual class instances. They allow for shorter and more readable code, though dependency injection is an alternative worth considering.

Laravel

Laravel Fluent Part One: Introduction

John Koster
John Koster
November 21, 2016

Learn how to work with Laravel's Fluent API in this two-part series. Discover how the Illuminate\Support\Fluent class offers a convenient way to handle data, making it easier to make assumptions and avoid errors. Find out how to access data from arrays and objects using Laravel's helper functions, and see how the Fluent class can simplify your code by allowing you to retrieve data with ease.

Latest posts

That Escalated Quickly: All the New Things

The past six months or so have been incredibly busy. What started as a new article series about cust...

Read more
Troubleshooting a Statamic Illegal Offset Type Error when Viewing Collection Entries in the Control Panel

In this post I talk about how I resolved a mysterious illegal offset type error when viewing collect...

Read more
Creating Simple HTTP Redirect Routes from a Statamic Site

Generating a custom Laravel routes file from a Statamic website to redirect to a new domain.

Read more
Disabling Vite File Hashes

Disabling file hashes in Vite output can be accomplished by modifying your project's vite.config.js

Read more
Implementing a Custom Laravel Blade Precompiler for Volt and Livewire

Learn how to implement a custom component compiler for Laravel's Blade templating language in this p...

Read more
Creating a Hybrid Cache System for Statamic: Part Five

Part 5 of 6 covers implementing a cache namespace and labeling system, which we can use to target mu...

Read more