.
2020-12-19 18:29:02 -08:00
2021-01-14 14:21:09 -08:00
2020-09-14 13:53:59 -07:00
2020-10-16 13:17:09 -07:00
2020-12-19 18:14:08 -08:00
2020-10-16 13:17:09 -07:00
2020-09-14 13:53:59 -07:00
2021-01-10 10:55:18 -08:00
2021-01-10 10:55:18 -08:00
2021-01-04 17:19:51 -08:00

Filament

A lightweight admin package to jumpstart your Laravel app.

Installation

This package can be used with Laravel 8.x or higher.

The following instructions assume a new installation of Laravel with database and mail setup.

composer require filament/filament dev-master
php artisan migrate

Setup

Before you can use Filament, you must add the necessary Filament\Traits\FilamentUser trait to your App\User model.

Example:

<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Filament\Traits\FilamentUser;

class User extends Authenticatable
{
    use Notifiable, FilamentUser;

    //...
}

Create a Resource

To define a Resource, create a new resource file in app/Filament/Resources like the following Page.php.

<?php

namespace App\Filament\Resources;

use Illuminate\Support\Facades\Auth;
use Filament\Resource;
use App\Http\Livewire\Page\Index;

class Page extends Resource
{
    public $label = 'My Pages'; // defaults to formatted & pluralized classname
    public $icon = 'heroicon-o-document-text';
    public $sort = 0;

    public function __construct()
    {
        // Enable navigation visibilty and access to entire resource via policy etc.
        $this->enabled = Auth::user()->can('Access My Pages');
    }

    public function actions()
    {
        return [
            'index' => Index::class,
        ];
    }
}

Below is an example of a corresponding Livewire component defined in the resource above:

<?php

namespace App\Http\Livewire\Page;

use Livewire\Component;
use App\Models\Page;

class Index extends Component
{
    public function render()
    {
        return view('livewire.page.index', [
            'pages' => Page::paginate(12),
        ])->layout('filament::layouts.app', ['title' => __('Pages')]);
    }
}

Create a user

php artisan filament:user

Roadmap

  • Dashboard widgets
    • Bookmarks Feature with associated widget
  • Resource stubs and associated Artisan commands (e.g. artisan filament:resource Page --options)
  • DOCUMENTATION FOR ALL THE THINGS.
S
Description
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
Readme
704 MiB
Languages
PHP 89.3%
JavaScript 5.2%
Blade 3.5%
CSS 1.9%