Download the PHP package coringawc/filament-single-record-resource without Composer

On this page you can find all versions of the php package coringawc/filament-single-record-resource. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-single-record-resource

Filament Single Record Resource

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package implements the single-record resource pattern for Filament panels.

Instead of a list page (index) with many records, you open one resource that always resolves to one business record per authenticated user.

Common examples:

Compatibility

Installation

Core Concepts

This package is based on two traits:

It also exposes an explicit contract interface, SingleRecordResolvableResource, for Resources that want first-class static-analysis support.

  1. HasSingleRecordResource (Resource trait)
  1. HasSingleRecord (Page trait for ViewRecord and EditRecord)

Step-by-Step Implementation

1. Create your resource as single-record root

In your Filament Resource, use HasSingleRecordResource and register only view (and optionally edit) pages.

2. Use HasSingleRecord in ViewRecord

3. Optional: also use HasSingleRecord in EditRecord

Yes, this package supports EditRecord too.

Automatic Record Resolution (1:1 with authenticated user)

By default, HasSingleRecord calls a builder that applies whereBelongsTo(Filament::auth()->user()).

In practice, this works automatically when your resource model has a belongsTo(User::class) relation that points to the authenticated Filament user.

Typical 1:1 setup:

Example model relationships:

With this, your single-record root page resolves the wallet for the logged-in user automatically.

For explicit static-analysis support, implement SingleRecordResolvableResource on Resources using HasSingleRecordResource. The package still accepts legacy Resources that define the same methods manually, but the interface is now the recommended public contract.

Authorization Behavior

Filament normally uses viewAny() to decide whether a Resource can register navigation and be accessed at the Resource level.

For a root single-record resource, that default is too strict because there is no collection UX. This package now treats the Resource as accessible when:

This means a policy can intentionally deny listing while still allowing the user to open their own single record.

Custom Resolution Strategies

If your rule is not a simple belongsTo(user), prefer overriding one of the methods below on the Resource so authorization and page loading stay aligned.

A) Customize builder on the Resource (resolveSingleRecordBuilder)

B) Full custom resolver on the Resource (resolveSingleRecord)

Use this when you need firstOrCreate, tenant logic, or complex business rules.

C) Optional page-specific override

If a specific ViewRecord/EditRecord page truly needs different resolution behavior than the Resource, you can still override the page methods:

Nested Resources

For nested chains (for example MyWallet -> Companies -> Products):

  1. Keep HasSingleRecordResource on resources that follow the single-record flow
  2. Keep HasSingleRecord in deep ViewRecord/EditRecord pages
  3. If removing parent IDs from URLs, enforce strict query scoping in your models/pages
  4. Prefer implementing SingleRecordResolvableResource on Resources using HasSingleRecordResource so static analysis can understand the contract explicitly

This package also helps preserve breadcrumb consistency in deep nested routes.

Screenshots

MyWallet (Root Single Resource)

Deep Nested Resource (MyWallet -> Companies -> Products)

Testing

Run tests:

The package CI validates the plugin in two scenarios:

Changelog

Please see CHANGELOG for details.

Contributing

Please see CONTRIBUTING.

Security

Please review our security policy.

Credits

License

The MIT License (MIT). See LICENSE.md.


All versions of filament-single-record-resource with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^4.0 || ^5.0
spatie/laravel-package-tools Version ^1.15.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package coringawc/filament-single-record-resource contains the following files

Loading the files please wait ...