sudobee/cygnus

此包最新版本(dev-master)没有可用的许可信息。

dev-master 2022-04-17 11:24 UTC

This package is auto-updated.

Last update: 2024-09-27 14:10:48 UTC


README

安装

  1. 在项目目录中克隆
git clone git@github.com:sudobeecom/cygnus.git
  1. 将仓库添加到项目中
"repositories": [
    {
        "type": "path",
        "url": "./cygnus"
    }
],
  1. 需要新包
"require": {
    "sudobee/cygnus": "*"
},
  1. 使用composer更新包
composer update
  1. 发布/重新发布资源
rm -rf public/vendor/cygnus
php artisan vendor:publish --tag=cygnus-assets
  1. 添加 app.blade.php
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="overflow-y-scroll">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link rel="stylesheet" href="{{ asset('fonts/inter/inter.css') }}" />

    <link rel="stylesheet" href="/vendor/cygnus/index.css">
    <script src="/vendor/cygnus/index.js" defer></script>

    <style>
        :root {
            --cygnus-primary-50: 239 246 255;
            --cygnus-primary-100: 219 234 254;
            --cygnus-primary-200: 191 219 254;
            --cygnus-primary-300: 147 197 253;
            --cygnus-primary-400: 96 165 250;
            --cygnus-primary-500: 59 130 246;
            --cygnus-primary-600: 37 99 235;
            --cygnus-primary-700: 29 78 216;
            --cygnus-primary-800: 30 64 175;
            --cygnus-primary-900: 30 58 138;
        }
    </style>
</head>
<body class="antialiased font-base">
    @inertia
</body>
</html>
  1. 添加到 AppServiceProvider 的 boot() 方法
Inertia::share([
    "baseUrl" => fn() => URL::to("/"),
    "applicationName" => fn() => env("APP_NAME"),
    "notification" => fn() => Notification::getAndClear(),
    "resetFormIdentifier" => fn() => Session::get(
        "resetFormIdentifier"
    ),
    "csrfToken" => fn() => csrf_token(),
]);
  1. 添加到 HandleInertiaRequests 的 share() 方法
/** @var User|null $user */
$user = auth()->check() ? auth()->user() : null;

return array_merge(parent::share($request), [
    "user" => $user?->only("email", "name"),
    "balance" => null,
]);
  1. 添加到 RouteServiceProvider 的 getHomepage() 方法
public static function getHomepage(): string
{
    return self::HOME;
}

更新

在您的项目目录中运行

git submodule update --remote --merge