A customisable Laravel Nova card that fetches data through ajax calls.

Overview

Ajax Table Card

Description

A customisable Laravel Nova card that fetches data through ajax calls.


Why?

To allow displaying certain data on the dashboard or any other place of your choice, while fetching the data through an AJAX call to reduce the initial page load time.


Installation instruction

composer require twentyonetf/ajax-table-card


How?

  1. Create a class that extends AjaxTableCard
<?php

namespace App\Nova\Cards;

use Twentyonetf\AjaxTableCard\AjaxTableCard;

class NewUsers extends AjaxTableCard
{
    /**
     * The width of the card (1/3, 1/2, or full).
     *
     * @var string
     */
    public $width = 'full';

    public string $title = 'New Users';

    public array $header = [
        'ID', 'Name', 'Email', 'View'
    ];

    public bool $expanded = true;

    public bool $link = '/api/new-users;
}

  1. Register card like any nova card, for example: NovaServiceProvider if you want it on the dashboard.
    /**
     * Get the cards that should be displayed on the Nova dashboard.
     *
     * @return array
     */
    protected function cards(): array
    {
        return [
            (new NewUsers())
        ];
    }
  1. Generate and pass the data to the card.

Route::get('/api/new-users', function () {

    $users = User::today()->get();
    
    $data = $users->map(function ($user) {
        return [
            $session->id,
            $user->name,
            $user->email,
            "/admin/resources/users/{$user->id}"
        ];
    });

    return $data;
})


Customisation

Option Type Description default
$title string Used to set the title of the card. Ajax Table Card
$header array An array of the items in the header of the table. null
$link string The link to fetch the data from. null
$cache string How long to cache the data for. 86400
$linkable bool Is the last column of the table a link to a page? true
$expanded bool The default status of table, expanded or collapsed true
$countable bool Display a counter of how many results next to the title true

Screenshots

You might also like...
Laravel 7 Ajax Pagination Example

Now, let's see post of Laravel ajax pagination with jQuery. We will look at example of Laravel pagination json. In this article, we will implement a jQuery ajax pagination in Laravel . You can understand a concept of Laravel ajax bootstrap pagination. Here, Creating a basic example of pagination jQuery ajax Laravel

This repo is for the Laracon 2021 talk "Manage SEO with Laravel and Nova"

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

⚙️Laravel Nova Resource for a simple key/value typed setting

Laravel Nova Resource for a simple key/value typed setting Administer your Laravel Simple Setting in Nova Pre-requisites This Nova resource package re

Laravel Nova Ban simplify blocking and banning Eloquent models.
Laravel Nova Ban simplify blocking and banning Eloquent models.

Laravel Nova Ban Introduction Behind the scenes cybercog/laravel-ban is used. Contents Installation Usage Prepare bannable model Prepare bannable mode

🖼️ Laravel Nova Field for uploading and cropping images using Slim Image Cropper
🖼️ Laravel Nova Field for uploading and cropping images using Slim Image Cropper

🖼️ Laravel Nova Field for uploading and cropping images using Slim Image Cropper

Webhook Manager for Laravel Nova
Webhook Manager for Laravel Nova

Webhook Manager for Laravel Nova A Laravel Nova tool that allows users to create and manage webhooks based on Eloquent Model events. A tool for Larave

A minimalistic event calendar Tool for Laravel's Nova 4
A minimalistic event calendar Tool for Laravel's Nova 4

Event calendar for Laravel Nova 4 An event calendar that displays Nova resources or other time-related data in your Nova 4 project on a monthly calend

A Laravel Nova tool for viewing your application logs
A Laravel Nova tool for viewing your application logs

This package makes it easy to view your Laravel application logs inside of Nova. It even supports polling. Installation You can install the Nova tool

This Laravel Nova package allows you to manage media and media fields
This Laravel Nova package allows you to manage media and media fields

Nova Media Hub This Laravel Nova package allows you to manage media and media fields. Requirements php: =8.0 laravel/nova: ^4.0 Features Media Hub UI

Releases(0.0.6)
Owner
TwentyOne34 Technologies Corp.
Your digital partners.
TwentyOne34 Technologies Corp.
This Laravel Nova tool lets you run artisan and bash commands directly from Nova 4 or higher.

Laravel Nova tool for running Artisan & Shell commands. This Nova tool lets you run artisan and bash commands directly from nova. This is an extended

Artem Stepanenko 17 Dec 15, 2022
This Laravel Nova settings tool based on env, using nativ nova fields and resources

Nova Settings Description This Laravel Nova settings tool based on env, using nativ nova fields and resources Features Using native Nova resources Ful

Artem Stepanenko 21 Dec 28, 2022
This Laravel Nova package adds a Trumbowyg field to Nova's arsenal of fields.

Nova Trumbowyg Field This Laravel Nova package adds a Trumbowyg field to Nova's arsenal of fields. Requirements php: >=8.0 laravel/nova: ^4.0 Installa

outl1ne 3 Sep 25, 2022
An easy way to get vendor and package data from Packagist via API calls

Laravel Packagist Laravel Packagist (LaravelPackagist) is a package for Laravel 5 to interact with the packagist api quickly and easily. Table of cont

Jeremy Kenedy 5 Jul 18, 2022
Output complex, flexible, AJAX/RESTful data structures.

Fractal Fractal provides a presentation and transformation layer for complex data output, the like found in RESTful APIs, and works really well with J

The League of Extraordinary Packages 3.5k Dec 26, 2022
🛂 Use this package to validate the identity card from your country using laravel validation rules.

Identity Card Checker Laravel Validation Rules Use this package to validate the identity card number from your country Installation You can install th

David Torralbo Pérez 13 Feb 8, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
Easily validate data attributes through a remote request

Laravel Remote Rule Easily validate data attributes through a remote request. This package allows you to define a subset of custom rules to validate a

H-FARM Innovation 27 Nov 20, 2022
Laravel Nova filter for Spatie/laravel-tags

SpatieTagsNovaFilter This package allows you to filter resources by tags. (using the awesome Spatie/laravel-tags and Vue-MultiSelect ) Installation Fi

Mahi-Mahi 3 Aug 4, 2022
Leads Management using Laravel & AJAX

Leads Manager v1.00 - Built-in Laravel/AJAX You can manage your leads, add, update, or even delete without refreshing , using jQuery & AJAX This is a

Med Reda Kamal 0 Jul 28, 2022