data_forget Helper for Laravel
Since Laravel version 10.15, there is a new utility function called data_forget that allows you to remove keys from an array or object using a "dot" notation.
The Livewire Tables package brings dynamic tables for models to Laravel Livewire. These are some of the features which you will get out of the box:
Selection of the columns you wish to see
Apply multiple filters at the same time
Perform actions on the selected records
Works perfectly with the SoftDeletes trait
Search columns individually
Multiple column types supported
Dark mode support
100% code coverage
Before proceeding, please make sure you have at least met the following prerequisites:
RequirementVersionPHP^8.1
Laravel^9.0, ^10.0
Livewire^2.0, ^3.0
Alpine.js^3.0
Tailwind CSS^3.0
Requirement Table
You can install the Livewire Table package via composer.
composer require ramonrietdijk/livewire-tables
This package does not ship with any assets except views. Therefore, you will have to add the views to your tailwind configuration.
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
// ...
"./vendor/ramonrietdijk/livewire-tables/resources/**/*.blade.php"
]
}
To make the tables blend into the style of your project, you may wish to make changes to the layout. This can be done by publishing the views and customize them any way you like.
php artisan vendor:publish --provider="RamonRietdijk\LivewireTables\ServiceProvider" --tag=views
It works by creating your table component that extends from the base LivewireTable
component like the following example:
namespace App\Livewire;
use RamonRietdijk\LivewireTables\Livewire\LivewireTable;
class BlogTable extends LivewireTable{
protected string $model = Blog::class;
}
Without repeating the documentation, here's an example of how you can map table columns to a model column:
columnColumn::make(__('Name'), 'name'), // A boolean//
columnBooleanColumn::make(__('Published'), 'published'),// A date-based
columnDateColumn::make(__('Created At'), 'created_at')->format('d m Y'),
There are various other types of columns that you can reference in the Columns documentation. Besides columns, you can also define filters, column actions, and more.
To render a table component like we have in our example, you can write the following:
<livewire:blog-table/>
You can start with this package by checking out the Documentation, starting with the Introduction to Livewire Table. There's also a demo available if you want to see it in action before you dive in and test out it for yourself! Lastly, you can see the source code on GitHub at ramonrietdijk/livewire-tables.
Full-stack developer with a knack for Merging creativity with technical expertise for standout solutions.
Since Laravel version 10.15, there is a new utility function called data_forget that allows you to remove keys from an array or object using a "dot" notation.
The ChatGPT Laravel API Package Generator package for Laravel generates smart API mocks in Laravel using ChatGPT prompts:
You can make your Laravel app multi-tenant using the Tenancy for Laravel Tenant package. This tenancy package lets you make any Laravel application multi-tenant without rewriting it.
Are you ready to take your Laravel skills to the next level and build extraordinary applications? Look no further! In this blog post, we will unveil a treasure trove of top packages that will revolutionize your development process.
The MJML PHP package by Spatie can help you create email templates more easily. But there is a catch. It can be difficult to craft visually appealing and functional email templates that work across a variety of email clients.
Laravel Translations UI is a package that provides a simple and friendly user interface for managing translations in a Laravel app.
Subscribe for 20+ new Laravel tutorials every week
You can unsubscribe at any time. You'll also get -20% off my courses!