初步建置 20250422

This commit is contained in:
allen.yan 2025-04-22 14:00:23 +08:00
parent f2f0f698e5
commit a863ce23a4
25 changed files with 1165 additions and 16 deletions

View File

@ -2,11 +2,12 @@ APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=Asia/Taipei
APP_URL=https://shop_12_wireui.test
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_LOCALE=zh-TW
APP_FALLBACK_LOCALE=zh-TW
APP_FAKER_LOCALE=zh-TW
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database

View File

@ -0,0 +1,16 @@
<?php
namespace App\Livewire\Admin;
use Livewire\Component;
use Illuminate\Support\Facades\Auth;
class Dashboard extends Component
{
public function render()
{
$user = Auth::user();
return view('livewire.admin.dashboard', compact('user'))->layout('layouts.admin');
}
}

View File

@ -6,11 +6,12 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
use HasFactory, Notifiable, HasRoles;
/**
* The attributes that are mass assignable.

View File

@ -10,7 +10,8 @@
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"livewire/livewire": "^3.4",
"livewire/volt": "^1.7.0"
"livewire/volt": "^1.7.0",
"spatie/laravel-permission": "^6.17"
},
"require-dev": {
"fakerphp/faker": "^1.23",

85
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d5c4a63a5c548dbdec3a13cf3fddce08",
"content-hash": "50b5ae6f549fbdc743dd6abf2feebb9f",
"packages": [
{
"name": "brick/math",
@ -3434,6 +3434,89 @@
],
"time": "2024-04-27T21:32:50+00:00"
},
{
"name": "spatie/laravel-permission",
"version": "6.17.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-permission.git",
"reference": "02ada8f638b643713fa2fb543384738e27346ddb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/02ada8f638b643713fa2fb543384738e27346ddb",
"reference": "02ada8f638b643713fa2fb543384738e27346ddb",
"shasum": ""
},
"require": {
"illuminate/auth": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/container": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/contracts": "^8.12|^9.0|^10.0|^11.0|^12.0",
"illuminate/database": "^8.12|^9.0|^10.0|^11.0|^12.0",
"php": "^8.0"
},
"require-dev": {
"laravel/passport": "^11.0|^12.0",
"laravel/pint": "^1.0",
"orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^9.4|^10.1|^11.5"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Permission\\PermissionServiceProvider"
]
},
"branch-alias": {
"dev-main": "6.x-dev",
"dev-master": "6.x-dev"
}
},
"autoload": {
"files": [
"src/helpers.php"
],
"psr-4": {
"Spatie\\Permission\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Permission handling for Laravel 8.0 and up",
"homepage": "https://github.com/spatie/laravel-permission",
"keywords": [
"acl",
"laravel",
"permission",
"permissions",
"rbac",
"roles",
"security",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/laravel-permission/issues",
"source": "https://github.com/spatie/laravel-permission/tree/6.17.0"
},
"funding": [
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2025-04-08T15:06:14+00:00"
},
{
"name": "symfony/clock",
"version": "v7.2.0",

202
config/permission.php Normal file
View File

@ -0,0 +1,202 @@
<?php
return [
'models' => [
/*
* When using the "HasPermissions" trait from this package, we need to know which
* Eloquent model should be used to retrieve your permissions. Of course, it
* is often just the "Permission" model but you may use whatever you like.
*
* The model you want to use as a Permission model needs to implement the
* `Spatie\Permission\Contracts\Permission` contract.
*/
'permission' => Spatie\Permission\Models\Permission::class,
/*
* When using the "HasRoles" trait from this package, we need to know which
* Eloquent model should be used to retrieve your roles. Of course, it
* is often just the "Role" model but you may use whatever you like.
*
* The model you want to use as a Role model needs to implement the
* `Spatie\Permission\Contracts\Role` contract.
*/
'role' => Spatie\Permission\Models\Role::class,
],
'table_names' => [
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'roles' => 'roles',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your permissions. We have chosen a basic
* default value but you may easily change it to any table you like.
*/
'permissions' => 'permissions',
/*
* When using the "HasPermissions" trait from this package, we need to know which
* table should be used to retrieve your models permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_permissions' => 'model_has_permissions',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your models roles. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'model_has_roles' => 'model_has_roles',
/*
* When using the "HasRoles" trait from this package, we need to know which
* table should be used to retrieve your roles permissions. We have chosen a
* basic default value but you may easily change it to any table you like.
*/
'role_has_permissions' => 'role_has_permissions',
],
'column_names' => [
/*
* Change this if you want to name the related pivots other than defaults
*/
'role_pivot_key' => null, // default 'role_id',
'permission_pivot_key' => null, // default 'permission_id',
/*
* Change this if you want to name the related model primary key other than
* `model_id`.
*
* For example, this would be nice if your primary keys are all UUIDs. In
* that case, name this `model_uuid`.
*/
'model_morph_key' => 'model_id',
/*
* Change this if you want to use the teams feature and your related model's
* foreign key is other than `team_id`.
*/
'team_foreign_key' => 'team_id',
],
/*
* When set to true, the method for checking permissions will be registered on the gate.
* Set this to false if you want to implement custom logic for checking permissions.
*/
'register_permission_check_method' => true,
/*
* When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
* this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
* NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
*/
'register_octane_reset_listener' => false,
/*
* Events will fire when a role or permission is assigned/unassigned:
* \Spatie\Permission\Events\RoleAttached
* \Spatie\Permission\Events\RoleDetached
* \Spatie\Permission\Events\PermissionAttached
* \Spatie\Permission\Events\PermissionDetached
*
* To enable, set to true, and then create listeners to watch these events.
*/
'events_enabled' => false,
/*
* Teams Feature.
* When set to true the package implements teams using the 'team_foreign_key'.
* If you want the migrations to register the 'team_foreign_key', you must
* set this to true before doing the migration.
* If you already did the migration then you must make a new migration to also
* add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
* (view the latest version of this package's migration file)
*/
'teams' => false,
/*
* The class to use to resolve the permissions team id
*/
'team_resolver' => \Spatie\Permission\DefaultTeamResolver::class,
/*
* Passport Client Credentials Grant
* When set to true the package will use Passports Client to check permissions
*/
'use_passport_client_credentials' => false,
/*
* When set to true, the required permission names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_permission_in_exception' => false,
/*
* When set to true, the required role names are added to exception messages.
* This could be considered an information leak in some contexts, so the default
* setting is false here for optimum safety.
*/
'display_role_in_exception' => false,
/*
* By default wildcard permission lookups are disabled.
* See documentation to understand supported syntax.
*/
'enable_wildcard_permission' => false,
/*
* The class to use for interpreting wildcard permissions.
* If you need to modify delimiters, override the class and specify its name here.
*/
// 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
/* Cache-specific settings */
'cache' => [
/*
* By default all permissions are cached for 24 hours to speed up performance.
* When permissions or roles are updated the cache is flushed automatically.
*/
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
/*
* The cache key used to store all permissions.
*/
'key' => 'spatie.permission.cache',
/*
* You may optionally indicate a specific cache driver to use for permission and
* role caching using any of the `store` drivers listed in the cache.php config
* file. Using 'default' here means to use the `default` set in cache.php.
*/
'store' => 'default',
],
];

View File

@ -0,0 +1,140 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
$teams = config('permission.teams');
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
// $table->engine('InnoDB');
$table->bigIncrements('id'); // permission id
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
$table->unique(['name', 'guard_name']);
});
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
// $table->engine('InnoDB');
$table->bigIncrements('id'); // role id
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
}
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
if ($teams || config('permission.testing')) {
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
} else {
$table->unique(['name', 'guard_name']);
}
});
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
$table->unsignedBigInteger($pivotPermission);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
} else {
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
}
});
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
$table->unsignedBigInteger($pivotRole);
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
if ($teams) {
$table->unsignedBigInteger($columnNames['team_foreign_key']);
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
} else {
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
}
});
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
$table->unsignedBigInteger($pivotPermission);
$table->unsignedBigInteger($pivotRole);
$table->foreign($pivotPermission)
->references('id') // permission id
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign($pivotRole)
->references('id') // role id
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*/
public function down(): void
{
$tableNames = config('permission.table_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
}
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
};

View File

@ -0,0 +1,29 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\User;
class CreateAdminUserSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$user = User::create([
'name' => 'Allen Yan(admin)',
'email' => 'admin@gmail.com',
'password' => bcrypt('aa1234')
]);
$user->assignRole('Admin');
$user = User::create([
'name' => 'Allen Yan(User)',
'email' => 'allen.yan@gmail.com',
'password' => bcrypt('aa1234')
]);
$user->assignRole('User');
}
}

View File

@ -13,11 +13,9 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
$this->call([
PermissionTableSeeder::class,
CreateAdminUserSeeder::class,
]);
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
class PermissionTableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$permissions = [
'role-list',
'role-create',
'role-edit',
'role-delete',
'product-list',
'product-create',
'product-edit',
'product-delete'
];
foreach ($permissions as $permission) {
Permission::create(['name' => $permission]);
}
// 建立 Admin 角色,給所有權限
$adminRole = Role::firstOrCreate(['name' => 'Admin']);
$adminRole->syncPermissions(Permission::all());
// 建立 User 角色,不給任何權限
Role::firstOrCreate(['name' => 'User']);
}
}

178
resources/lang/zh-TW.json Normal file
View File

@ -0,0 +1,178 @@
{
"api.api_token_manager": "resources/views/api/api-token-manager.blade.php"
,"Create API Token":"創建API令牌"
,"API tokens allow third-party services to authenticate with our application on your behalf.":"API 令牌允許第三方服務代表您透過我們的應用程式進行身份驗證。"
,"Token Name":"Token 名稱"
,"Permissions":"權限"
,"Created.":"已建立。"
,"Create":"創造"
,"Manage API Tokens":"管理 API Token"
,"You may delete any of your existing tokens if they are no longer needed.":"如果不再需要任何現有令牌,您可以將其刪除。"
,"Last used":"最後使用"
,"Delete":"刪除"
,"API Token":"API Token"
,"Please copy your new API token. For your security, it won't be shown again.":"請複製您的新 API token。為了您的安全它不會再次顯示。"
,"Close":"關閉"
,"API Token Permissions":"API token 權限"
,"Cancel":"取消"
,"Save":"儲存"
,"Delete API Token":"刪除 API token"
,"Are you sure you would like to delete this API token?":"您確定要刪除此 API token嗎"
,"api.index.blade": "resources/views/api/index.blade.php"
,"API Tokens":"API Tokens"
,"auth.confirm-password":"resources/views/auth/confirm-password.blade.php"
,"This is a secure area of the application. Please confirm your password before continuing.":"這是應用程式的安全區域。 請先確認您的密碼,然後再繼續。"
,"Confirm":"確認"
,"auth.forgot-password":"resources/views/auth/forgot-password.blade.php"
,"Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.":"忘記密碼了嗎? 沒問題。 只需告訴我們您的電子郵件地址,我們就會透過電子郵件向您發送密碼重設鏈接,您可以透過該連結選擇新密碼。"
,"Email Password Reset Link":"電子郵件密碼重設鏈接"
,"auth.login":"resources/views/auth/login.blade.php"
,"Email":"電子郵件"
,"Password":"密碼"
,"Remember me":"記住帳號"
,"Forgot your password?":"忘記密碼了嗎?"
,"Log in": "登入"
,"auth.register":"resources/views/auth/register.blade.php"
,"Name":"名稱"
,"I agree to the :terms_of_service and :privacy_policy":"我同意 :terms_of_service 和 :privacy_policy"
,"Confirm Password":"確認密碼"
,"Already registered?":"已經註冊?"
,"Register":"註冊"
,"auth.reset-password":"resources/views/auth/reset-password.blade.php"
,"Reset Password":"重新設密碼"
,"auth.two-factor-challenge":"resources/views/auth/two-factor-challenge.blade.php"
,"Please confirm access to your account by entering the authentication code provided by your authenticator application.":"請輸入驗證器應用程式提供的驗證碼來確認對您帳戶的存取。"
,"Please confirm access to your account by entering one of your emergency recovery codes.":"請輸入您的緊急恢復代碼之一來確認對您帳戶的訪問。"
,"Code":"代碼"
,"Recovery Code":"恢復代碼"
,"Use a recovery code":"使用恢復代碼"
,"Use an authentication code":"使用驗證碼"
,"auth.verify-email":"resources/views/auth/verify-email.blade.php"
,"Before continuing, could you verify your email address by clicking on the link we just emailed to you? If you didn't receive the email, we will gladly send you another.":"在繼續之前,您可以點擊我們剛剛發送到您郵箱的鏈接來驗證您的郵箱地址嗎?如果您沒有收到郵件,我們很樂意重新發送。"
,"A new verification link has been sent to the email address you provided in your profile settings.":"一個新的驗證鏈接已經發送到您在個人資料設置中提供的郵箱地址。"
,"Resend Verification Email":"重新發送驗證郵件"
,"Edit Profile":"修改個人資料"
,"Log Out": "登出"
,"components.confirms-password":"resources/views/components/confirms-password.blade.php"
,"For your security, please confirm your password to continue.":"為了您的安全,請確認您的密碼以繼續。"
,"components/validation-errors":"resources/views/components/validation-errors.blade.php"
,"Whoops! Something went wrong.":"哎呀! 出了些問題。"
,"emails.team-invitation":"resources/views/emails/team-invitation.blade.php"
,"You have been invited to join the :team team!":""
,"If you do not have an account, you may create one by clicking the button below. After creating an account, you may click the invitation acceptance button in this email to accept the team invitation:":""
,"Create Account":""
,"If you already have an account, you may accept this invitation by clicking the button below:":""
,"You may accept this invitation by clicking the button below:":""
,"Accept Invitation":""
,"If you did not expect to receive an invitation to this team, you may discard this email.":""
,"profile.connect-google-information":"resources/views/profile/connect-google-information.blade.php"
,"Link Google": "連結Google"
,"connect google information.": "連接Google資訊。"
,"currently there are google login options available.": "目前有可用的Google登入選項。"
,"profile.connect-line-information":"resources/views/profile/connect-line-information.blade.php"
,"Link Line": "連結Line"
,"connect line information.": "連接 Line 資訊。"
,"currently there are line login options available.": "目前有可用的Line登入選項。"
,"profile.delete-user-form":"resources/views/profile/delete-user-form.blade.php"
,"Delete Account":"刪除帳戶"
,"Permanently delete your account.":"永久刪除您的帳戶。"
,"Once your account is deleted, all of its resources and data will be permanently deleted. Before deleting your account, please download any data or information that you wish to retain.":"一旦您的帳戶被刪除,其所有資源和資料將永久刪除。 在刪除您的帳戶之前,請下載您希望保留的任何資料或資訊。"
,"Are you sure you want to delete your account? Once your account is deleted, all of its resources and data will be permanently deleted. Please enter your password to confirm you would like to permanently delete your account.":"您確定要刪除您的帳戶嗎? 一旦您的帳戶被刪除,其所有資源和資料將永久刪除。 請輸入您的密碼以確認您想要永久刪除您的帳戶。"
,"profile.logout-other-browser-sessions-form":"resources/views/profile/logout-other-browser-sessions-form.blade.php"
,"Browser Sessions":"瀏覽器會話"
,"Manage and log out your active sessions on other browsers and devices.":"管理並登出其他瀏覽器和裝置上的活動會話。"
,"If necessary, you may log out of all of your other browser sessions across all of your devices. Some of your recent sessions are listed below; however, this list may not be exhaustive. If you feel your account has been compromised, you should also update your password.":"如有必要,您可以在所有裝置上登出所有其他瀏覽器工作階段。下面列出了您最近的一些會話;但是,此清單可能並不詳盡。如果您認為您的帳戶已被盜用,您可以也應該更新您的密碼。"
,"Unknown":"未知"
,"This device":"這個設備"
,"Last active":"最後登入"
,"Log Out Other Browser Sessions":"登出其他瀏覽器會話"
,"Done.":"完畢。"
,"Please enter your password to confirm you would like to log out of your other browser sessions across all of your devices.":"請輸入您的密碼以確認您想要退出所有裝置上的其他瀏覽器會話。"
,"profile.show":"resources/views/profile/show.blade.php"
,"Profile":"檔案"
,"profile.two-factor-authentication-form":"resources/views/profile/two-factor-authentication-form.blade.php"
,"Two Factor Authentication":"雙重身份驗證"
,"Add additional security to your account using two factor authentication.":"使用兩因素身份驗證為您的帳戶添加額外的安全性。"
,"Finish enabling two factor authentication.":"完成啟用兩因素身份驗證。"
,"You have enabled two factor authentication.":"您已啟用兩因素身份驗證。"
,"You have not enabled two factor authentication.":"您尚未啟用兩因素身份驗證。"
,"When two factor authentication is enabled, you will be prompted for a secure, random token during authentication. You may retrieve this token from your phone's Google Authenticator application.":"啟用兩因素身份驗證後,系統將在身份驗證過程中提示您輸入安全的隨機令牌。 您可以從手機的 Google 身份驗證器應用程式中檢索此令牌。"
,"To finish enabling two factor authentication, scan the following QR code using your phone's authenticator application or enter the setup key and provide the generated OTP code.":"若要完成啟用兩因素身份驗證,請使用手機的身份驗證器應用程式掃描以下二維碼,或輸入設定密鑰並提供產生的 OTP 代碼。"
,"Two factor authentication is now enabled. Scan the following QR code using your phone's authenticator application or enter the setup key.":"現已啟用兩因素身份驗證。 使用手機的驗證器應用程式掃描以下二維碼或輸入設定金鑰。"
,"Setup Key":"設定 Key"
,"Store these recovery codes in a secure password manager. They can be used to recover access to your account if your two factor authentication device is lost.":"將這些恢復代碼儲存在安全的密碼管理器中。 如果您的雙重認證裝置遺失,它們可用於恢復對您帳戶的存取權限。"
,"Enable":"啟用"
,"Regenerate Recovery Codes":"重新產生恢復程式碼"
,"Show Recovery Codes":"顯示恢復代碼"
,"Disable":"停用"
,"profile.update-password-form":"resources/views/profile/update-password-form.blade.php"
,"Update Password":"更新密碼"
,"Ensure your account is using a long, random password to stay secure.":"確保您的帳戶使用長的隨機密碼以確保安全。"
,"Current Password":"目前密碼"
,"New Password":"新密碼"
,"Saved.":"已儲存。"
,"profile.update-profile-information-form":"resources/views/profile/update-profile-information-form.blade.php"
,"Profile Information":"檔案資訊"
,"Update your account's profile information and email address.":"更新您帳戶的個人資料資訊和電子郵件地址。"
,"Photo":"照片"
,"Select A New Photo":"選擇一張新照片"
,"Remove Photo":"刪除照片"
,"Your email address is unverified.":"您的電子郵件地址未經驗證。"
,"Click here to re-send the verification email.":"點擊此處重新發送驗證郵件。"
,"A new verification link has been sent to your email address.":"新的驗證連結已發送到您的電子郵件地址。"
,"Male": "男性"
,"Female": "女性"
,"Other": "中性"
,"teams.create-team-form":"resources/views/teams/create-team-form.blade.php"
,"Team Details":"團隊詳細資料"
,"Create a new team to collaborate with others on projects.":"創建一個新團隊與其他人就專案進行協作。"
,"Team Owner":"團隊負責人"
,"Team Name":"隊名"
,"teams.create":"resources/views/teams/create.blade.php"
,"Create Team":"創建團隊"
,"teams.delete-team-form":"resources/views/teams/delete-team-form.blade.php"
,"Delete Team":"刪除團隊"
,"Permanently delete this team.":"永久刪除該團隊。"
,"Once a team is deleted, all of its resources and data will be permanently deleted. Before deleting this team, please download any data or information regarding this team that you wish to retain.":"團隊一旦被刪除,其所有資源和資料都將被永久刪除。刪除該團隊之前,請下載您希望保留的有關該團隊的任何資料或資訊。"
,"Are you sure you want to delete this team? Once a team is deleted, all of its resources and data will be permanently deleted.":"您確定要刪除該團隊嗎?一旦刪除團隊,團隊的所有資源和資料都將永久刪除。"
,"teams.show":"resources/views/teams/show.blade.php"
,"Team Settings":"團隊設定"
,"teams.team-member-manager":"resources/views/teams/team-member-manager.blade.php"
,"Add Team Member":"新增團隊成員"
,"Add a new team member to your team, allowing them to collaborate with you.":"為您的團隊增加新的團隊成員,讓他們能夠與您協作。"
,"Please provide the email address of the person you would like to add to this team.":"請提供您想要新增至此團隊的人員的電子郵件地址。"
,"Role":"角色"
,"Added.":"添加。"
,"Add":"添加"
,"Pending Team Invitations":"待處理的團隊邀請"
,"These people have been invited to your team and have been sent an invitation email. They may join the team by accepting the email invitation.":"這些人已被邀請加入您的團隊,並已收到邀請電子郵件。他們可以透過接受電子郵件邀請加入團隊。"
,"Team Members":"團隊成員"
,"All of the people that are part of this team.":"這個團隊的所有成員。"
,"Leave":"離開"
,"Remove":"消除"
,"Manage Role":"管理角色"
,"Leave Team":"離開隊伍"
,"Are you sure you would like to leave this team?":"您確定要離開這個團隊嗎?"
,"Remove Team Member":"刪除團隊成員"
,"Are you sure you would like to remove this person from the team?":"您確定要將此人從團隊中刪除嗎?"
,"teams.update-team-name-form":"resources/views/teams/update-team-name-form.blade.php"
,"The team's name and owner information.":"團隊名稱和所有者資訊。"
,"dashboard":"resources/views/dashboard.blade.php"
,"Dashboard":"主頁"
,"navigation-menu":"resources/views/navigation-menu.blade.php"
,"Manage Team":"管理團隊"
,"Create New Team":"創建新團隊"
,"Switch Teams":"切換團隊"
,"welcome":"resources/views/welcome.blade.php"
,"Back Home": "回首頁"
,"Phone":"手機門號"
,"Address":"地址"
,"Email or Phone":"電子郵件 / 手機門號"
,"Terms of Service":"服務條款"
,"Privacy Policy":"隱私權政策"
,"Manage Account":"管理帳號"
}

View File

@ -0,0 +1,20 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => '這些憑證與我們的記錄不符。',
'password' => '提供的密碼不正確。',
'throttle' => '登入嘗試次數過多。 請在 :seconds 秒後重試。',
];

View File

@ -0,0 +1,19 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '&laquo; 以前的',
'next' => '下一個 &raquo;',
];

View File

@ -0,0 +1,22 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'reset' => '您的密碼已重設。',
'sent' => '我們已透過電子郵件發送您的密碼重設連結。',
'throttled' => '請稍候再重試。',
'token' => '此密碼重設令牌無效。',
'user' => "我們找不到具有該電子郵件地址的使用者。",
];

View File

@ -0,0 +1,191 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => ':attribute 欄位必須被接受。',
'accepted_if' => '當 :other 是 :value 時,:attribute 欄位必須被接受。',
'active_url' => ':attribute 欄位必須是有效的網址。',
'after' => ':attribute 欄位必須是 :date 之後的日期。',
'after_or_equal' => ':attribute 欄位必須是日期 :date 或之後。',
'alpha' => ':attribute 欄位只能包含字母。',
'alpha_dash' => ':attribute 欄位只能包含字母、數字、破折號和底線。',
'alpha_num' => ':attribute 欄位只能包含字母和數字。',
'array' => ':attribute 欄位必須是陣列。',
'ascii' => ':attribute 欄位必須只包含單字節的字母數字字符和符號。',
'before' => ':attribute 欄位必須是 :date 之前的日期。',
'before_or_equal' => ':attribute 欄位必須是日期 :date 或之前。',
'between' => [
'array' => ':attribute 欄位必須包含 :min 到 :max 個項目。',
'file' => ':attribute 欄位必須在 :min 到 :max KB 之間。',
'numeric' => ':attribute 欄位必須在 :min 到 :max 之間。',
'string' => ':attribute 欄位必須在 :min 到 :max 個字元之間。',
],
'boolean' => ':attribute 欄位必須是 true 或 false。',
'can' => ':attribute 欄位包含未授權的值。',
'confirmed' => ':attribute 欄位確認不匹配。',
'current_password' => '密碼不正確。',
'date' => ':attribute 欄位必須是有效的日期。',
'date_equals' => ':attribute 欄位必須是日期 :date。',
'date_format' => ':attribute 欄位必須符合格式 :format。',
'decimal' => ':attribute 欄位必須有 :decimal 位小數。',
'declined' => ':attribute 欄位必須被拒絕。',
'declined_if' => '當 :other 為 :value 時,:attribute 欄位必須被拒絕。',
'different' => ':attribute 欄位和 :other 必須不同。',
'digits' => ':attribute 欄位必須是 :digits 位數字。',
'digits_between' => ':attribute 欄位必須在 :min 到 :max 位數字之間。',
'dimensions' => ':attribute 欄位的圖片尺寸無效。',
'distinct' => ':attribute 欄位具有重複值。',
'doesnt_end_with' => ':attribute 欄位不能以以下任何一個結尾: :values。',
'doesnt_start_with' => ':attribute 欄位不能以以下任何一個開頭: :values。',
'email' => ':attribute 欄位必須是有效的電子郵件地址。',
'ends_with' => ':attribute 欄位必須以以下之一結尾: :values。',
'enum' => '選擇的 :attribute 無效。',
'exists' => '所選的 :attribute 無效。',
'extensions' => ':attribute 欄位必須具有以下擴展名之一: :values。',
'file' => ':attribute 欄位必須是文件。',
'filled' => ':attribute 欄位必須有值。',
'gt' => [
'array' => ':attribute 欄位必須包含多於 :value 個項目。',
'file' => ':attribute 欄位必須大於 :value KB。',
'numeric' => ':attribute 欄位必須大於 :value。',
'string' => ':attribute 欄位必須多於 :value 個字符。',
],
'gte' => [
'array' => ':attribute 欄位必須包含 :value 個項目或更多。',
'file' => ':attribute 欄位必須大於或等於 :value KB。',
'numeric' => ':attribute 欄位必須大於或等於 :value。',
'string' => ':attribute 欄位必須大於或等於 :value 個字符。',
],
'hex_color' => ':attribute 欄位必須是有效的十六進制顏色。',
'image' => ':attribute 欄位必須是圖片。',
'in' => '所選的 :attribute 無效。',
'in_array' => ':attribute 欄位必須存在於 :other 中。',
'integer' => ':attribute 欄位必須是整數。',
'ip' => ':attribute 欄位必須是有效的 IP 地址。',
'ipv4' => ':attribute 欄位必須是有效的 IPv4 地址。',
'ipv6' => ':attribute 欄位必須是有效的 IPv6 地址。',
'json' => ':attribute 欄位必須是有效的 JSON 字串。',
'lowercase' => ':attribute 欄位必須是小寫。',
'lt' => [
'array' => ':attribute 欄位必須包含少於 :value 個項目。',
'file' => ':attribute 欄位必須小於 :value KB。',
'numeric' => ':attribute 欄位必須小於 :value。',
'string' => ':attribute 欄位必須少於 :value 個字符。',
],
'lte' => [
'array' => ':attribute 欄位不能包含多於 :value 個項目。',
'file' => ':attribute 欄位必須小於或等於 :value KB。',
'numeric' => ':attribute 欄位必須小於或等於 :value。',
'string' => ':attribute 欄位必須小於或等於 :value 個字符。',
],
'mac_address' => ':attribute 欄位必須是有效的 MAC 地址。',
'max' => [
'array' => ':attribute 欄位不能超過 :max 個項目。',
'file' => ':attribute 欄位不能大於 :max KB。',
'numeric' => ':attribute 欄位不能大於 :max。',
'string' => ':attribute 欄位不能多於 :max 個字元。',
],
'max_digits' => ':attribute 欄位不能超過 :max 位數字。',
'mimes' => ':attribute 欄位必須是以下類型的文件: :values。',
'mimetypes' => ':attribute 欄位必須是以下類型的文件: :values。',
'min' => [
'array' => ':attribute 欄位至少要有 :min 個項目。',
'file' => ':attribute 欄位至少要有 :min KB。',
'numeric' => ':attribute 欄位至少要有 :min。',
'string' => ':attribute 欄位至少要有 :min 個字元。',
],
'min_digits' => ':attribute 欄位必須至少有 :min 位數字。',
'missing' => ':attribute 欄位必須缺失。',
'missing_if' => '當 :other 是 :value 時,:attribute 欄位必須缺失。',
'missing_unless' => '除非 :other 是 :value否則 :attribute 欄位必須缺失。',
'missing_with' => '當 :values 存在時,:attribute 欄位必須缺失。',
'missing_with_all' => '當 :values 存在時,:attribute 欄位必須缺失。',
'multiple_of' => ':attribute 欄位必須是 :value 的倍數。',
'not_in' => '所選的 :attribute 無效。',
'not_regex' => ':attribute 欄位格式無效。',
'numeric' => ':attribute 欄位必須是數字。',
'password' => [
'letters' => ':attribute 欄位必須包含至少一個字母。',
'mixed' => ':attribute 欄位必須包含至少一個大寫字母和一個小寫字母。',
'numbers' => ':attribute 欄位必須包含至少一個數字。',
'symbols' => ':attribute 欄位必須包含至少一個符號。',
'uncompromised' => '給定的 :attribute 已出現在數據洩露中。請選擇一個不同的 :attribute。',
],
'present' => ':attribute 欄位必須存在。',
'present_if' => '當 :other 是 :value 時,:attribute 欄位必須存在。',
'present_unless' => '除非 :other 是 :value否則 :attribute 欄位必須存在。',
'present_with' => '當 :values 存在時,:attribute 欄位必須存在。',
'present_with_all' => '當 :values 存在時,:attribute 欄位必須存在。',
'prohibited' => ':attribute 欄位被禁止。',
'prohibited_if' => '當 :other 是 :value 時,:attribute 欄位被禁止。',
'prohibited_unless' => '除非 :other 在 :values 中,否則 :attribute 欄位被禁止。',
'prohibits' => ':attribute 欄位禁止 :other 存在。',
'regex' => ':attribute 欄位格式無效。',
'required' => ':attribute 欄位是必填的。',
'required_array_keys' => ':attribute 欄位必須包含以下鍵的條目: :values。',
'required_if' => '當 :other 是 :value 時,:attribute 欄位是必填的。',
'required_if_accepted' => '當 :other 被接受時,:attribute 欄位是必需的。',
'required_unless' => '除非 :other 在 :values 中,否則 :attribute 欄位是必填的。',
'required_with' => '當 :values 存在時,:attribute 欄位是必填的。',
'required_with_all' => '當 :values 存在時,:attribute 欄位是必填的。',
'required_without' => '當 :values 不存在時,:attribute 欄位是必填的。',
'required_without_all' => '當 :values 都不存在時,:attribute 欄位是必填的。',
'same' => ':attribute 欄位必須與 :other 相匹配。',
'size' => [
'array' => ':attribute 欄位必須包含 :size 個項目。',
'file' => ':attribute 欄位必須是 :size KB。',
'numeric' => ':attribute 欄位必須是 :size。',
'string' => ':attribute 欄位必須是 :size 個字元。',
],
'starts_with' => ':attribute 欄位必須以以下任何一個開頭: :values。',
'string' => ':attribute 欄位必須是字串。',
'timezone' => ':attribute 欄位必須是有效的時區。',
'unique' => ':attribute 已經被使用。',
'uploaded' => ':attribute 上傳失敗。',
'uppercase' => ':attribute 欄位必須是大寫。',
'url' => ':attribute 欄位必須是有效的網址。',
'ulid' => ':attribute 欄位必須是有效的 ULID。',
'uuid' => ':attribute 欄位必須是有效的 UUID。',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [],
];

View File

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel Admin') }}</title>
<!-- 字型 & CSS -->
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
<!-----------------------------------------------------------
-- animate.min.css by Daniel Eden (https://animate.style)
-- is required for the animation of notifications and slide out panels
-- you can ignore this step if you already have this file in your project
--------------------------------------------------------------------------->
<link href="{{ asset('vendor/bladewind/css/animate.min.css') }}" rel="stylesheet" />
<link href="{{ asset('vendor/bladewind/css/bladewind-ui.min.css') }}" rel="stylesheet" />
<script src="{{ asset('vendor/bladewind/js/helpers.js') }}"></script>
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@livewireStyles
</head>
<body class="bg-gray-100 text-gray-800">
@auth
<div class="flex min-h-screen">
{{-- Sidebar --}}
<livewire:layout.admin.sidebar />
<div class="flex-1 flex flex-col">
{{-- Top nav --}}
<livewire:layout.admin.navigation />
{{-- Page content --}}
<main class="p-6">
{{ $slot }}
</main>
</div>
</div>
@else
<main class="p-6">
{{ $slot }}
</main>
@endauth
@livewireScripts
</body>
</html>

View File

@ -13,10 +13,11 @@
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
@livewireStyles
</head>
<body class="font-sans antialiased">
<div class="min-h-screen bg-gray-100">
<livewire:layout.navigation />
<livewire:layout.app.navigation />
<!-- Page Heading -->
@if (isset($header))
@ -32,5 +33,6 @@
{{ $slot }}
</main>
</div>
@livewireScripts
</body>
</html>

View File

@ -0,0 +1,3 @@
<div>
{{-- To attain knowledge, add things every day; To attain wisdom, subtract things every day. --}}
</div>

View File

@ -0,0 +1,110 @@
<?php
use App\Livewire\Actions\Logout;
use Livewire\Volt\Component;
new class extends Component
{
/**
* Log the current user out of the application.
*/
public function logout(Logout $logout): void
{
$logout();
$this->redirect('/', navigate: true);
}
}; ?>
<nav x-data="{ open: false }" class="bg-white border-b border-gray-100">
<!-- Primary Navigation Menu -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('admin.dashboard') }}" wire:navigate>
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('admin.dashboard')" :active="request()->routeIs('admin.dashboard')" wire:navigate>
{{ __('Dashboard') }}
</x-nav-link>
</div>
</div>
<!-- Settings Dropdown -->
<div class="hidden sm:flex sm:items-center sm:ms-6">
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 bg-white hover:text-gray-700 focus:outline-none transition ease-in-out duration-150">
<div x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</div>
</button>
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('profile')" wire:navigate>
{{ __('Profile') }}
</x-dropdown-link>
<!-- Authentication -->
<button wire:click="logout" class="w-full text-start">
<x-dropdown-link>
{{ __('Log Out') }}
</x-dropdown-link>
</button>
</x-slot>
</x-dropdown>
</div>
<!-- Hamburger -->
<div class="-me-2 flex items-center sm:hidden">
<button @click="open = ! open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 focus:text-gray-500 transition duration-150 ease-in-out">
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
<path :class="{'hidden': open, 'inline-flex': ! open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
<path :class="{'hidden': ! open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
</div>
</div>
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')" wire:navigate>
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200">
<div class="px-4">
<div class="font-medium text-base text-gray-800" x-data="{{ json_encode(['name' => auth()->user()->name]) }}" x-text="name" x-on:profile-updated.window="name = $event.detail.name"></div>
<div class="font-medium text-sm text-gray-500">{{ auth()->user()->email }}</div>
</div>
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile')" wire:navigate>
{{ __('Profile') }}
</x-responsive-nav-link>
<!-- Authentication -->
<button wire:click="logout" class="w-full text-start">
<x-responsive-nav-link>
{{ __('Log Out') }}
</x-responsive-nav-link>
</button>
</div>
</div>
</div>
</nav>

View File

@ -0,0 +1,28 @@
@php
use Illuminate\Support\Facades\Auth;
$menus = [
['label' => 'Dashboard', 'route' => 'admin.dashboard', 'icon' => 'home', 'permission' => null],
];
@endphp
<aside class="w-64 bg-white border-r">
<div class="p-4 font-bold text-lg border-b">
管理後台
</div>
<nav class="mt-4">
@foreach ($menus as $menu)
@if (!$menu['permission'] || Auth::user()->can($menu['permission']))
<a href="{{ route($menu['route']) }}"
class="flex items-center px-4 py-2 text-gray-700 hover:bg-gray-100 {{ request()->routeIs($menu['route']) ? 'bg-gray-100 font-semibold' : '' }}">
<span class="material-icons-outlined mr-2">
{{ $menu['icon'] }}
</span>
{{ $menu['label'] }}
</a>
@endif
@endforeach
</nav>
</aside>

View File

@ -20,7 +20,13 @@ new #[Layout('layouts.guest')] class extends Component
Session::regenerate();
$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
//$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
$user = auth()->user();
if ($user->hasRole('Admin')) {
$this->redirect(route('admin.dashboard'), navigate: true);
} else {
$this->redirect(route('dashboard'), navigate: true);
}
}
}; ?>

View File

@ -30,6 +30,8 @@ new #[Layout('layouts.guest')] class extends Component
event(new Registered($user = User::create($validated)));
$user->assignRole('user'); // ✅ 指定預設角色為 user
Auth::login($user);
$this->redirect(route('dashboard', absolute: false), navigate: true);

View File

@ -11,7 +11,7 @@
href="{{ route('login') }}"
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
>
Log in
登入
</a>
@if (Route::has('register'))
@ -19,7 +19,7 @@
href="{{ route('register') }}"
class="rounded-md px-3 py-2 text-black ring-1 ring-transparent transition hover:text-black/70 focus:outline-none focus-visible:ring-[#FF2D20] dark:text-white dark:hover:text-white/80 dark:focus-visible:ring-white"
>
Register
註冊
</a>
@endif
@endauth

View File

@ -2,6 +2,8 @@
use Illuminate\Support\Facades\Route;
use App\Livewire\Admin\Dashboard as AdminDashboard;
Route::view('/', 'welcome');
Route::view('dashboard', 'dashboard')
@ -13,3 +15,7 @@ Route::view('profile', 'profile')
->name('profile');
require __DIR__.'/auth.php';
Route::middleware(['auth'])->prefix('admin')->name('admin.')->group(function () {
Route::get('/dashboard', AdminDashboard::class)->name('dashboard');
});