schoolaid/nadota
Composer 安装命令:
composer require schoolaid/nadota
包简介
Laravel admin panel package for resource-based CRUD interfaces similar to Laravel Nova
README 文档
README
Para eso, mejor Nadota.
Nadota is a Laravel admin panel package that provides a resource-based CRUD interface similar to Laravel Nova. It allows developers to create administrative interfaces for Eloquent models through resource classes that define how data is displayed, filtered, and manipulated.
Features
- Resource-based Architecture: Define admin panels through Resource classes
- Rich Field Types: 10+ field types including Input, Select, DateTime, Toggle, and more
- Relationship Support: BelongsTo, HasOne relationships with full CRUD support
- Advanced Filtering: Built-in filtering system with custom filter support
- Sorting & Searching: Configurable sorting and search capabilities
- Authorization: Integration with Laravel policies for fine-grained permissions
- Inertia.js Integration: Seamless SPA experience with Vue 3 frontend
- Comprehensive Testing: 126 passing tests with extensive coverage
Status
Current Version: v0.2.0 - Feature Enhanced
Test Coverage: 118 passing tests, 0 failures - service integration tests moved to separate directory
Core Features: ✅ Complete field system with all basic and advanced field types
Advanced Features: ✅ Conditional visibility, validation, custom values, and constraints
Service Integration: ⚠️ Authorization interface pending (see MISSING_FEATURES_SPEC.md)
Installation
You can install the package via Composer:
composer require said/nadota
Publish the configuration file:
php artisan vendor:publish --provider="Said\Nadota\NadotaServiceProvider" --tag="config"
Quick Start
1. Create a Resource
Create a resource class for your Eloquent model:
<?php namespace App\Nadota; use Said\Nadota\Resource; use Said\Nadota\Http\Fields\Input; use Said\Nadota\Http\Fields\Select; use Said\Nadota\Http\Fields\DateTime; use Said\Nadota\Http\Fields\Relations\BelongsTo; class UserResource extends Resource { public string $model = \App\Models\User::class; public function fields($request): array { return [ Input::make('Name', 'name') ->sortable() ->searchable() ->required(), Input::make('Email', 'email') ->rules(['email', 'unique:users,email']) ->sortable() ->searchable(), Select::make('Status', 'status') ->options([ 'active' => 'Active', 'inactive' => 'Inactive', 'pending' => 'Pending' ]) ->filterable(), DateTime::make('Created At', 'created_at') ->sortable() ->exceptOnForms(), BelongsTo::make('Role', 'role') ->relatedModel(\App\Models\Role::class) ->relationAttribute('name') ->filterable(), ]; } }
2. Register the Resource
Resources are automatically discovered in the app/Nadota directory, or you can manually register them in your service provider.
3. Access the Admin Panel
Navigate to /resources/users to see your resource in action!
Available Field Types
Basic Fields
- Input: Text input fields with validation
- Select: Dropdown selection with options
- Checkbox: Single checkbox for boolean values
- Toggle: Toggle switch for boolean values
- Radio: Radio button groups
- DateTime: Date/time picker with formatting
- Hidden: Hidden form fields
- CheckboxList: Multiple checkbox selections
Relationship Fields
- BelongsTo: Many-to-one relationships
- HasOne: One-to-one relationships
Field Configuration
All fields support extensive configuration options:
Input::make('Name', 'name') ->label('Full Name') ->placeholder('Enter full name') ->required() ->sortable() ->searchable() ->filterable() ->rules(['min:2', 'max:255']) ->default('John Doe') ->hideFromIndex() ->showOnDetail();
Visibility Control
Control where fields appear:
// Hide from specific views $field->hideFromIndex() ->hideFromDetail() ->hideFromCreation() ->hideFromUpdate(); // Show only on specific views $field->onlyOnIndex() ->onlyOnDetail() ->onlyOnForms() ->exceptOnForms();
Validation
Add Laravel validation rules:
Input::make('Email', 'email') ->required() ->rules(['email', 'unique:users,email']) ->nullable(); // When updating
Sorting & Filtering
Make fields sortable and filterable:
Input::make('Name', 'name') ->sortable() ->searchable() ->filterable(); // Custom sort logic $field->sortable(function ($query, $direction) { return $query->orderBy('last_name', $direction) ->orderBy('first_name', $direction); });
Relationships
BelongsTo Relationships
BelongsTo::make('Category', 'category') ->relatedModel(Category::class) ->relationAttribute('name') ->filterable() ->sortable();
HasOne Relationships
HasOne::make('Profile', 'profile') ->relatedModel(Profile::class) ->relationAttribute('bio') ->hideFromIndex();
Authorization
Integrate with Laravel policies:
// In your Resource class public function authorizedTo($request, string $action, $model = null): bool { return $this->resourceAuthorization ->setModel($model ?? $this->model) ->authorizedTo($request, $action); }
Testing
The package includes a comprehensive test suite with 69 passing tests covering core functionality. Run tests with:
# Run all tests composer test # Run with coverage composer test-coverage # Run specific test file ./vendor/bin/pest tests/Unit/Fields/InputTest.php
Test Structure & Status
Current Status: 118 passing tests, 0 failing tests ✅
The test suite now includes comprehensive coverage:
tests/
├── Unit/
│ └── Fields/
│ ├── InputTest.php ✅ (16 tests)
│ ├── DateTimeTest.php ✅ (11 tests)
│ ├── CheckboxTest.php ✅ (11 tests)
│ ├── ToggleTest.php ✅ (13 tests)
│ ├── SelectTest.php ✅ (12 tests)
│ ├── CheckboxListTest.php ✅ (14 tests)
│ ├── ServiceIntegration/
│ │ ├── Relations/ (moved - requires Laravel app context)
│ │ └── DefaultValueTraitIntegrationTest.php (moved - requires service bindings)
│ └── Traits/
│ ├── SearchableTraitTest.php ✅ (7 tests)
│ ├── VisibilityTraitTest.php ✅ (12 tests)
│ ├── DefaultValueTraitTest.php ✅ (11 tests)
│ └── ValidationTraitTest.php ✅ (13 tests)
Missing Features: See MISSING_FEATURES_SPEC.md for unimplemented methods and advanced functionality.
Configuration
The configuration file allows customization of various aspects:
// config/nadota.php return [ 'path' => 'said', 'namespace' => 'said', 'path_resources' => 'app/Nadota', 'middlewares' => ['api'], 'api' => [ 'prefix' => 'nadota-api' ], 'frontend' => [ 'prefix' => 'resources' ], 'fields' => [ 'text' => [ 'type' => 'text', 'component' => 'FieldText' ], // ... other field mappings ] ];
API Endpoints
Nadota automatically generates RESTful API endpoints:
GET /nadota-api/resources/{resource}- Index with pagination/filteringGET /nadota-api/resources/{resource}/create- Create form dataPOST /nadota-api/resources/{resource}- Store new resourceGET /nadota-api/resources/{resource}/{id}- Show resourceGET /nadota-api/resources/{resource}/{id}/edit- Edit form dataPUT /nadota-api/resources/{resource}/{id}- Update resourceDELETE /nadota-api/resources/{resource}/{id}- Delete resource
Requirements
- PHP 8.2+ | 8.3+
- Laravel 11.0+ | 12.0+
- Inertia.js 2.0+
- Pest 3.0+ (for testing)
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security-related issues, please email security@said.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
schoolaid/nadota 适用场景与选型建议
schoolaid/nadota 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 448 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「nova」 「crud」 「panel」 「laravel」 「resource」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 schoolaid/nadota 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 schoolaid/nadota 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 schoolaid/nadota 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
Gii Generator for double model generation
2lenet/EasyAdminPlusBundle
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
统计信息
- 总下载量: 448
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-22