承接 mohamadtsn/laravel-supernova 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mohamadtsn/laravel-supernova

Composer 安装命令:

composer require mohamadtsn/laravel-supernova

包简介

it's a basic Management panel for laravel application

README 文档

README

Laravel Supernova

Supernova image

Give a professional and powerful management panel as your Laravel App gift. 🎁

Installation: ⬇️

composer require mohamadtsn/laravel-supernova

configuration: ⚙️

Publishing Base Vendor Files

php artisan supernova:publish [tags] --force

Tag list:

  • supernova-resources
  • supernova-base-resources
  • supernova-config
  • supernova-migrations
  • supernova-virtual-host-routes
  • supernova-recaptcha-config
  • supernova-basic-routes

Publishing Custom Vendor File

php artisan supernova:publish [tags] --force

Change locale to fa in config/app.php

'locale' => 'fa',

Change Parent Class User Model:

Put this in App\Models\User.php

use Mohamadtsn\Supernova\Models\User as SupernovaUser; // use supernova User Model
use Mohamadtsn\Supernova\Classes\Traits\PermissionWrapper;
class User extends SupernovaUser
{
    use HasApiTokens, HasFactory, Notifiable, PermissionWrapper;
    // other class methods
}

Add level to fillable fields in App\Models\User.php.

protected $fillable = [
    'level',
];

Add these seeders call in Database\Seeders\DatabaseSeeder.php in run() method:

class DatabaseSeeder extends Seeder
{
    public function run()
    {
        // Other seeders call
        // You add seeders
        $this->call(UserSeeder::class); // #1
        $this->call(PermissionSeeder::class); // #2
    }
}

Add these into guards section in config/auth.php:

'guards' => [
    // other guard
    'admin' => [
        'driver' => 'session',
        'provider' => 'users',
    ],
],

Put these in app/Http/Kernel.php like below:

use App\Http\Middleware\Panel\CheckPermission; // use Middleware class CheckPermission

class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        // other routeMiddleware
        'permission' => CheckPermission::class, // add CheckPermission::class on this section
    ];
}

Change these in App/Http/Middleware/Authenticate.php in redirectTo method like below:

protected function redirectTo($request)
{
        if ($request->expectsJson()) {
            return response()->json([
                'title' => 'access denied',
                'text' => 'unauthorized ...!',
                'type' => 'error'
            ], Response::HTTP_FORBIDDEN);
        }
        return route('panel.login');
}

add admin panel routes file routes/admin.php to App/Providers/RouteServiceProvider.php in boot() method

IMPORTANT!! Be sure to add before `web.php`.

Look carefully:

For Run project With Virtual Domain:

public function boot()
{
    $this->routes(function () {
        // other routes file
        Route::middleware('web')
                ->namespace($this->namespace)
                ->domain(config('supernova.management_url'))
                ->group(base_path('routes/admin.php')); // #1 add admin panel routes (admin.php)
        
        Route::middleware('web')
                ->namespace($this->namespace)
                ->domain(config('app.url'))
                ->group(base_path('routes/web.php')); // #2 web.php routes
    });
}

For Run project With Cli Serving (php artisan serve):

public function boot()
{
    $this->routes(function () {
        // other routes file
        Route::middleware('web')
                ->namespace($this->namespace)
                ->group(base_path('routes/admin.php')); // #1 add admin panel routes (admin.php)
        
        Route::middleware('web')
                ->namespace($this->namespace)
                ->domain(config('app.url'))
                ->group(base_path('routes/web.php')); // #2 web.php routes
    });
}

Setup Schema:

  1. Set database config connection in .env file
  2. Migrate and seeding using the following commands:
php artisan migrate:fresh --seed        // "Associated with" Drop All Tables & Migrate and seeding
"Or"
php artisan migrate --seed              // "Without" Drop All Tables & Migrate and seeding

re-generate composer autoload:

 composer dump-autoload

Usage

Method #1 ====> Setup with virtual host

  • Build a virtual subdomain with name Management

    • Example:
      • origin domain => example.test // Main URL
      • subdomain domain => management.example.test // Admin Panel URL
  • add param Admin Panel URL to env file with name APP_MANAGEMENT_URL like below:

    APP_URL= http://shop.test
    APP_MANAGEMENT_URL= http://management.shop.test
  • add config Admin Panel URL to config/supernova.php file with name management_url like below:

    return [
        // other configs
        'management_url' => env('APP_MANAGEMENT_URL', 'http://management.example.test'),
    ]
  • Login to Panel management.example.test/login

  • Dashboard Panel management.example.test/

Method #2 ====> Setup without virtual host

  1. publish basic routes:
php artisan supernova:publish supernova-basic-routes --force
  1. serve app with command:
php artisan serve
  1. Tip: You have access to Supernova Panel Routes only with Prefix panel
  2. Go to 127.0.0.1:8000/panel/login

Login to Panel

  • Email: admin@gmail.com
  • Password: supernova@123

Enjoy it 👋

mohamadtsn/laravel-supernova 适用场景与选型建议

mohamadtsn/laravel-supernova 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 325 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 09 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「laravel」 「admin-panel」 「laravel admin」 「laravel-admin-panel」 「laravel-supernova」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mohamadtsn/laravel-supernova 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mohamadtsn/laravel-supernova 我们能提供哪些服务?
定制开发 / 二次开发

基于 mohamadtsn/laravel-supernova 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 325
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-09