la09r/web-fullstack-starter-kit-ui-vue-inertia

启动套件 Laravel UI Vue Inertia

10.1.8 2023-12-06 10:08 UTC

This package is auto-updated.

Last update: 2024-09-06 12:01:19 UTC


README

这是主包。所有UI的npm包都安装在这里。

要求

  1. Homestead 虚拟机
  • 已安装并配置了命令行:PHP v. 8.1、Composer、Git
  1. 主机
  • 已安装并配置了命令行:Node(JavaScript运行时环境) v. 18

安装

  1. Homestead 虚拟机
  • 更改目录到 DOCUMENT_ROOT cd /home/vagrant/code/81/home/test/http/laravel/d
  • rm -rf ./* && rm -rf ./.git && rm -rf ./.idea && rm -f ./.g* && rm -f ./.e* && rm -f ./.D*
  • composer create-project laravel/laravel . "10.2.9"
  • .env 中设置
    APP_URL=http://d.laravel.test.home.81.local
    
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=d_laravel_test_home_81
    DB_USERNAME=homestead
    DB_PASSWORD=secret
    
  • 创建 DB_DATABASE 或删除 DB_DATABASE 中所有现有表
  • homestead.backend..sh 文件复制到 DOCUMENT_ROOT
  • 为 *.sh 文件更新 +x 权限
  • 执行 homestead.backend.install.sh
  • config/app.phpaliases
    // add:
    App\Http\Controllers\Auth\LoginController::class => LA09R\StarterKit\UI\Vue\Inertia\App\Http\Controllers\Auth\LoginController::class,
    App\Providers\RouteServiceProvider::class        => LA09R\StarterKit\UI\Vue\Inertia\App\Providers\RouteServiceProvider::class
  • config/app.phpproviders
    // comment:
    App\Providers\RouteServiceProvider::class,
    // add:
    LA09R\StarterKit\UI\Vue\Inertia\App\Providers\AppServiceProvider::class,
    LA09R\StarterKit\UI\Vue\Inertia\App\Providers\RouteServiceProvider::class,
  • app/Http/Kernel.phpprotected $middleware array
    // add:
    \LA09R\StarterKit\UI\Vue\Inertia\App\Http\Middleware\HandleInertiaRequests::class,
  • app/Http/Kernel.php 中取消注释
    \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
  • config/view.phppaths 中删除所有并
    base_path('vendor/la09r/web-fullstack-starter-kit-ui-vue-inertia/src/resources/views'),
  • composer.jsonautoload 中添加
    "files": [
        ".env.php"
    ]
  • composer.json 中添加
    "minimum-stability": "dev",
    "prefer-stable": true,
    "repositories": [
        
    ]
  • 在 bash 中
    php artisan tinker
    User::factory()->create() // save: login = `email` field from tinker output, password = `password`
  1. 主机 机上
  • host.frontend..sh 文件复制到 DOCUMENT_ROOT
  • 为 *.sh 文件更新 +x 权限
  • host.frontend..sh 文件中的 #!/bin/zsh 替换为您的 bash bin 路径
  • 主机 机上执行 host.frontend.install.sh
  • package.jsonscript.dev 部分,将 vite build --watch 设置为
  • package.jsonscript.copy 部分,将 node ./vite.copy.componentsAsync.js 设置为
  • vite.config.jsdefineConfig.server.host 部分,将 Your_Homestead_IP 设置为
  • 执行 npm run dev 并在浏览器中检查 APP_URL