承接 plutuss/static-text-laravel 相关项目开发

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

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

plutuss/static-text-laravel

Composer 安装命令:

composer require plutuss/static-text-laravel

包简介

This package makes it possible in Laravel to modify static text on a page from the admin panel.

README 文档

README

Laravel:

The "Static Text Laravel" package provides a simple and effective solution for managing static text and images on your website directly from the Laravel admin panel. With its capabilities, you can update your site's content without the need for developer intervention, making content management more flexible and convenient.

Key Features:

  1. Static Text Management: Allows site administrators to easily update textual content such as headers, paragraphs, lists, and other elements without altering code or reloading the page.
  2. Image Editing: Enables uploading new images and updating existing ones directly from the administrative panel. This is convenient for updating banners, logos, and other visual elements of the site.
  3. Multilingual Support: Provides the ability to manage content in multiple languages, particularly useful for multilingual sites.
  4. Access Control: Offers flexible access settings for administrators and content editors, restricting access to functionality based on user roles.
  5. Laravel Integration: Fully compatible with the Laravel framework and utilizes best development practices such as migrations, seeders, and service providers.
 composer require plutuss/static-text-laravel
php artisan vendor:publish --provider="Plutuss\Providers\StaticTextServiceProvider"
php artisan migrate
<?php

use Plutuss\Models\Page;
use Plutuss\Http\Requests\StorePageRequest;
use Plutuss\Http\Requests\StorePageItemRequest;

class PageController extends Controller
{
    public function index()
    {
         $page = Page::findByName('name_page');
         
         return view('welcome', compact('page'))
    }
    
    public function addPage(StorePageRequest $request)
    {
          $page = Page::add(
                name: 'home',
                slug: '/',
                template: 'main',
                seo_title: 'seo_title', // this field can be empty
                seo_description: 'seo_description' // this field can be empty
          ); 
    }
    
        
    public function addPageItem(StorePageItemRequest $request)
    {
          $page = Page::findByName('home');
    
          $pageItem = PageItem::add(
            name: 'header',
            page_id: $page->id,
            data: [
                [
                    'key' => 'h1',
                    'value' => 'Installed packages Laravel',
                    'type' => 'text',
                ],
                [
                    'key' => 'image-bg',
                    'value' => 'path/image.jpg', // path image or file
                    'type' => 'image',  // or file
                ]
            ]);
    }
    
    public function addPageItemWithLocale()
    {
           $pageItem = PageItem::add(
                name: 'header',
                page_id: $page->id,
                data: [
                    [
                        'key' => 'h3_en', // You can specify a key with the available localisations in the application
                        'value' => 'Installed packages Laravel',
                        'type' => 'text',
                    ],
                    [
                        'key' => 'h3_de',  // You can specify a key with the available localisations in the application
                        'value' => 'Installierte Pakete Laravel',
                        'type' => 'text',
                    ]
                ]);
    }

}

resources/views/*.blade.php

    <h1> {{ $page->show('header:h1') }} </h1>
    
    // You can specify a default value
    // if the required value is not found in the database.
   {{ $page->show('header:description_text','default value') }}
   
    // Call to a view without specifying a locale
    <h3> {{ $page->show('header:h3') }} </h3>

You can use the wrapping class

    $page = Page::query()->first();

    $wrapper = new  StaticTextWrapper();

    $wrapper->setName('header');
    $wrapper->setPageId($page->id);
    $wrapper->setData('h1_title', 'packages', 'text');
    $wrapper->setData('description', 'Installed packages laravel', 'text');
    $wrapper->setData('package_url', 'https://github.com/plutuss/static-text', 'url');

    $pageItem = PageItem::addWithWrapper($wrapper);
    
    // Or  *************************************
    
    $page = Page::query()->first();

    $wrapper = (new  StaticTextWrapper())->setName('header')
        ->setPageId($page->id)
        ->setData('h1_title', 'packages', 'text')
        ->setData('description', 'Installed packages laravel', 'text')
        ->setData('package_url', 'https://github.com/plutuss/static-text', 'url');

    $pageItem = PageItem::addWithWrapper($wrapper);

You can also get a ready array of data to save

  • use a method get()
    $page = Page::query()->first();

    $wrapper = (new  StaticTextWrapper())->setName('header')
        ->setPageId($page->id)
        ->setData('h1_title', 'packages', 'text')
        ->setData('description', 'Installed packages laravel', 'text')
        ->setData('package_url', 'https://github.com/plutuss/static-text', 'url')
        ->get();
        
    $pageItem = PageItem::create($wrapper);
  • then call in the blade
   {{ $page->show('header:h1_title') }}

   {{ $page->show('header:description') }}
   
   {{ $page->show('header:package_url') }}

plutuss/static-text-laravel 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-25