Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Base Laravel Package

backpack/base

Backpack for Laravel is a flexible admin panel framework that lets you build custom CRUD interfaces, dashboards, and admin areas quickly. It provides reusable field types, filters, widgets, and permissions on top of Laravel, with extensive docs and a large community.

View on GitHub
Deep Wiki
Context7

Getting Started

Read this first: backpack/base is archived and superseded. As of Backpack v4, admin auth and the AdminLTE shell are built into backpack/crud and no longer live here. Treat this package as a legacy maintenance concern only — new projects should install backpack/crud and skip this entirely.

For a v3-era app that still depends on it:

  1. composer require backpack/base — pin to a v3-compatible tag. It targets Laravel 5.x and will not boot on Laravel 9+.
  2. Publish config and assets:
    php artisan vendor:publish --provider="Backpack\Base\BaseServiceProvider"
    
    This gives you config/backpack/base.php, the AdminLTE views, lang files, and public assets under public/vendor/backpack/base.
  3. Configure the admin guard in config/auth.php. Base expects a backpack guard backed by an App\User provider, or a BackpackUser model — check config/backpack/base.php for guard, user_model, and user_admin_attribute.
  4. Look next at routes/backpack/base.php — it registers /admin/login, /admin/logout, /admin/register, /admin/dashboard, and the /admin redirect. Everything routes through config('backpack.base.route_prefix').

First use case: get a logged-in admin landing on a dashboard. Hit /admin, get redirected to /admin/login, authenticate, and see the AdminLTE dashboard. If that works end-to-end, the base layer is wired correctly and you can layer CRUD controllers on top.

Implementation Patterns

Guard + user model. The canonical setup is a dedicated backpack guard, a BackpackUser model (or your App\User), and an is_admin-style column used by the middleware to decide whether the user may proceed. Keep the admin check in config (user_admin_attribute) rather than hardcoding a column name — you'll thank yourself during upgrades.

Controller extension. Base ships AdminController, Auth\LoginController, Auth\RegisterController, Auth\ForgotPasswordController, Auth\ResetPasswordController, and MyAccountController. Override by extending, not by editing vendor code:

namespace App\Http\Controllers\Admin;

use Backpack\Base\app\Http\Controllers\AdminController;

class DashboardController extends AdminController
{
    public function dashboard()
    {
        $this->data['title'] = 'Operations';
        return view('admin.dashboard', $this->data);
    }
}

Then point route_prefix/the route group at your controller.

View overrides. Publish selectively. The package registers a backpack view namespace, so a file at resources/views/vendor/backpack/base/layouts/default.blade.php shadows the package one. Publish only the files you actually touch — a full re-publish freezes you to a 2018 snapshot with no upstream fixes to rebase against.

Composing with backpack/crud. In v3, CRUD provided the panels and Base provided the chrome and auth. Both register under the same route prefix, so ordering matters: Base's service provider must register its auth and catch-all routes before CRUD's resource routes. If you get a 404 on /admin/dashboard or a login loop after adding a CRUD, check provider order in config/app.php first.

Layout/menu customization. The sidebar is a plain Blade partial. Either override layouts/inc/sidebar.blade.php or, better, define menu items in a config array and loop over them in an overridden partial — that keeps menu content out of templates in a version you can't upgrade.

Password reset and mail. Reset templates and the mail view are config keys under backpack.base.*. Override the notification/view rather than editing the published blade, since you may want to swap in your own Mailable for branding and deliverability.

Upgrade path. The practical pattern for teams still here: freeze the legacy admin, and migrate incrementally. Backpack v4's backpack/crud provides equivalent auth middleware, a backpack_user() helper, and a backpack guard config — map your is_admin column to user_admin_attribute in the new config and most of your access logic carries over untouched.

Gotchas and Tips

  • No security patches since 2018. Anything auth-related in this package should be treated as a liability. If it's exposed to the internet, budget for migration.
  • License metadata is NOASSERTION. The repo carries an MIT-style LICENSE file but the composer metadata doesn't declare it. Confirm the LICENSE text before redistributing or vendoring.
  • Silent auth failures. The user_admin_attribute check returns a redirect, not an exception. If a valid login bounces back to /admin/login, verify the column exists on the model and is truthy — a 0/null mismatch is the usual culprit. Add temporary logging in the middleware to confirm.
  • Session middleware order. Missing StartSession, ShareErrorsFromSession, or VerifyCsrfToken in the admin route group produces login loops and 419s that look like credential problems. Diff your group against the package's default.
  • Route cache. v3-era route caching can bake in the vendor auth routes; after changing route_prefix run php artisan route:clear. Use php artisan route:list | grep admin to see what's actually registered, not what you think is.
  • Asset republishing on deploy. AdminLTE assets land in public/vendor/backpack/base. If public/vendor is gitignored, your build pipeline must re-run the publish step or the admin looks unstyled in production only.
  • Don't blanket-publish views. Full publishes make later patches impossible to merge. Override one file at a time via the view namespace.
  • Extension points worth knowing: BaseServiceProvider (registerRoutes, registerMiddleware), the backpack.base.* config tree, and the MyAccountController for profile edits. Anything else, assume it's unsupported and fork locally if you must.
  • Debugging checklist: storage/logs/laravel.log → route:list → confirm guard in config/auth.php → confirm user_admin_attribute on the model → confirm views resolve to vendor/backpack/base/... and not stale published copies.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource