A seamless django like admin panel setup for Laravel. Simple, non-cms table manager for admins.

Overview

Seamless Admin Panel

A seamless Django-like admin panel setup for Laravel. Simple, non-cms table manager for admins.

Latest Stable Version License Tests

Installation steps

  1. Require the Package

Run the following command to install the package into your Laravel application:

composer require advaith/seamless-admin
  1. Publish assets and config files with:
php artisan vendor:publish --provider="Advaith\SeamlessAdmin\SeamlessAdminServiceProvider"

This will create a seamless.php configuration file within your config folder. This will also publish all the assets related to this package.

Note: If you find the UI or the admin functionalities are not working properly after a composer update, run this command again with the flag --tag="assets" to republish the assets. This will override the existing assets with the new ones.

Usage

Use the provided trait, SeamlessAdmin, in any of your models to get started with the package. Example:

<?php

namespace App\Models;

use Advaith\SeamlessAdmin\Traits\SeamlessAdmin;
...

class Post extends Model
{
    use SeamlessAdmin;
    ...
}

Et Voila! That's all you have to do to get started. Visit /admin to access the admin dashboard after logging in.

Screenshot

Configuration

seamless-admin.php config file

  • prefix: Change the prefix of the admin routes. However, this will not change the name of the route. By default, /admin will be used as the prefix
  • api_prefix: Change the prefix for api routes.
  • middleware: Global middleware for the admin routes. By default, the auth middleware is set.
  • api_middleware: Middleware group for api routes.
  • layout: You can customize the layout that the admin pages use by changing this option. Make sure that you yield appropriately to include dynamic contents.

Model specific configuration

All the model specific configuration should go inside the respective model file.

Properties

  • public bool $hasAdminPage: Set this to false to prevent the model from showing up on the admin page. Advantage of using this instead of removing the trait from the model is when other models try to check for foreign keys this will be used as a hint to fetch other columns.

  • public string $adminIcon: We use feathericons as the icon provider. Type in the name of the icon you want to use.

  • public string $adminGroup: Add a value to change the group in which the model should be displayed in the sidebar.

  • protected $primaryKey: Primary key of the model will be used even if it is not id wherever it is needed.

  • protected $fillable: adminIndexFields uses data from the $fillable and $hidden variable to show default values

  • protected $hidden: adminIndexFields uses data from the $hidden and $hidden variable to show default values

Methods

public function adminIndexFields(): array

Admin index page will display all the contents of protected $fillable excluding protected $hidden by default. To override this, use the method adminIndexFields and return an array of fields.

public function adminIndexFields(): array
{
    return [
        'title',
        'content'
    ];
}

public function adminOnCreate(array $fields): array

Use the method to change the data saved on create. An example is for Users model:

public function adminOnCreate(array $fields): array
{
    return [
        ...$fields,
        'password' => bcrypt($fields['password'])
    ];
}

This method can also be used as a hook as it fires just before the entry is created.


public function adminOnEdit(array $fields): array

Use the method to change the data saved on edit. It functions similar to the adminOnCreate method.


public function adminCanAccessIndex(): bool

Determine whether the logged-in user has the privilege to access the model data. Disabling access to index page will remove access to all the functionalities (view, create, edit, delete) for the current user.


public function adminCanAccessCreate(): bool

Determine whether the logged-in user has the privilege to create a new entry.


public function adminCanAccessEdit(): bool

Determine whether the logged-in user has the privilege to edit an entry from the database.


public function adminCanAccessDelete(): bool

Determine whether the logged-in user has the privilege to delete data from the database.


public function __toString(): string

A magic method to convert the model instance into a string. By default, the field from $fillable is used. Usage example:

public function __toString(): string
{
    return "{$this->firstName} {$this->lastName}";
}

Hooks

  • public function adminEdited(): void: This hook is fired when a model is edited
  • public function adminCreated(): void: This hook is fired when a model is created

Adding a custom page

To add a custom page to the sidebar use the SeamlessAdmin Facade in your application's AppServiceProvider. Example:

<?php

namespace App\Providers;

use Advaith\SeamlessAdmin\Facades\SeamlessAdmin;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    ...
    public function boot()
    {
        SeamlessAdmin::add('files.index', 'File', [
            'isAllowed' => fn() => auth()->user()->can('manage_files'),
            'icon' => 'layout',
            'group' => 'Blog'
        ]);
    }
}

The add method takes 3 arguments:

  1. The route name. This is the route name that you have defined in your routes file. Note: This is not url itself but instead the name of the route.
  2. Alias for the route. This is the name that will be displayed in the sidebar of the admin page.
  3. An optional array which consists of
    • isAllowed: Whether the route is visible to the current user
    • icon: Icon to be displayed in the sidebar. We use feathericons
    • group: Group in sidebar to which the custom route should be added.

To fully utilize the custom page, extend the layout seamless::layout in your blade file. Exmaple:

@extends('seamless::layout')

@section('title', 'Title')

@section('header')
    <!-- This section will be appened to the header -->
@endsection

@section('content')
    <div class="container px-4 py-2">
        The actual content here
    </div>
@endsection

@section('footer')
    <!-- This section will be added to the bottom of the page -->
@endsection

More configuration options will be added soon. For requesting a new feature, create a new issue with the label feature-request.

You might also like...
Admin One is simple, beautiful and free Laravel admin dashboard (built with Vue.js, Bulma & Buefy).
Admin One is simple, beautiful and free Laravel admin dashboard (built with Vue.js, Bulma & Buefy).

Admin One — Free Laravel Vue Bulma Dashboard Admin One is simple, beautiful and free Laravel admin dashboard (built with Vue.js, Bulma & Buefy). Built

A Laravel admin panel which is creating CRUD for your application automatically.

Adds a zero configuration Admin Panel to your Laravel Application Installation You can install the package via composer: composer require max-hutschen

Laravel Admin Panel
Laravel Admin Panel

Laravel Admin Panel An admin panel for managing users, roles, permissions & crud. Requirements Laravel =5.5 PHP = 7.0 Features User, Role & Permiss

EasyPanel is a beautiful, customizable and flexible admin panel based on Livewire for Laravel.
EasyPanel is a beautiful, customizable and flexible admin panel based on Livewire for Laravel.

EasyPanel EasyPanel is a beautiful, customizable and flexible admin panel based on Livewire for Laravel. Features : Easy to install Multi Language RTL

An account management Panel based on Laravel7 framework. Include multiple payment, account management, system caching, admin notification, products models, and more.

ProxyPanel 简体中文 Support but not limited to: Shadowsocks,ShadowsocksR,ShadowsocksRR,V2Ray,Trojan,VNET Demo Demo will always on dev/latest code, rather

Basic admin panel with authentication and CURD operation..

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

Admin panel for Uguu and Pomf.
Admin panel for Uguu and Pomf.

Moe Panel Admin panel for Uguu and Pomf which makes it easier to remove and blacklist files. Features Information about number of files uploaded & sto

Build and deploy Non-Fungible Algorand Tokens with Laravel & IPFS
Build and deploy Non-Fungible Algorand Tokens with Laravel & IPFS

Introduction Laravel is a web application framework with an expressive, elegant syntax designed to make developing web apps easier and faster through

A script to help setup Laravel project with common packages and configurations

About Snap Snap allow developer to create scaffold Laravel project. Installation Clone this repository in your user home directory. cd ~ git clone htt

Releases(v0.4.1)
  • v0.4.1(Sep 3, 2022)

    Better

    • Fixed bug where the admin panel crashes when non-class files are found in the model's directory
    • Fixed bug where the caching ignores the subfolders
    • Moved the routes and views registration logic to the boot function of the service provider
    • Added docs for Facades
    • Changed the tags for publishable files
    • Made cache expiry to 1 day
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Aug 21, 2022)

    What's new

    • Caching implemented to improve performance 🥳
    • New console command was added to clear the cache

    Better 💪

    • Fixed issue where package fails if non-class files exist in models directory
    • Added better documentation in the ModelResolver class
    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Apr 12, 2022)

    • Finally, the index page has been fully asynchronized.
    • All the functionalities in the index page such as search, sort, and change per page will happen without a full page refresh.
    • This will change the URL for easy sharing.
    • This update also contains the updated tests
    • And, the sidebar has been made responsive
    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Apr 10, 2022)

    • Icons can be added to sidebar elements
    • Sidebar elements can be classified into groups
    • Minor UI update for type index
    • Made the sidebar fixed on scroll
    • Added LICENSE file
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Apr 9, 2022)

  • v0.3.0(Apr 9, 2022)

    Foreign key support has been added to the package. Now you can search the related model while creating or editing an entry. For it to work, the column should be registered as a foreign key in the table.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Apr 8, 2022)

  • v0.2.3(Apr 6, 2022)

  • v0.2.2(Apr 5, 2022)

    Permission for different routes has been added. Global middleware can be set.

    User's can determine which user can access which pages at what time.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Apr 5, 2022)

    Field types are now dynamic depending on the column. This change can be noted while creating or editing a model entry. There are still fields that roll back to default text input such as for foreign key columns which require an async select field. This addition will be added in a future release.

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Apr 5, 2022)

Owner
Advaith A J
India Skills 2021 national winner in Web Technologies. Full Stack developer. Specialized in Laravel (PHP), Angular, React, Next js, JavaScript, Designing.
Advaith A J
A Dashboard Panel for Shop Admins to control customers using Hyperstream App

Overview ?? Hyperstream is an application that facilitates simple and easy self-service at supermarkets, eliminating long lines for customers and redu

null 1 Oct 27, 2021
Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Note: This package is only used by Backpack v3. Starting with Backpack v4, everything this package does is included in Backpack/CRUD - one package to

Backpack for Laravel 845 Nov 29, 2022
Littlelink admin is an admin panel for littlelink that provides you a website similar linktree.

⚙️ LittleLink Admin LittleLink Admin is an admin panel for littlelink that provides you a website similar linktree. ?? Features creating a link page w

Khashayar Zavosh 70 Oct 29, 2022
Littlelink admin is an admin panel for littlelink that provides you a website similar linktree.

LittleLink Admin is an admin panel for littlelink that provides you a website similar linktree.

Khashayar Zavosh 70 Oct 29, 2022
Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel.

Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel. Transform the WordPress admin screens into beautiful, clear overviews.

Codepress 67 Dec 14, 2022
Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE

Until 2018, Backpack v3 used this Base package to offer admin authentication and a blank admin panel using AdminLTE. Backpack v4 no longer uses this package, they're now built-in - use Backpack/CRUD instead.

Backpack for Laravel 845 Nov 29, 2022
A very simple admin panel for managing users, roles & permissions.

Laravel Admin Starter A very simple admin panel for managing users, roles & permissions. The premise for this package is to eradicate the duplicate wo

James Mills 26 Sep 24, 2022
A Simple & Beautiful Pluggable Exception Viewer for FilamentPHP's Admin Panel

Filament Exception Viewer A Simple & Beautiful Exception Viewer for FilamentPHP's Admin Panel Installation You can install the package via composer: c

Bezhan Salleh 33 Dec 23, 2022
A Laravel Admin Panel (Laravel Version : 6.0)

Laravel Admin Panel (Current: Laravel 7.*) Introduction Laravel Admin Panel provides you with a massive head start on any size web application. It com

ftxinfotech 903 Dec 31, 2022