mgahed/laravel-starter 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mgahed/laravel-starter

Composer 安装命令:

composer require mgahed/laravel-starter

包简介

This is my package laravel-starter

README 文档

README

Packagist Version Packagist Downloads Packagist License Packagist PHP Version Support Packagist Stars

The package mgahed/laravel-starter allows you to easily use starter templates for your Laravel projects.

This is a PHP Package made to serve a plain Laravel project, This package add authentication and (view, edit, delete) profile using Saul theme. And you can easily customize and use the theme features in your project.

Warning

Please note that this package is still in development.

Configuration

You can customize the behavior of the authentication views by adding the following variables to your .env file:

  • REGISTRATION_ENABLED: Set to false to disable the "Create an account" link on the login page. Defaults to true.
  • SOCIAL_AUTH_ENABLED: Set to false to disable the social authentication buttons (e.g., Google, Facebook) on the login page. Defaults to true.

Installation

composer require mgahed/laravel-starter

Publishing

assets

php artisan vendor:publish --tag="mgahed-laravel-starter-assets"

This will add folder assets to the public path in your Laravel project.

migrations

php artisan vendor:publish --tag="mgahed-laravel-starter-migrations"

seeders

php artisan vendor:publish --tag="mgahed-laravel-starter-seeders"

Running Migrations

php artisan migrate --path=database/migrations/mgahed-laravel-starter

Running Seeders

php artisan db:seed --class=Mgahed\LaravelStarter\Database\Seeders\MgahedStarterSitesSeeder
php artisan db:seed --class=Mgahed\LaravelStarter\Database\Seeders\MgahedStarterMenusSeeder

Features supported

  • Authentication
  • Profile (view, edit, delete)
  • Easy translation system with multi-language support
  • Automated translation job (see Translation Job Guide)
  • Menu management system with multi-language support
  • Saul Theme supported
  • Easy to customize
  • Supports mcamara/laravel-localization package
    • Run composer require mcamara/laravel-localization
    • publish the config file php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
    • See docs here

Menu Management System

The package includes a powerful menu management system that supports multi-language menu titles. Menu titles are stored as JSON in the database and automatically integrate with mcamara/laravel-localization package.

Creating a New Menu Item

Use the mgahed:menu command to create menu items with multi-language support:

php artisan mgahed:menu {slug} {route?} {parent?}

Parameters:

  • slug (required): The unique slug for the menu item
  • route (optional): The route name or URL (defaults to "#")
  • parent (optional): The parent menu slug (for creating sub-menus)

Interactive Multi-Language Input:

The command automatically detects available languages from your mcamara/laravel-localization configuration and prompts you to enter the menu title for each language:

# Create a simple menu item
php artisan mgahed:menu products products.index

# Create a parent menu
php artisan mgahed:menu settings-parent

# Create a child menu with parent
php artisan mgahed:menu site-settings settings.index settings-parent

Example Output:

Please enter the menu title for each language:
Title for English (en): Products
Title for Arabic (ar): المنتجات
Title for German (de): Produkte

Successfully created menu with id: 5
+----------+------------+
| Language | Title      |
+----------+------------+
| en       | Products   |
| ar       | المنتجات  |
| de       | Produkte   |
+----------+------------+

How it works:

  1. The command reads available languages from config/laravellocalization.php
  2. Prompts you to enter a title for each configured language
  3. Stores the titles as JSON in the database using spatie/laravel-translatable
  4. If no localization config is found, defaults to English and Arabic

Database Structure:

Menu titles are stored as JSON in the title column:

{
  "en": "Dashboard",
  "ar": "لوحة التحكم",
  "de": "Armaturenbrett"
}

This allows seamless integration with all Mgahed packages that support multi-language features like mgahed/ai, mgahed/core, mgahed/one, etc.

Translation System

The package includes a powerful translation job that can automatically translate your content to multiple languages using Google Translate API. The job integrates seamlessly with mcamara/laravel-localization to support all configured locales.

Translation Management UI

The package now includes a user-friendly interface for managing translations within the admin panel. This UI provides the following features:

  • Scan Translations: Discover new translation keys from your application and vendor packages.
  • Translate All: Automatically translate all unpublished translations at once.
  • Publish Translations: Publish all translations to the language files.
  • Unpublished Items: View a list of translations that have not yet been published.
  • Translation Editor: Edit translations for different languages in a user-friendly table.
  • Google Translate Integration: Automatically translate individual keys using Google Translate.
  • Global Translation: Apply a translation to all occurrences of a key across the system.

Translation Scanning

The translation scanner automatically discovers translation keys from your code and vendor packages. for example if you have alot of packages under mgahed By default, it scans:

  • Application views and controllers
  • All vendor packages under the mgahed namespace (configurable)

Scanning Multiple Vendor Packages

You can configure the package prefix to scan all packages under a specific vendor namespace. This is useful when you have multiple packages like mgahed/ai, mgahed/core, mgahed/one, etc.

Configuration:

Add to your .env file:

PACKAGES_PREFIX=mgahed

How it works:

The scanner will automatically discover and scan all packages under vendor/{PACKAGES_PREFIX}/:

  • Scans resources/views directory in each package
  • Scans src directory in each package
  • No need to manually configure each package

Example:

If you have the following packages:

  • vendor/mgahed/ai
  • vendor/mgahed/core
  • vendor/mgahed/one
  • vendor/mgahed/laravel-starter

All of them will be automatically scanned for translation keys without additional configuration.

Running the Scan:

use Mgahed\LaravelStarter\Jobs\ScanTranslationJob;

// Dispatch the job to scan for translation keys
ScanTranslationJob::dispatch();

Quick Start

use Mgahed\LaravelStarter\Jobs\TranslateJob;

// Translate from English to all supported languages
TranslateJob::dispatch('en');

// Translate from English to specific languages
TranslateJob::dispatch('en', ['ar', 'fr', 'es']);

For detailed usage instructions, see the Translation Job Guide.

System Settings

A new System Settings page lets you manage the company data used in document headers, footers, and the HACCP cover.

  • Route: system-settings.index
  • Cover preview: system-settings.cover
  • Cover PDF: system-settings.cover?format=pdf (requires dompdf/dompdf)

Seeders:

  • SystemSettingsMenuSeeder adds the menu item under settings-parent.
  • SystemSettingsSeeder inserts the default company settings.

Supported Links

Support me by clicking the button below

mgahed/laravel-starter 适用场景与选型建议

mgahed/laravel-starter 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 99 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 03 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-02