Coder Social home page Coder Social logo

filament-spotlight's Introduction

header pxlrbt-translate-action.png

Filament Spotlight

Latest Version on Packagist Software License GitHub Workflow Status Total Downloads

Quickly navigate your Filament Resources with Spotlight functionality.

Supports pages, resources and links from the user menu.

demo.mp4

Installation

Plugin Version Filament Version PHP Version
0.x 2.x > 8.0
1.x 3.x > 8.1
composer require pxlrbt/filament-spotlight

Assets

Publish the assets (Filament > 3)

php artisan filament:assets

Plugin registration

To use this plugin register it in your panel configuration:

use pxlrbt\FilamentSpotlight\SpotlightPlugin;

$panel
    ->plugins([
        SpotlightPlugin::make(),
    ]);

Usage

There is no configuration needed.

"its genius"

  – Dan Harrin

To open the Spotlight input bar you can use one of the following shortcuts:

CTRL + K
CMD + K
CTRL + /
CMD + /

Setup

This plugin relies on the same properties and methods used for Filament's global search. For records showing up with the correct name in "Edit/View" you need to set $recordTitleAttribute. Check the docs for more information

Excluding pages

If you need to exclude a page from the spotlight results you may do so by adding a static shouldRegisterSpotlight method to the page and return false:

public static function shouldRegisterSpotlight(): bool
{
    return false;
}

This can be useful when you have pages that require URL parameters.

Translation

To translate or edit the default placeholder, you have to publish the translation file for wire-element/spotlight:

php artisan vendor:publish --tag=livewire-ui-spotlight-translations

Contributing

If you want to contribute to this packages, you may want to test it in a real Filament project:

  • Fork this repository to your GitHub account.
  • Create a Filament app locally.
  • Clone your fork in your Filament app's root directory.
  • In the /filament-spotlight directory, create a branch for your fix, e.g. fix/error-message.

Install the packages in your app's composer.json:

"require": {
    "pxlrbt/filament-spotlight": "dev-fix/error-message as main-dev",
},
"repositories": [
    {
        "type": "path",
        "url": "filament-spotlight"
    }
]

Now, run composer update.

Credits

filament-spotlight's People

Contributors

alexmartinfr avatar austincarpenter avatar buzkall avatar nitinkaware avatar oddvalue avatar pxlrbt avatar sakanjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

filament-spotlight's Issues

CamelHump

When searching for i.e.
Subscription - Create

It would be cool to also find it with
**SubCre**

in my IDE that's called CamelHump:
Navigation_and_Search__CamelHumps__uppercase_letter

just an idea 😄 don't know how hard to implement.

Add usage details to documentation

The documentation could have some implementation details, such as selecting specific database columns to display a result from a resource, and others we don't know.

Update 0.3.1 breaks the app if using Filament guard

When using Filament guard, checking auth()->check() throws an exception:

method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given

It can be solved using:
Filament::auth()->check()

Support for Filament v3

  Problem 1
    - pxlrbt/filament-spotlight[0.1.0, ..., v0.3.2] require filament/filament ^2.10.34 -> found filament/filament[v2.10.34, ..., v2.17.51] but it conflicts with your root composer.json require (^3.0).
    - pxlrbt/filament-spotlight[v0.3.3, ..., v0.3.8] require filament/filament ^2.14.0 -> found filament/filament[v2.14.0, ..., v2.17.51] but it conflicts with your root composer.json require (^3.0).
    - Root composer.json requires pxlrbt/filament-spotlight * -> satisfiable by pxlrbt/filament-spotlight[0.1.0, ..., v0.3.8].

Resource Icon

It would be very cool if the search results would feature the navigation Icon of the ressource.
Good for quick navigation and readability.

Missing translation keys

It seems like the english translation is missing some translations, like Search for a :record, Logout, Dashboard and so on. Also, adding 'Search for a :record' as a key in the translation doesn't seem to pick it up here:

SpotlightCommandDependency::make('record')->setPlaceholder(__('Search for a :record', ['record' => $this->resource::getModelLabel()]))

I tried to clear the cache, and change both English and Italian languages to this:

'What do you want to do?', 'Search for a :record' => 'Test :record', ]; but with no avail.

Not working starting from Filament v2.15.29

Hello,
I noticed some slowness in panel after an update of filament to v2.15.33 than usual, than I found that the plugin is not working at all.
After some inspection, I confirmed that is not working starting from the Filament v2.15.29 (with Laravel 9.26.1/PHP8.1).
I didn't dig deeper, I'm not sure, but I remember that the PR #3719 regarding support for Turbo Navigation got my attention that may cause similar issues.

CamelHump

When searching for i.e.
Subscription - Create

It would be cool to also find it with
**SubCre**

in my IDE that's called CamelHump:
Navigation_and_Search__CamelHumps__uppercase_letter

just an idea 😄 don't know how hard to implement.

Custom page error

Hi,
After installing the package, I got this error :

Missing required parameter for [Route: filament.pages.{record}/exammodule] [URI: account/{record}/exammodule] [Missing parameter: record]
How could I resolve this please? thanks

Ignores getRouteKeyName()

In URL I have set uuid instead of id: [resource]/[uuid]/edit . Edits in work fine in Filament routes but Spotlight ignores the method in the Model:

  public function getRouteKeyName()
  {
      return 'uuid';
  }

and does: [resource]/[id]/edit so it is 404.
That should be checked when performing search. Am I missing something?

Pages with route parameters break page registration.

This has already been mentioned in #17 but we have a few pages within our application that have route parameters. One possible solution would be to check whether or not the page should register navigation in RegisterPages:

            if ($page::shouldRegisterNavigation() === false) {
                continue;
            }

If having pages that aren't in the navigation is an intended feature of this package then maybe that could be togglable? Or some way to excluded certain pages added?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.