調整檔案位置 20250607

This commit is contained in:
allen.yan 2025-06-07 20:53:04 +08:00
parent bb8cdcebe3
commit 40d030f9ee
26 changed files with 172 additions and 30 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\ActivityLog; use App\Models\ActivityLog;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -30,7 +30,7 @@ final class ActivityLogTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.activity-log-header'); $header->includeViewOnTop('livewire.header.admin.activity-log');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\Branch; use App\Models\Branch;
use App\Jobs\ExportSqliteBranchJob; use App\Jobs\ExportSqliteBranchJob;
@ -39,7 +39,7 @@ final class BranchTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.branch-header') ; $header->includeViewOnTop('livewire.header.admin.branch') ;
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\MachineStatus; use App\Models\MachineStatus;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -41,7 +41,7 @@ final class MachineStatusTable extends PowerGridComponent
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.machine-status-header'); $header->includeViewOnTop('livewire.header.admin.machine-status');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\RoomStatusLog; use App\Models\RoomStatusLog;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -28,7 +28,7 @@ final class RoomStatusLogTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.room-status-log-header'); $header->includeViewOnTop('livewire.header.admin.room-status-log');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\Room; use App\Models\Room;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -28,7 +28,7 @@ final class RoomTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.room-header'); $header->includeViewOnTop('livewire.header.admin.room');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\SongLibraryCache; use App\Models\SongLibraryCache;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -36,7 +36,7 @@ final class SongLibraryCacheTable extends PowerGridComponent
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.song-library-cache-header'); $header->includeViewOnTop('livewire.header.admin.song-library-cache');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Admin; namespace App\Livewire\Forms;
use App\Models\User; use App\Models\User;
use App\Enums\UserGender; use App\Enums\UserGender;
@ -30,7 +30,7 @@ final class UserTable extends PowerGridComponent
$actions = []; $actions = [];
$header = PowerGrid::header() $header = PowerGrid::header()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.admin.user-header'); $header->includeViewOnTop('livewire.header.admin.user');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();
return $actions; return $actions;

View File

@ -1,3 +1,3 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.activity-log-table /> <livewire:forms.activity-log-table />
</x-layouts.admin> </x-layouts.admin>

View File

@ -1,5 +0,0 @@
<x-layouts.admin>
<livewire:admin.room-table/>
</x-layouts.admin>

View File

@ -1,3 +1,3 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.machine-status-table /> <livewire:forms.machine-status-table />
</x-layouts.admin> </x-layouts.admin>

View File

@ -0,0 +1,4 @@
<x-layouts.admin>
<livewire:admin.room-grid />
</x-layouts.admin>

View File

@ -1,3 +1,3 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.room-status-log-table /> <livewire:forms.room-status-log-table />
</x-layouts.admin> </x-layouts.admin>

View File

@ -1,4 +1,4 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.room-grid /> <livewire:forms.room-table/>
</x-layouts.admin> </x-layouts.admin>

View File

@ -1,3 +1,3 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.song-library-cache-table /> <livewire:forms.song-library-cache-table />
</x-layouts.admin> </x-layouts.admin>

View File

@ -1,3 +1,3 @@
<x-layouts.admin> <x-layouts.admin>
<livewire:admin.user-table /> <livewire:forms.user-table />
</x-layouts.admin> </x-layouts.admin>

View File

@ -12,8 +12,8 @@ new class extends Component
['label' => 'RoomStatusLog', 'route' => 'admin.room-status-log', 'icon' => 'clock', 'permission' => null], ['label' => 'RoomStatusLog', 'route' => 'admin.room-status-log', 'icon' => 'clock', 'permission' => null],
['label' => 'MachineStatus', 'route' => 'admin.machine-status', 'icon' => 'clock', 'permission' => null], ['label' => 'MachineStatus', 'route' => 'admin.machine-status', 'icon' => 'clock', 'permission' => null],
['label' => 'User', 'route' => 'admin.users', 'icon' => 'user-circle', 'permission' => 'user-list'], ['label' => 'User', 'route' => 'admin.users', 'icon' => 'user-circle', 'permission' => 'user-list'],
['label' => 'Branche', 'route' => 'admin.branches', 'icon' => 'building-library', 'permission' => 'room-list'], ['label' => 'Room', 'route' => 'admin.rooms', 'icon' => 'building-library', 'permission' => 'room-list'],
['label' => 'Room', 'route' => 'admin.rooms', 'icon' => 'film', 'permission' => 'room-list'], ['label' => 'RoomGrid', 'route' => 'admin.room-grids', 'icon' => 'film', 'permission' => 'room-list'],
]; ];
/** /**

View File

@ -3,8 +3,7 @@
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Livewire\Admin\Dashboard as AdminDashboard; use App\Livewire\Admin\Dashboard as AdminDashboard;
use App\Livewire\Admin\RoleTable;
use App\Livewire\Admin\UserTable;
Route::view('/', 'welcome'); Route::view('/', 'welcome');
@ -25,6 +24,6 @@ Route::middleware(['auth'])->prefix('admin')->name('admin.')->group(function ()
Route::get('/room-status-log', function () {return view('livewire.admin.room-status-log');})->name('room-status-log'); Route::get('/room-status-log', function () {return view('livewire.admin.room-status-log');})->name('room-status-log');
Route::get('/machine-status', function () {return view('livewire.admin.machine-status');})->name('machine-status'); Route::get('/machine-status', function () {return view('livewire.admin.machine-status');})->name('machine-status');
Route::get('/users', function () {return view('livewire.admin.users');})->name('users'); Route::get('/users', function () {return view('livewire.admin.users');})->name('users');
Route::get('/branches', function () {return view('livewire.admin.branches');})->name('branches');
Route::get('/rooms', function () {return view('livewire.admin.rooms');})->name('rooms'); Route::get('/rooms', function () {return view('livewire.admin.rooms');})->name('rooms');
Route::get('/room-grids', function () {return view('livewire.admin.room-grids');})->name('room-grids');
}); });

View File

@ -0,0 +1,52 @@
✅ Laravel 更新後部署流程(建議步驟)
1. 拉取新版程式碼
git pull origin main
2. 安裝依賴套件
composer install --no-dev --optimize-autoloader
cp .env.example .env
php artisan key:generate
npm install && npm run build
3. 執行資料庫 migration如有 schema 變更)
php artisan migrate
4. 清除並重新快取設定與路由
php artisan config:clear
php artisan config:cache
php artisan route:clear
php artisan route:cache
php artisan view:clear
php artisan view:cache
5. (首次部署或有新增命令時)建立或更新任務排程 Crontab
檢查是否已有下列 crontab 設定crontab -e
分鐘 小時 日 月 星期 指令
* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
這樣 Laravel 才能自動執行你在 routes/console.php 中定義的排程任務。
6. (選擇性)部署完立即執行某些 Artisan 指令
例如你可能希望部署後立即重建一次機器狀態資料表,可以執行:
php artisan machine_statuses:clear
7. 權限與快取設定(根據伺服器環境)
確認 storage 和 bootstrap/cache 目錄權限正確:
chmod -R 775 storage bootstrap/cache
chown -R www-data:www-data storage bootstrap/cache
✅ 完整部署腳本範例(可寫成 deploy.sh
#!/bin/bash
cd /var/www/your-project
git pull origin main
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan machine_statuses:clear
echo "✅ Laravel 專案已更新並執行完成。"

92
開發手冊.ini Normal file
View File

@ -0,0 +1,92 @@
laravel new shop_12_wireui
┌ Would you like to install a starter kit? ────────────────────┐
│ Laravel Breeze │
└──────────────────────────────────────────────────────────────┘
┌ Which Breeze stack would you like to install? ───────────────┐
│ Livewire (Volt Class API) with Alpine │
└──────────────────────────────────────────────────────────────┘
┌ Would you like dark mode support? ───────────────────────────┐
│ No │
└──────────────────────────────────────────────────────────────┘
┌ Which testing framework do you prefer? ──────────────────────┐
│ PHPUnit │
└──────────────────────────────────────────────────────────────┘
┌ Would you like to initialize a Git repository? ──────────────┐
│ ● Yes / ○ No │
└──────────────────────────────────────────────────────────────┘
composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan make:seeder PermissionTableSeeder
php artisan make:seeder CreateAdminUserSeeder
無 DB 新建
php artisan migrate --seed
有 DB 重制
php artisan migrate:fresh --seed
valet park
valet link
valet paths
php artisan db:seed --class=PermissionTableSeeder
php artisan db:seed --class=CreateAdminUserSeeder
//console.log();
php artisan route:list
php artisan config:clear
php artisan route:clear
php artisan cache:clear
php artisan route:list
npm install && npm run build
composer require wireui/wireui
php artisan vendor:publish --tag="wireui.config"
php artisan make:livewire Admin/Roles/Index
php artisan make:livewire Admin/Users
php artisan make:component Table
操作記錄
composer require spatie/laravel-activitylog
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan migrate
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"
php artisan make:model ActivityLog
Laravel Excel
composer require maatwebsite/excel
composer require power-components/livewire-powergrid
php artisan vendor:publish --tag=livewire-powergrid-config
建立分頁table
php artisan powergrid:create
php artisan make:job TransferSqliteTableJob
php artisan migrate:rollback
php artisan migrate
php artisan transfer:sqlite sqlite/tempUser.sqlite --sync
php artisan queue:work --daemon --timeout=3600 --tries=1 --queue=default