├── .DS_Store ├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── app ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── AnalysisController.php │ │ ├── Api │ │ │ └── AnalysisController.php │ │ ├── Auth │ │ │ ├── AuthenticatedSessionController.php │ │ │ ├── ConfirmablePasswordController.php │ │ │ ├── EmailVerificationNotificationController.php │ │ │ ├── EmailVerificationPromptController.php │ │ │ ├── NewPasswordController.php │ │ │ ├── PasswordResetLinkController.php │ │ │ ├── RegisteredUserController.php │ │ │ └── VerifyEmailController.php │ │ ├── Controller.php │ │ ├── CustomerController.php │ │ ├── InertiaTestController.php │ │ ├── ItemController.php │ │ └── PurchaseController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── HandleInertiaRequests.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php │ └── Requests │ │ ├── Auth │ │ └── LoginRequest.php │ │ ├── StoreCustomerRequest.php │ │ ├── StoreItemRequest.php │ │ ├── StorePurchaseRequest.php │ │ ├── UpdateCustomerRequest.php │ │ ├── UpdateItemRequest.php │ │ └── UpdatePurchaseRequest.php ├── Models │ ├── Customer.php │ ├── InertiaTest.php │ ├── Item.php │ ├── Order.php │ ├── Purchase.php │ ├── Scopes │ │ └── Subtotal.php │ └── User.php ├── Policies │ ├── CustomerPolicy.php │ ├── ItemPolicy.php │ └── PurchasePolicy.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php └── Services │ ├── AnalysisService.php │ ├── DecileService.php │ └── RFMService.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ ├── CustomerFactory.php │ ├── ItemFactory.php │ ├── PurchaseFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2022_07_25_155035_create_inertia_tests_table.php │ ├── 2022_08_02_151056_create_items_table.php │ ├── 2022_08_08_115719_create_customers_table.php │ ├── 2022_08_16_125422_create_purchases_table.php │ ├── 2022_08_17_112754_create_item_purchase_table.php │ └── 2022_09_03_043755_create_ranks_table.php └── seeders │ ├── CustomerSeeder.php │ ├── DatabaseSeeder.php │ ├── ItemSeeder.php │ ├── PurchaseSeeder.php │ ├── RankSeeder.php │ └── UserSeeder.php ├── jsconfig.json ├── lang ├── en │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php └── ja │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── postcss.config.js ├── public ├── .DS_Store ├── .htaccess ├── favicon.ico ├── images │ └── logo.png ├── index.php └── robots.txt ├── resources ├── css │ ├── app.css │ └── micromodal.css ├── js │ ├── Components │ │ ├── ApplicationLogo.vue │ │ ├── Button.vue │ │ ├── Chart.vue │ │ ├── Checkbox.vue │ │ ├── Dropdown.vue │ │ ├── DropdownLink.vue │ │ ├── FlashMessage.vue │ │ ├── Input.vue │ │ ├── InputError.vue │ │ ├── Label.vue │ │ ├── MicroModal.vue │ │ ├── NavLink.vue │ │ ├── Pagination.vue │ │ ├── ResponsiveNavLink.vue │ │ ├── ResultTable.vue │ │ └── ValidationErrors.vue │ ├── Layouts │ │ ├── Authenticated.vue │ │ └── Guest.vue │ ├── Pages │ │ ├── Analysis.vue │ │ ├── Auth │ │ │ ├── ConfirmPassword.vue │ │ │ ├── ForgotPassword.vue │ │ │ ├── Login.vue │ │ │ ├── Register.vue │ │ │ ├── ResetPassword.vue │ │ │ └── VerifyEmail.vue │ │ ├── ComponentTest.vue │ │ ├── Customers │ │ │ ├── Create.vue │ │ │ ├── Index.vue │ │ │ └── Index_test.vue │ │ ├── Dashboard.vue │ │ ├── Inertia │ │ │ ├── Create.vue │ │ │ ├── Index.vue │ │ │ └── Show.vue │ │ ├── InertiaTest.vue │ │ ├── Items │ │ │ ├── Create.vue │ │ │ ├── Edit.vue │ │ │ ├── Index.vue │ │ │ └── Show.vue │ │ ├── Purchases │ │ │ ├── Create.vue │ │ │ ├── Create_bak.vue │ │ │ ├── Edit.vue │ │ │ ├── Index.vue │ │ │ └── Show.vue │ │ └── Welcome.vue │ ├── app.js │ ├── bootstrap.js │ ├── common.js │ └── micromodal.js └── views │ ├── app.blade.php │ └── welcome.blade.php ├── routes ├── api.php ├── auth.php ├── channels.php ├── console.php └── web.php ├── storage ├── .DS_Store ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── debugbar │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ ├── Auth │ │ ├── AuthenticationTest.php │ │ ├── EmailVerificationTest.php │ │ ├── PasswordConfirmationTest.php │ │ ├── PasswordResetTest.php │ │ └── RegistrationTest.php │ └── ExampleTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── vite.config.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aokitashipro/laravel_uCRM/0ff5a9087ead6c6c7b6d938c0634e84fe0355602/.DS_Store -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | 60 | SANCTUM_STATEFUL_DOMAINS=localhost:8000 61 | SESSION_DOMAIN=localhost -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .phpunit.result.cache 10 | Homestead.json 11 | Homestead.yaml 12 | auth.json 13 | npm-debug.log 14 | yarn-error.log 15 | /.idea 16 | /.vscode 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | udemy向け簡易的なCRM(顧客管理システム)のコードになります。
2 | 関連記事: https://coinbaby8.com/vuejs3-laravel-crm.html
3 | 4 | ## インストール 5 | composer install
6 | npm install && npm run dev
7 | .env.exampleを .envにコピー
8 | .envのDB関連、sanctum, sessionなどの情報を編集
9 | php artisan key:generate
10 | 11 | ## 開発中の簡易サーバー 12 | サーバー側
13 | php artisan serve
14 | 15 | フロント側 (vite)
16 | npm run dev
17 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/AnalysisController.php: -------------------------------------------------------------------------------- 1 | startDate, $request->endDate); 19 | 20 | if($request->type === 'perDay'){ 21 | list($data, $labels, $totals) = AnalysisService::perDay($subQuery); 22 | } 23 | 24 | if($request->type === 'perMonth'){ 25 | list($data, $labels, $totals) = AnalysisService::perMonth($subQuery); 26 | } 27 | 28 | if($request->type === 'perYear'){ 29 | list($data, $labels, $totals) = AnalysisService::perYear($subQuery); 30 | } 31 | 32 | if($request->type === 'decile'){ 33 | list($data, $labels, $totals) = DecileService::decile($subQuery); 34 | } 35 | 36 | if($request->type === 'rfm'){ 37 | list($data, $totals, $eachCount) = RFMService::rfm($subQuery, $request->rfmPrms); 38 | 39 | return response()->json([ 40 | 'data' => $data, 41 | 'type' => $request->type, 42 | 'eachCount' => $eachCount, 43 | 'totals' => $totals, 44 | ], Response::HTTP_OK); 45 | 46 | } 47 | return response()->json([ 48 | 'data' => $data, 49 | 'type' => $request->type, 50 | 'labels' => $labels, 51 | 'totals' => $totals, 52 | ], Response::HTTP_OK); 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/AuthenticatedSessionController.php: -------------------------------------------------------------------------------- 1 | Route::has('password.request'), 24 | 'status' => session('status'), 25 | ]); 26 | } 27 | 28 | /** 29 | * Handle an incoming authentication request. 30 | * 31 | * @param \App\Http\Requests\Auth\LoginRequest $request 32 | * @return \Illuminate\Http\RedirectResponse 33 | */ 34 | public function store(LoginRequest $request) 35 | { 36 | $request->authenticate(); 37 | 38 | $request->session()->regenerate(); 39 | 40 | return redirect()->intended(RouteServiceProvider::HOME); 41 | } 42 | 43 | /** 44 | * Destroy an authenticated session. 45 | * 46 | * @param \Illuminate\Http\Request $request 47 | * @return \Illuminate\Http\RedirectResponse 48 | */ 49 | public function destroy(Request $request) 50 | { 51 | Auth::guard('web')->logout(); 52 | 53 | $request->session()->invalidate(); 54 | 55 | $request->session()->regenerateToken(); 56 | 57 | return redirect('/'); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ConfirmablePasswordController.php: -------------------------------------------------------------------------------- 1 | validate([ 33 | 'email' => $request->user()->email, 34 | 'password' => $request->password, 35 | ])) { 36 | throw ValidationException::withMessages([ 37 | 'password' => __('auth.password'), 38 | ]); 39 | } 40 | 41 | $request->session()->put('auth.password_confirmed_at', time()); 42 | 43 | return redirect()->intended(RouteServiceProvider::HOME); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationNotificationController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 20 | return redirect()->intended(RouteServiceProvider::HOME); 21 | } 22 | 23 | $request->user()->sendEmailVerificationNotification(); 24 | 25 | return back()->with('status', 'verification-link-sent'); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/EmailVerificationPromptController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail() 21 | ? redirect()->intended(RouteServiceProvider::HOME) 22 | : Inertia::render('Auth/VerifyEmail', ['status' => session('status')]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/NewPasswordController.php: -------------------------------------------------------------------------------- 1 | $request->email, 27 | 'token' => $request->route('token'), 28 | ]); 29 | } 30 | 31 | /** 32 | * Handle an incoming new password request. 33 | * 34 | * @param \Illuminate\Http\Request $request 35 | * @return \Illuminate\Http\RedirectResponse 36 | * 37 | * @throws \Illuminate\Validation\ValidationException 38 | */ 39 | public function store(Request $request) 40 | { 41 | $request->validate([ 42 | 'token' => 'required', 43 | 'email' => 'required|email', 44 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 45 | ]); 46 | 47 | // Here we will attempt to reset the user's password. If it is successful we 48 | // will update the password on an actual user model and persist it to the 49 | // database. Otherwise we will parse the error and return the response. 50 | $status = Password::reset( 51 | $request->only('email', 'password', 'password_confirmation', 'token'), 52 | function ($user) use ($request) { 53 | $user->forceFill([ 54 | 'password' => Hash::make($request->password), 55 | 'remember_token' => Str::random(60), 56 | ])->save(); 57 | 58 | event(new PasswordReset($user)); 59 | } 60 | ); 61 | 62 | // If the password was successfully reset, we will redirect the user back to 63 | // the application's home authenticated view. If there is an error we can 64 | // redirect them back to where they came from with their error message. 65 | if ($status == Password::PASSWORD_RESET) { 66 | return redirect()->route('login')->with('status', __($status)); 67 | } 68 | 69 | throw ValidationException::withMessages([ 70 | 'email' => [trans($status)], 71 | ]); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordResetLinkController.php: -------------------------------------------------------------------------------- 1 | session('status'), 22 | ]); 23 | } 24 | 25 | /** 26 | * Handle an incoming password reset link request. 27 | * 28 | * @param \Illuminate\Http\Request $request 29 | * @return \Illuminate\Http\RedirectResponse 30 | * 31 | * @throws \Illuminate\Validation\ValidationException 32 | */ 33 | public function store(Request $request) 34 | { 35 | $request->validate([ 36 | 'email' => 'required|email', 37 | ]); 38 | 39 | // We will send the password reset link to this user. Once we have attempted 40 | // to send the link, we will examine the response then see the message we 41 | // need to show to the user. Finally, we'll send out a proper response. 42 | $status = Password::sendResetLink( 43 | $request->only('email') 44 | ); 45 | 46 | if ($status == Password::RESET_LINK_SENT) { 47 | return back()->with('status', __($status)); 48 | } 49 | 50 | throw ValidationException::withMessages([ 51 | 'email' => [trans($status)], 52 | ]); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisteredUserController.php: -------------------------------------------------------------------------------- 1 | validate([ 38 | 'name' => 'required|string|max:255', 39 | 'email' => 'required|string|email|max:255|unique:users', 40 | 'password' => ['required', 'confirmed', Rules\Password::defaults()], 41 | ]); 42 | 43 | $user = User::create([ 44 | 'name' => $request->name, 45 | 'email' => $request->email, 46 | 'password' => Hash::make($request->password), 47 | ]); 48 | 49 | event(new Registered($user)); 50 | 51 | Auth::login($user); 52 | 53 | return redirect(RouteServiceProvider::HOME); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/VerifyEmailController.php: -------------------------------------------------------------------------------- 1 | user()->hasVerifiedEmail()) { 21 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 22 | } 23 | 24 | if ($request->user()->markEmailAsVerified()) { 25 | event(new Verified($request->user())); 26 | } 27 | 28 | return redirect()->intended(RouteServiceProvider::HOME.'?verified=1'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | get(); 21 | // $getPaginate = Customer::select('id', 'name', 'kana', 'tel')->paginate(50); 22 | 23 | // dd($getTest, $getPaginate); 24 | 25 | $customers = Customer::searchCustomers($request->search) 26 | ->select('id', 'name', 'kana', 'tel')->paginate(50); 27 | 28 | // dd($customers); 29 | 30 | return Inertia::render('Customers/Index', [ 31 | 'customers' => $customers 32 | ]); 33 | } 34 | 35 | /** 36 | * Show the form for creating a new resource. 37 | * 38 | * @return \Illuminate\Http\Response 39 | */ 40 | public function create() 41 | { 42 | return Inertia::render('Customers/Create'); 43 | } 44 | 45 | /** 46 | * Store a newly created resource in storage. 47 | * 48 | * @param \App\Http\Requests\StoreCustomerRequest $request 49 | * @return \Illuminate\Http\Response 50 | */ 51 | public function store(StoreCustomerRequest $request) 52 | { 53 | Customer::create([ 54 | 'name' => $request->name, 55 | 'kana' => $request->kana, 56 | 'tel' => $request->tel, 57 | 'email' => $request->email, 58 | 'postcode' => $request->postcode, 59 | 'address' => $request->address, 60 | 'birthday' => $request->birthday, 61 | 'gender' => $request->gender, 62 | 'memo' => $request->memo, 63 | ]); 64 | 65 | return to_route('customers.index') 66 | ->with([ 67 | 'message' => '登録しました。', 68 | 'status' => 'success' 69 | ]); 70 | 71 | } 72 | 73 | /** 74 | * Display the specified resource. 75 | * 76 | * @param \App\Models\Customer $customer 77 | * @return \Illuminate\Http\Response 78 | */ 79 | public function show(Customer $customer) 80 | { 81 | // 82 | } 83 | 84 | /** 85 | * Show the form for editing the specified resource. 86 | * 87 | * @param \App\Models\Customer $customer 88 | * @return \Illuminate\Http\Response 89 | */ 90 | public function edit(Customer $customer) 91 | { 92 | // 93 | } 94 | 95 | /** 96 | * Update the specified resource in storage. 97 | * 98 | * @param \App\Http\Requests\UpdateCustomerRequest $request 99 | * @param \App\Models\Customer $customer 100 | * @return \Illuminate\Http\Response 101 | */ 102 | public function update(UpdateCustomerRequest $request, Customer $customer) 103 | { 104 | // 105 | } 106 | 107 | /** 108 | * Remove the specified resource from storage. 109 | * 110 | * @param \App\Models\Customer $customer 111 | * @return \Illuminate\Http\Response 112 | */ 113 | public function destroy(Customer $customer) 114 | { 115 | // 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /app/Http/Controllers/InertiaTestController.php: -------------------------------------------------------------------------------- 1 | InertiaTest::all() 15 | ]); 16 | } 17 | 18 | public function create() 19 | { 20 | return Inertia::render('Inertia/Create'); 21 | } 22 | 23 | public function show($id) 24 | { 25 | // dd($id); 26 | return Inertia::render('Inertia/Show', 27 | [ 28 | 'id' => $id, 29 | 'blog' => InertiaTest::findOrFail($id) 30 | ]); 31 | } 32 | 33 | public function store(Request $request) 34 | { 35 | 36 | $request->validate([ 37 | 'title' => ['required', 'max:20'], 38 | 'content' => ['required'], 39 | ]); 40 | 41 | $inertiaTest = new InertiaTest; 42 | $inertiaTest->title = $request->title; 43 | $inertiaTest->content = $request->content; 44 | $inertiaTest->save(); 45 | 46 | return to_route('inertia.index') 47 | ->with([ 48 | 'message' => '登録しました。' 49 | ]); 50 | } 51 | 52 | public function delete($id) 53 | { 54 | $book = InertiaTest::findOrFail($id); 55 | $book->delete(); 56 | 57 | return to_route('inertia.index') 58 | ->with([ 59 | 'message' => '削除しました。' 60 | ]); 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/Http/Controllers/ItemController.php: -------------------------------------------------------------------------------- 1 | Item::select('id', 'name', 'price', 'is_selling') 21 | ->get() 22 | ]); 23 | } 24 | 25 | /** 26 | * Show the form for creating a new resource. 27 | * 28 | * @return \Illuminate\Http\Response 29 | */ 30 | public function create() 31 | { 32 | return Inertia::render('Items/Create'); 33 | } 34 | 35 | /** 36 | * Store a newly created resource in storage. 37 | * 38 | * @param \App\Http\Requests\StoreItemRequest $request 39 | * @return \Illuminate\Http\Response 40 | */ 41 | public function store(StoreItemRequest $request) 42 | { 43 | Item::create([ 44 | 'name' => $request->name, 45 | 'memo' => $request->memo, 46 | 'price' => $request->price, 47 | ]); 48 | 49 | return to_route('items.index') 50 | ->with([ 51 | 'message' => '登録しました。', 52 | 'status' => 'success' 53 | ]); 54 | 55 | } 56 | 57 | /** 58 | * Display the specified resource. 59 | * 60 | * @param \App\Models\Item $item 61 | * @return \Illuminate\Http\Response 62 | */ 63 | public function show(Item $item) 64 | { 65 | // dd($item); 66 | return Inertia::render('Items/Show', [ 67 | 'item' => $item 68 | ]); 69 | } 70 | 71 | /** 72 | * Show the form for editing the specified resource. 73 | * 74 | * @param \App\Models\Item $item 75 | * @return \Illuminate\Http\Response 76 | */ 77 | public function edit(Item $item) 78 | { 79 | return Inertia::render('Items/Edit', [ 80 | 'item' => $item 81 | ]); 82 | } 83 | 84 | /** 85 | * Update the specified resource in storage. 86 | * 87 | * @param \App\Http\Requests\UpdateItemRequest $request 88 | * @param \App\Models\Item $item 89 | * @return \Illuminate\Http\Response 90 | */ 91 | public function update(UpdateItemRequest $request, Item $item) 92 | { 93 | // dd($item->name, $request->name); 94 | $item->name = $request->name; 95 | $item->memo = $request->memo; 96 | $item->price = $request->price; 97 | $item->is_selling = $request->is_selling; 98 | $item->save(); 99 | 100 | return to_route('items.index') 101 | ->with([ 102 | 'message' => '更新しました。', 103 | 'status' => 'success' 104 | ]); 105 | } 106 | 107 | /** 108 | * Remove the specified resource from storage. 109 | * 110 | * @param \App\Models\Item $item 111 | * @return \Illuminate\Http\Response 112 | */ 113 | public function destroy(Item $item) 114 | { 115 | $item->delete(); 116 | 117 | return to_route('items.index') 118 | ->with([ 119 | 'message' => '削除しました。', 120 | 'status' => 'danger' 121 | ]); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | \App\Http\Middleware\HandleInertiaRequests::class, 40 | ], 41 | 42 | 'api' => [ 43 | \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 44 | 'throttle:api', 45 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 46 | ], 47 | ]; 48 | 49 | /** 50 | * The application's route middleware. 51 | * 52 | * These middleware may be assigned to groups or used individually. 53 | * 54 | * @var array 55 | */ 56 | protected $routeMiddleware = [ 57 | 'auth' => \App\Http\Middleware\Authenticate::class, 58 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 59 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 60 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 61 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 62 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 63 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 64 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/HandleInertiaRequests.php: -------------------------------------------------------------------------------- 1 | [ 39 | 'user' => $request->user(), 40 | ], 41 | 'ziggy' => function () use ($request) { 42 | return array_merge((new Ziggy)->toArray(), [ 43 | 'location' => $request->url(), 44 | ]); 45 | }, 46 | 'flash' => [ 47 | 'message' => fn() => $request->session()->get('message'), 48 | 'status' => fn() => $request->session()->get('status') 49 | ] 50 | ]); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Requests/Auth/LoginRequest.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'email'], 33 | 'password' => ['required', 'string'], 34 | ]; 35 | } 36 | 37 | /** 38 | * Attempt to authenticate the request's credentials. 39 | * 40 | * @return void 41 | * 42 | * @throws \Illuminate\Validation\ValidationException 43 | */ 44 | public function authenticate() 45 | { 46 | $this->ensureIsNotRateLimited(); 47 | 48 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { 49 | RateLimiter::hit($this->throttleKey()); 50 | 51 | throw ValidationException::withMessages([ 52 | 'email' => trans('auth.failed'), 53 | ]); 54 | } 55 | 56 | RateLimiter::clear($this->throttleKey()); 57 | } 58 | 59 | /** 60 | * Ensure the login request is not rate limited. 61 | * 62 | * @return void 63 | * 64 | * @throws \Illuminate\Validation\ValidationException 65 | */ 66 | public function ensureIsNotRateLimited() 67 | { 68 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { 69 | return; 70 | } 71 | 72 | event(new Lockout($this)); 73 | 74 | $seconds = RateLimiter::availableIn($this->throttleKey()); 75 | 76 | throw ValidationException::withMessages([ 77 | 'email' => trans('auth.throttle', [ 78 | 'seconds' => $seconds, 79 | 'minutes' => ceil($seconds / 60), 80 | ]), 81 | ]); 82 | } 83 | 84 | /** 85 | * Get the rate limiting throttle key for the request. 86 | * 87 | * @return string 88 | */ 89 | public function throttleKey() 90 | { 91 | return Str::lower($this->input('email')).'|'.$this->ip(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreCustomerRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => ['required', 'max:50'], 28 | 'kana' => ['required', 'regex:/^[ァ-ヾ]+$/u','max:50'], 29 | 'tel' => ['required', 'max:20', 'unique:customers,tel'], 30 | 'email' => ['required', 'email', 'max:255', 'unique:customers,email'], 31 | 'postcode' => ['required', 'max:7'], 32 | 'address' => ['required', 'max:100'], 33 | 'birthday' => ['date'], 34 | 'gender' => ['required'], 35 | 'memo' => ['max:1000'], 36 | ]; 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Http/Requests/StoreItemRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => ['required', 'max:50'], 28 | 'memo' => ['required', 'max:255'], 29 | 'price' => ['required', 'numeric'], 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Requests/StorePurchaseRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'customer_id' => ['required'] 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateCustomerRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | // 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdateItemRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | 'name' => ['required', 'max:50'], 28 | 'memo' => ['required', 'max:255'], 29 | 'price' => ['required', 'numeric'], 30 | 'is_selling' => ['required', 'boolean'] 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Http/Requests/UpdatePurchaseRequest.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public function rules() 25 | { 26 | return [ 27 | // 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Models/Customer.php: -------------------------------------------------------------------------------- 1 | orWhere('tel', 'like', $input . '%')->exists()) 23 | { 24 | return $query->where('kana', 'like', $input . '%' ) 25 | ->orWhere('tel', 'like', $input . '%'); 26 | } 27 | } 28 | } 29 | 30 | public function purchases() 31 | { 32 | return $this->hasMany(Purchase::class); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/Models/InertiaTest.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Purchase::class) 23 | ->withPivot('quantity'); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/Models/Order.php: -------------------------------------------------------------------------------- 1 | where('created_at', ">=", $startDate); } 27 | 28 | if(is_null($startDate) && !is_null($endDate)) 29 | { 30 | $endDate1 = Carbon::parse($endDate)->addDays(1); 31 | return $query->where('created_at', '<=', $endDate1); 32 | } 33 | 34 | if(!is_null($startDate) && !is_null($endDate)) 35 | { 36 | $endDate1 = Carbon::parse($endDate)->addDays(1); 37 | return $query->where('created_at', ">=", $startDate) 38 | ->where('created_at', '<=', $endDate1); 39 | } 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/Models/Purchase.php: -------------------------------------------------------------------------------- 1 | belongsTo(Customer::class); 22 | } 23 | 24 | public function items() 25 | { 26 | return $this->belongsToMany(Item::class) 27 | ->withPivot('quantity'); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Models/Scopes/Subtotal.php: -------------------------------------------------------------------------------- 1 | fromSub($sql, 'order_subtotals'); 39 | 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | protected $fillable = [ 21 | 'name', 22 | 'email', 23 | 'password', 24 | ]; 25 | 26 | /** 27 | * The attributes that should be hidden for serialization. 28 | * 29 | * @var array 30 | */ 31 | protected $hidden = [ 32 | 'password', 33 | 'remember_token', 34 | ]; 35 | 36 | /** 37 | * The attributes that should be cast. 38 | * 39 | * @var array 40 | */ 41 | protected $casts = [ 42 | 'email_verified_at' => 'datetime', 43 | ]; 44 | } 45 | -------------------------------------------------------------------------------- /app/Policies/CustomerPolicy.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Services/AnalysisService.php: -------------------------------------------------------------------------------- 1 | where('status', true) 11 | ->groupBy('id') 12 | ->selectRaw('id, sum(subtotal) as totalPerPurchase, 13 | DATE_FORMAT(created_at, "%Y%m%d") as date'); 14 | 15 | $data = DB::table($query) 16 | ->groupBy('date') 17 | ->selectRaw('date, sum(totalPerPurchase) as total' ) 18 | ->get(); 19 | 20 | $labels = $data->pluck('date'); 21 | $totals = $data->pluck('total'); 22 | 23 | return [$data, $labels, $totals]; 24 | } 25 | 26 | public static function perMonth($subQuery) 27 | { 28 | $query = $subQuery->where('status', true) 29 | ->groupBy('id') 30 | ->selectRaw('id, sum(subtotal) as totalPerPurchase, 31 | DATE_FORMAT(created_at, "%Y%m") as date'); 32 | 33 | $data = DB::table($query) 34 | ->groupBy('date') 35 | ->selectRaw('date, sum(totalPerPurchase) as total' ) 36 | ->get(); 37 | 38 | $labels = $data->pluck('date'); 39 | $totals = $data->pluck('total'); 40 | 41 | return [$data, $labels, $totals]; 42 | } 43 | 44 | public static function perYear($subQuery) 45 | { 46 | $query = $subQuery->where('status', true) 47 | ->groupBy('id') 48 | ->selectRaw('id, sum(subtotal) as totalPerPurchase, 49 | DATE_FORMAT(created_at, "%Y") as date'); 50 | 51 | $data = DB::table($query) 52 | ->groupBy('date') 53 | ->selectRaw('date, sum(totalPerPurchase) as total' ) 54 | ->get(); 55 | 56 | $labels = $data->pluck('date'); 57 | $totals = $data->pluck('total'); 58 | 59 | return [$data, $labels, $totals]; 60 | } 61 | } -------------------------------------------------------------------------------- /app/Services/DecileService.php: -------------------------------------------------------------------------------- 1 | groupBy('id') 12 | ->selectRaw('id, customer_id, customer_name, 13 | SUM(subtotal) as totalPerPurchase'); 14 | 15 | // 2. 会員毎にまとめて購入金額順にソートする 16 | $subQuery = DB::table($subQuery) 17 | ->groupBy('customer_id') 18 | ->selectRaw('customer_id, customer_name, 19 | sum(totalPerPurchase) as total') 20 | ->orderBy('total', 'desc'); 21 | 22 | // dd($subQuery); 23 | 24 | // 3. 購入順に連番を振る 25 | DB::statement('set @row_num = 0;'); 26 | $subQuery = DB::table($subQuery) 27 | ->selectRaw(' 28 | @row_num:= @row_num+1 as row_num, 29 | customer_id, 30 | customer_name, 31 | total'); 32 | 33 | // dd($subQuery); 34 | 35 | // 4. 全体の件数を数え、1/10の値や合計金額を取得 36 | $count = DB::table($subQuery)->count(); 37 | $total = DB::table($subQuery)->selectRaw('sum(total) as total')->get(); 38 | $total = $total[0]->total; // 構成比用 39 | 40 | $decile = ceil($count / 10); // 10分の1の件数を変数に入れる 41 | 42 | $bindValues = []; 43 | $tempValue = 0; 44 | for($i = 1; $i <= 10; $i++) 45 | { 46 | array_push($bindValues, 1 + $tempValue); 47 | $tempValue += $decile; 48 | array_push($bindValues, 1 + $tempValue); 49 | } 50 | 51 | // dd($count, $decile, $bindValues); 52 | 53 | // 5 10分割しグループ毎に数字を振る 54 | DB::statement('set @row_num = 0;'); 55 | $subQuery = DB::table($subQuery) 56 | ->selectRaw(" 57 | row_num, 58 | customer_id, 59 | customer_name, 60 | total, 61 | case 62 | when ? <= row_num and row_num < ? then 1 63 | when ? <= row_num and row_num < ? then 2 64 | when ? <= row_num and row_num < ? then 3 65 | when ? <= row_num and row_num < ? then 4 66 | when ? <= row_num and row_num < ? then 5 67 | when ? <= row_num and row_num < ? then 6 68 | when ? <= row_num and row_num < ? then 7 69 | when ? <= row_num and row_num < ? then 8 70 | when ? <= row_num and row_num < ? then 9 71 | when ? <= row_num and row_num < ? then 10 72 | end as decile 73 | ", $bindValues); 74 | 75 | // dd($subQuery); 76 | 77 | // 6. グループ毎の合計・平均 78 | $subQuery = DB::table($subQuery) 79 | ->groupBy('decile') 80 | ->selectRaw('decile, 81 | round(avg(total)) as average, 82 | sum(total) as totalPerGroup'); 83 | 84 | // dd($subQuery); 85 | 86 | 87 | // 7 構成比 88 | DB::statement("set @total = ${total} ;"); 89 | $data = DB::table($subQuery) 90 | ->selectRaw('decile, 91 | average, 92 | totalPerGroup, 93 | round(100 * totalPerGroup / @total, 1) as totalRatio 94 | ') 95 | ->get(); 96 | 97 | $labels = $data->pluck('decile'); 98 | $totals = $data->pluck('totalPerGroup'); 99 | 100 | return [$data, $labels, $totals]; 101 | } 102 | } -------------------------------------------------------------------------------- /app/Services/RFMService.php: -------------------------------------------------------------------------------- 1 | groupBy('id') 15 | ->selectRaw('id, customer_id, customer_name, 16 | SUM(subtotal) as totalPerPurchase, created_at'); 17 | 18 | // 2. 会員毎にまとめて最終購入日、回数、合計金額を取得 19 | $subQuery = DB::table($subQuery) 20 | ->groupBy('customer_id') 21 | ->selectRaw('customer_id, customer_name, 22 | max(created_at) as recentDate, 23 | datediff(now(), max(created_at)) as recency, 24 | count(customer_id) as frequency, 25 | sum(totalPerPurchase) as monetary'); 26 | 27 | // dd($subQuery); 28 | 29 | // 4. 会員毎のRFMランクを計算 30 | // $rfmPrms = [ 31 | // 14, 28, 60, 90, 7, 5, 3, 2, 300000, 200000, 100000, 30000 ]; 32 | 33 | $subQuery = DB::table($subQuery) 34 | ->selectRaw('customer_id, customer_name, 35 | recentDate, recency, frequency, monetary, 36 | case 37 | when recency < ? then 5 38 | when recency < ? then 4 39 | when recency < ? then 3 40 | when recency < ? then 2 41 | else 1 end as r, 42 | case 43 | when ? <= frequency then 5 44 | when ? <= frequency then 4 45 | when ? <= frequency then 3 46 | when ? <= frequency then 2 47 | else 1 end as f, 48 | case 49 | when ? <= monetary then 5 50 | when ? <= monetary then 4 51 | when ? <= monetary then 3 52 | when ? <= monetary then 2 53 | else 1 end as m', $rfmPrms); 54 | 55 | // dd($subQuery); 56 | Log::debug($subQuery->get()); 57 | 58 | // 5.ランク毎の数を計算する 59 | $totals = DB::table($subQuery)->count(); 60 | 61 | $rCount = DB::table($subQuery) 62 | ->rightJoin('ranks', 'ranks.rank', '=', 'r') 63 | ->groupBy('rank') 64 | ->selectRaw('rank as r, count(r)') 65 | ->orderBy('r', 'desc') 66 | ->pluck('count(r)'); 67 | 68 | Log::debug($rCount); 69 | 70 | 71 | $fCount = DB::table($subQuery) 72 | ->rightJoin('ranks', 'ranks.rank', '=', 'f') 73 | ->groupBy('rank') 74 | ->selectRaw('rank as f, count(f)') 75 | ->orderBy('f', 'desc') 76 | ->pluck('count(f)'); 77 | 78 | $mCount = DB::table($subQuery) 79 | ->rightJoin('ranks', 'ranks.rank', '=', 'm') 80 | ->groupBy('rank') 81 | ->selectRaw('rank as m, count(m)') 82 | ->orderBy('m', 'desc') 83 | ->pluck('count(m)'); 84 | 85 | $eachCount = []; // Vue側に渡すようの空の配列 86 | $rank = 5; // 初期値5 87 | 88 | for($i = 0; $i < 5; $i++) 89 | { 90 | array_push($eachCount, [ 91 | 'rank' => $rank, 92 | 'r' => $rCount[$i], 93 | 'f' => $fCount[$i], 94 | 'm' => $mCount[$i], 95 | ]); 96 | $rank--; // rankを1ずつ減らす 97 | } 98 | 99 | // dd($total, $eachCount, $rCount, $fCount, $mCount); 100 | 101 | // 6. RとFで2次元で表示してみる 102 | $data = DB::table($subQuery) 103 | ->rightJoin('ranks', 'ranks.rank', '=', 'r') 104 | ->groupBy('rank') 105 | ->selectRaw('concat("r_", rank) as rRank, 106 | count(case when f = 5 then 1 end ) as f_5, 107 | count(case when f = 4 then 1 end ) as f_4, 108 | count(case when f = 3 then 1 end ) as f_3, 109 | count(case when f = 2 then 1 end ) as f_2, 110 | count(case when f = 1 then 1 end ) as f_1') 111 | ->orderBy('rRank', 'desc') 112 | ->get(); 113 | 114 | // dd($data); 115 | return [$data, $totals, $eachCount]; 116 | 117 | } 118 | } -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.0.2", 9 | "barryvdh/laravel-debugbar": "^3.7", 10 | "guzzlehttp/guzzle": "^7.2", 11 | "inertiajs/inertia-laravel": "^0.5.4", 12 | "laravel/framework": "^9.19", 13 | "laravel/sanctum": "^2.8", 14 | "laravel/tinker": "^2.7", 15 | "tightenco/ziggy": "^1.0" 16 | }, 17 | "require-dev": { 18 | "fakerphp/faker": "^1.9.1", 19 | "laravel/breeze": "^1", 20 | "laravel/pint": "^1.0", 21 | "laravel/sail": "^1.0.1", 22 | "mockery/mockery": "^1.4.4", 23 | "nunomaduro/collision": "^6.1", 24 | "phpunit/phpunit": "^9.5.10", 25 | "spatie/laravel-ignition": "^1.0" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "App\\": "app/", 30 | "Database\\Factories\\": "database/factories/", 31 | "Database\\Seeders\\": "database/seeders/" 32 | } 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Tests\\": "tests/" 37 | } 38 | }, 39 | "scripts": { 40 | "post-autoload-dump": [ 41 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 42 | "@php artisan package:discover --ansi" 43 | ], 44 | "post-update-cmd": [ 45 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 46 | ], 47 | "post-root-package-install": [ 48 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 49 | ], 50 | "post-create-project-cmd": [ 51 | "@php artisan key:generate --ansi" 52 | ] 53 | }, 54 | "extra": { 55 | "laravel": { 56 | "dont-discover": [] 57 | } 58 | }, 59 | "config": { 60 | "optimize-autoloader": true, 61 | "preferred-install": "dist", 62 | "sort-packages": true 63 | }, 64 | "minimum-stability": "dev", 65 | "prefer-stable": true 66 | } 67 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expire time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | */ 88 | 89 | 'passwords' => [ 90 | 'users' => [ 91 | 'provider' => 'users', 92 | 'table' => 'password_resets', 93 | 'expire' => 60, 94 | 'throttle' => 60, 95 | ], 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Password Confirmation Timeout 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may define the amount of seconds before a password confirmation 104 | | times out and the user is prompted to re-enter their password via the 105 | | confirmation screen. By default, the timeout lasts for three hours. 106 | | 107 | */ 108 | 109 | 'password_timeout' => 10800, 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | 74 | 'failover' => [ 75 | 'transport' => 'failover', 76 | 'mailers' => [ 77 | 'smtp', 78 | 'log', 79 | ], 80 | ], 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Global "From" Address 86 | |-------------------------------------------------------------------------- 87 | | 88 | | You may wish for all e-mails sent by your application to be sent from 89 | | the same address. Here, you may specify a name and address that is 90 | | used globally for all e-mails that are sent by your application. 91 | | 92 | */ 93 | 94 | 'from' => [ 95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 96 | 'name' => env('MAIL_FROM_NAME', 'Example'), 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Markdown Mail Settings 102 | |-------------------------------------------------------------------------- 103 | | 104 | | If you are using Markdown based email rendering, you may configure your 105 | | theme and component paths here, allowing you to customize the design 106 | | of the emails. Or, you may simply stick with the Laravel defaults! 107 | | 108 | */ 109 | 110 | 'markdown' => [ 111 | 'theme' => 'default', 112 | 113 | 'paths' => [ 114 | resource_path('views/vendor/mail'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/CustomerFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class CustomerFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | $tel = str_replace('-', '', $this->faker->phoneNumber); 20 | $address = mb_substr($this->faker->address, 9); 21 | 22 | return [ 23 | 'name' => $this->faker->name, 24 | 'kana' => $this->faker->kanaName, 25 | 'tel' => $tel, 26 | 'email' => $this->faker->email, 27 | 'postcode' => $this->faker->postcode, 28 | 'address' => $address, 29 | 'birthday' => $this->faker->dateTime, 30 | 'gender' => $this->faker->numberBetween(0, 2), 31 | 'memo' => $this->faker->realText(50), 32 | 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/factories/ItemFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class ItemFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | // 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /database/factories/PurchaseFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class PurchaseFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | $decade = $this->faker->dateTimeThisDecade; 21 | $created_at = $decade->modify('+2 years'); 22 | 23 | return [ 24 | 'customer_id' => rand(1, Customer::count()), 25 | 'status' => $this->faker->boolean, 26 | 'created_at' => $created_at 27 | ]; 28 | 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(function (array $attributes) { 37 | return [ 38 | 'email_verified_at' => null, 39 | ]; 40 | }); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('personal_access_tokens'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2022_07_25_155035_create_inertia_tests_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->string('content'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::dropIfExists('inertia_tests'); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2022_08_02_151056_create_items_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('memo')->nullable(); 20 | $table->integer('price'); 21 | $table->boolean('is_selling')->default(true); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('items'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_08_08_115719_create_customers_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('kana'); 20 | $table->string('tel')->unique(); 21 | $table->string('email'); 22 | $table->string('postcode'); 23 | $table->string('address'); 24 | $table->date('birthday')->nullable(); 25 | $table->tinyInteger('gender'); // 0男性, 1女性、2その他 26 | $table->text('memo')->nullable(); 27 | $table->timestamps(); 28 | 29 | }); 30 | } 31 | 32 | /** 33 | * Reverse the migrations. 34 | * 35 | * @return void 36 | */ 37 | public function down() 38 | { 39 | Schema::dropIfExists('customers'); 40 | } 41 | }; 42 | -------------------------------------------------------------------------------- /database/migrations/2022_08_16_125422_create_purchases_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('customer_id')->constrained()->onUpdate('cascade'); 19 | $table->boolean('status'); 20 | $table->timestamps(); 21 | 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('purchases'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /database/migrations/2022_08_17_112754_create_item_purchase_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('item_id')->constrained()->onUpdate('cascade');; 19 | $table->foreignId('purchase_id')->constrained()->onUpdate('cascade');; 20 | $table->integer('quantity'); 21 | $table->timestamps(); 22 | 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::dropIfExists('item_purchase'); 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /database/migrations/2022_09_03_043755_create_ranks_table.php: -------------------------------------------------------------------------------- 1 | integer('rank'); 18 | }); 19 | } 20 | 21 | /** 22 | * Reverse the migrations. 23 | * 24 | * @return void 25 | */ 26 | public function down() 27 | { 28 | Schema::dropIfExists('ranks'); 29 | } 30 | }; 31 | -------------------------------------------------------------------------------- /database/seeders/CustomerSeeder.php: -------------------------------------------------------------------------------- 1 | call([ 19 | UserSeeder::class, 20 | ItemSeeder::class, 21 | RankSeeder::class 22 | ]); 23 | 24 | \App\Models\Customer::factory(1000)->create(); 25 | 26 | $items = \App\Models\Item::all(); 27 | 28 | Purchase::factory(30000)->create() 29 | ->each(function(Purchase $purchase) use ($items) { 30 | $purchase->items()->attach( 31 | $items->random(rand(1,3))->pluck('id')->toArray(), 32 | [ 'quantity' => rand(1, 5) ] 33 | ); 34 | }); 35 | 36 | // \App\Models\User::factory(10)->create(); 37 | 38 | // \App\Models\User::factory()->create([ 39 | // 'name' => 'Test User', 40 | // 'email' => 'test@example.com', 41 | // ]); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/seeders/ItemSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 20 | [ 21 | 'name' => 'カット', 22 | 'memo' => 'カットの詳細', 23 | 'price' => 6000 24 | ], 25 | [ 26 | 'name' => 'カラー', 27 | 'memo' => 'カラーの詳細', 28 | 'price' => 8000 29 | ],[ 30 | 'name' => 'パーマ(カット込)', 31 | 'memo' => 'パーマの詳細', 32 | 'price' => 13000 33 | ] 34 | ]); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/seeders/PurchaseSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 19 | ['rank' => 1 ], 20 | ['rank' => 2 ], 21 | ['rank' => 3 ], 22 | ['rank' => 4 ], 23 | ['rank' => 5 ], 24 | ]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/seeders/UserSeeder.php: -------------------------------------------------------------------------------- 1 | insert([ 20 | 'name' => 'test', 21 | 'email' => 'test@test.com', 22 | 'password' => Hash::make('password123'), 23 | ]); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "preserve", 4 | "baseUrl": ".", 5 | "paths": { 6 | "@/*": ["resources/js/*"] 7 | }, 8 | "checkJs" : false 9 | }, 10 | "exclude": ["node_modules", "public"] 11 | } 12 | -------------------------------------------------------------------------------- /lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /lang/ja/auth.php: -------------------------------------------------------------------------------- 1 | 'ログイン情報が登録されていません。', 17 | 'throttle' => 'ログインに続けて失敗しています。:seconds秒後に再度お試しください。', 18 | 19 | ]; -------------------------------------------------------------------------------- /lang/ja/pagination.php: -------------------------------------------------------------------------------- 1 | '« 前', 17 | 'next' => '次 »', 18 | 19 | ]; -------------------------------------------------------------------------------- /lang/ja/passwords.php: -------------------------------------------------------------------------------- 1 | 'パスワードをリセットしました。', 17 | 'sent' => 'パスワードリセットメールを送信しました。', 18 | 'throttled' => 'しばらく再試行はお待ちください。', 19 | 'token' => 'このパスワードリセットトークンは無効です。', 20 | 'user' => "メールアドレスに一致するユーザーは存在していません。", 21 | 22 | ]; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "@inertiajs/inertia": "^0.11.0", 9 | "@inertiajs/inertia-vue3": "^0.6.0", 10 | "@inertiajs/progress": "^0.2.7", 11 | "@tailwindcss/forms": "^0.5.2", 12 | "@vitejs/plugin-vue": "^3.0.0", 13 | "autoprefixer": "^10.4.2", 14 | "axios": "^0.27", 15 | "laravel-vite-plugin": "^0.5.0", 16 | "lodash": "^4.17.19", 17 | "postcss": "^8.4.6", 18 | "tailwindcss": "^3.1.0", 19 | "vite": "^3.0.0", 20 | "vue": "^3.2.31" 21 | }, 22 | "dependencies": { 23 | "chart.js": "^3.9.1", 24 | "dayjs": "^1.11.5", 25 | "micromodal": "^0.4.10", 26 | "vue-chart-3": "^3.1.8", 27 | "yubinbango-core2": "^0.6.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aokitashipro/laravel_uCRM/0ff5a9087ead6c6c7b6d938c0634e84fe0355602/public/.DS_Store -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aokitashipro/laravel_uCRM/0ff5a9087ead6c6c7b6d938c0634e84fe0355602/public/favicon.ico -------------------------------------------------------------------------------- /public/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aokitashipro/laravel_uCRM/0ff5a9087ead6c6c7b6d938c0634e84fe0355602/public/images/logo.png -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /resources/css/micromodal.css: -------------------------------------------------------------------------------- 1 | /**************************\ 2 | Basic Modal Styles 3 | \**************************/ 4 | 5 | .modal { 6 | font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif; 7 | } 8 | 9 | .modal__overlay { 10 | position: fixed; 11 | top: 0; 12 | left: 0; 13 | right: 0; 14 | bottom: 0; 15 | background: rgba(0,0,0,0.6); 16 | display: flex; 17 | justify-content: center; 18 | align-items: center; 19 | } 20 | 21 | .modal__container { 22 | background-color: #fff; 23 | padding: 30px; 24 | max-width: 1200px; 25 | max-height: 100vh; 26 | border-radius: 4px; 27 | overflow-y: auto; 28 | box-sizing: border-box; 29 | } 30 | 31 | .modal__header { 32 | display: flex; 33 | justify-content: space-between; 34 | align-items: center; 35 | } 36 | 37 | .modal__title { 38 | margin-top: 0; 39 | margin-bottom: 0; 40 | font-weight: 600; 41 | font-size: 1.25rem; 42 | line-height: 1.25; 43 | color: #00449e; 44 | box-sizing: border-box; 45 | } 46 | 47 | .modal__close { 48 | background: transparent; 49 | border: 0; 50 | } 51 | 52 | .modal__header .modal__close:before { content: "\2715"; } 53 | 54 | .modal__content { 55 | margin-top: 2rem; 56 | margin-bottom: 2rem; 57 | line-height: 1.5; 58 | color: rgba(0,0,0,.8); 59 | } 60 | 61 | .modal__btn { 62 | font-size: .875rem; 63 | padding-left: 1rem; 64 | padding-right: 1rem; 65 | padding-top: .5rem; 66 | padding-bottom: .5rem; 67 | background-color: #e6e6e6; 68 | color: rgba(0,0,0,.8); 69 | border-radius: .25rem; 70 | border-style: none; 71 | border-width: 0; 72 | cursor: pointer; 73 | -webkit-appearance: button; 74 | text-transform: none; 75 | overflow: visible; 76 | line-height: 1.15; 77 | margin: 0; 78 | will-change: transform; 79 | -moz-osx-font-smoothing: grayscale; 80 | -webkit-backface-visibility: hidden; 81 | backface-visibility: hidden; 82 | -webkit-transform: translateZ(0); 83 | transform: translateZ(0); 84 | transition: -webkit-transform .25s ease-out; 85 | transition: transform .25s ease-out; 86 | transition: transform .25s ease-out,-webkit-transform .25s ease-out; 87 | } 88 | 89 | .modal__btn:focus, .modal__btn:hover { 90 | -webkit-transform: scale(1.05); 91 | transform: scale(1.05); 92 | } 93 | 94 | .modal__btn-primary { 95 | background-color: #00449e; 96 | color: #fff; 97 | } 98 | 99 | 100 | 101 | /**************************\ 102 | Demo Animation Style 103 | \**************************/ 104 | @keyframes mmfadeIn { 105 | from { opacity: 0; } 106 | to { opacity: 1; } 107 | } 108 | 109 | @keyframes mmfadeOut { 110 | from { opacity: 1; } 111 | to { opacity: 0; } 112 | } 113 | 114 | @keyframes mmslideIn { 115 | from { transform: translateY(15%); } 116 | to { transform: translateY(0); } 117 | } 118 | 119 | @keyframes mmslideOut { 120 | from { transform: translateY(0); } 121 | to { transform: translateY(-10%); } 122 | } 123 | 124 | .micromodal-slide { 125 | display: none; 126 | } 127 | 128 | .micromodal-slide.is-open { 129 | display: block; 130 | } 131 | 132 | .micromodal-slide[aria-hidden="false"] .modal__overlay { 133 | animation: mmfadeIn .3s cubic-bezier(0.0, 0.0, 0.2, 1); 134 | } 135 | 136 | .micromodal-slide[aria-hidden="false"] .modal__container { 137 | animation: mmslideIn .3s cubic-bezier(0, 0, .2, 1); 138 | } 139 | 140 | .micromodal-slide[aria-hidden="true"] .modal__overlay { 141 | animation: mmfadeOut .3s cubic-bezier(0.0, 0.0, 0.2, 1); 142 | } 143 | 144 | .micromodal-slide[aria-hidden="true"] .modal__container { 145 | animation: mmslideOut .3s cubic-bezier(0, 0, .2, 1); 146 | } 147 | 148 | .micromodal-slide .modal__container, 149 | .micromodal-slide .modal__overlay { 150 | will-change: transform; 151 | } -------------------------------------------------------------------------------- /resources/js/Components/ApplicationLogo.vue: -------------------------------------------------------------------------------- 1 | 6 | -------------------------------------------------------------------------------- /resources/js/Components/Button.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 15 | -------------------------------------------------------------------------------- /resources/js/Components/Chart.vue: -------------------------------------------------------------------------------- 1 | 28 | 33 | -------------------------------------------------------------------------------- /resources/js/Components/Checkbox.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 31 | -------------------------------------------------------------------------------- /resources/js/Components/Dropdown.vue: -------------------------------------------------------------------------------- 1 | 43 | 44 | 72 | -------------------------------------------------------------------------------- /resources/js/Components/DropdownLink.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | -------------------------------------------------------------------------------- /resources/js/Components/FlashMessage.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /resources/js/Components/Input.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 20 | -------------------------------------------------------------------------------- /resources/js/Components/InputError.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 12 | -------------------------------------------------------------------------------- /resources/js/Components/Label.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /resources/js/Components/MicroModal.vue: -------------------------------------------------------------------------------- 1 | 40 | -------------------------------------------------------------------------------- /resources/js/Components/NavLink.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /resources/js/Components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 5 | -------------------------------------------------------------------------------- /resources/js/Components/ResponsiveNavLink.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /resources/js/Components/ValidationErrors.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 19 | -------------------------------------------------------------------------------- /resources/js/Layouts/Guest.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 19 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ConfirmPassword.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 44 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ForgotPassword.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 50 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Login.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 68 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/Register.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 63 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/ResetPassword.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 58 | -------------------------------------------------------------------------------- /resources/js/Pages/Auth/VerifyEmail.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 43 | -------------------------------------------------------------------------------- /resources/js/Pages/ComponentTest.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /resources/js/Pages/Customers/Index.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 80 | -------------------------------------------------------------------------------- /resources/js/Pages/Customers/Index_test.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | 26 | -------------------------------------------------------------------------------- /resources/js/Pages/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | 27 | -------------------------------------------------------------------------------- /resources/js/Pages/Inertia/Create.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | -------------------------------------------------------------------------------- /resources/js/Pages/Inertia/Index.vue: -------------------------------------------------------------------------------- 1 | 8 | 20 | -------------------------------------------------------------------------------- /resources/js/Pages/Inertia/Show.vue: -------------------------------------------------------------------------------- 1 | 18 | 19 | -------------------------------------------------------------------------------- /resources/js/Pages/InertiaTest.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /resources/js/Pages/Items/Create.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 77 | -------------------------------------------------------------------------------- /resources/js/Pages/Items/Index.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 69 | -------------------------------------------------------------------------------- /resources/js/Pages/Purchases/Create_bak.vue: -------------------------------------------------------------------------------- 1 | 55 | 56 | -------------------------------------------------------------------------------- /resources/js/Pages/Purchases/Index.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 80 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | import './micromodal'; 3 | import '../css/app.css'; 4 | import '../css/micromodal.css'; 5 | 6 | import { createApp, h } from 'vue'; 7 | import { createInertiaApp } from '@inertiajs/inertia-vue3'; 8 | import { InertiaProgress } from '@inertiajs/progress'; 9 | import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'; 10 | import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'; 11 | 12 | const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel'; 13 | 14 | createInertiaApp({ 15 | title: (title) => `${title} - ${appName}`, 16 | resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')), 17 | setup({ el, app, props, plugin }) { 18 | return createApp({ render: () => h(app, props) }) 19 | .use(plugin) 20 | .use(ZiggyVue, Ziggy) 21 | .mount(el); 22 | }, 23 | }); 24 | 25 | InertiaProgress.init({ color: '#4B5563' }); 26 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | -------------------------------------------------------------------------------- /resources/js/common.js: -------------------------------------------------------------------------------- 1 | const nl2br = (str) => { 2 | var res = str.replace(/\r\n/g, "
"); 3 | res = res.replace(/(\n|\r)/g, "
"); 4 | return res; 5 | } 6 | 7 | const getToday = () => { 8 | const today = new Date(); 9 | const yyyy = today.getFullYear(); 10 | const mm = ("0"+(today.getMonth()+1)).slice(-2); 11 | const dd = ("0"+today.getDate()).slice(-2); 12 | return yyyy+'-'+mm+'-'+dd; 13 | } 14 | 15 | export { nl2br, getToday } -------------------------------------------------------------------------------- /resources/js/micromodal.js: -------------------------------------------------------------------------------- 1 | import MicroModal from 'micromodal'; // es6 module 2 | MicroModal.init({ 3 | disableScroll: true 4 | }); 5 | 6 | -------------------------------------------------------------------------------- /resources/views/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{ config('app.name', 'Laravel') }} 8 | 9 | 10 | 11 | 12 | 13 | @routes 14 | @vite('resources/js/app.js') 15 | @inertiaHead 16 | 17 | 18 | @inertia 19 | 20 | 21 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/analysis', [ AnalysisController::class, 'index' ]) 21 | ->name('api.analysis'); 22 | 23 | Route::middleware('auth:sanctum') 24 | ->get('/searchCustomers', function (Request $request) { 25 | return Customer::searchCustomers($request->search) 26 | ->select('id', 'name', 'kana', 'tel')->paginate(50); 27 | }); 28 | 29 | Route::middleware('auth:sanctum')->get('/user', function (Request $request) { 30 | return $request->user(); 31 | }); 32 | -------------------------------------------------------------------------------- /routes/auth.php: -------------------------------------------------------------------------------- 1 | group(function () { 14 | Route::get('register', [RegisteredUserController::class, 'create']) 15 | ->name('register'); 16 | 17 | Route::post('register', [RegisteredUserController::class, 'store']); 18 | 19 | Route::get('login', [AuthenticatedSessionController::class, 'create']) 20 | ->name('login'); 21 | 22 | Route::post('login', [AuthenticatedSessionController::class, 'store']); 23 | 24 | Route::get('forgot-password', [PasswordResetLinkController::class, 'create']) 25 | ->name('password.request'); 26 | 27 | Route::post('forgot-password', [PasswordResetLinkController::class, 'store']) 28 | ->name('password.email'); 29 | 30 | Route::get('reset-password/{token}', [NewPasswordController::class, 'create']) 31 | ->name('password.reset'); 32 | 33 | Route::post('reset-password', [NewPasswordController::class, 'store']) 34 | ->name('password.update'); 35 | }); 36 | 37 | Route::middleware('auth')->group(function () { 38 | Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke']) 39 | ->name('verification.notice'); 40 | 41 | Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke']) 42 | ->middleware(['signed', 'throttle:6,1']) 43 | ->name('verification.verify'); 44 | 45 | Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store']) 46 | ->middleware('throttle:6,1') 47 | ->name('verification.send'); 48 | 49 | Route::get('confirm-password', [ConfirmablePasswordController::class, 'show']) 50 | ->name('password.confirm'); 51 | 52 | Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']); 53 | 54 | Route::post('logout', [AuthenticatedSessionController::class, 'destroy']) 55 | ->name('logout'); 56 | }); 57 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('analysis'); 13 | 14 | Route::resource('items', ItemController::class) 15 | ->middleware(['auth', 'verified']); 16 | 17 | Route::resource('customers', CustomerController::class) 18 | ->middleware(['auth', 'verified']); 19 | 20 | Route::resource('purchases', PurchaseController::class) 21 | ->middleware(['auth', 'verified']); 22 | 23 | 24 | Route::get('/inertia-test', function () { 25 | return Inertia::render('InertiaTest'); 26 | } 27 | ); 28 | 29 | Route::get('/component-test', function () { 30 | return Inertia::render('ComponentTest'); 31 | } 32 | ); 33 | 34 | 35 | Route::get('/inertia/index', [InertiaTestController::class, 'index'])->name('inertia.index'); 36 | Route::get('/inertia/create', [InertiaTestController::class, 'create'])->name('inertia.create'); 37 | Route::post('/inertia', [InertiaTestController::class, 'store'])->name('inertia.store'); 38 | Route::get('/inertia/show/{id}', [InertiaTestController::class, 'show'])->name('inertia.show'); 39 | Route::delete('/inertia/{id}', [InertiaTestController::class, 'delete'])->name('inertia.delete'); 40 | 41 | 42 | 43 | Route::get('/', function () { 44 | return Inertia::render('Welcome', [ 45 | 'canLogin' => Route::has('login'), 46 | 'canRegister' => Route::has('register'), 47 | 'laravelVersion' => Application::VERSION, 48 | 'phpVersion' => PHP_VERSION, 49 | ]); 50 | }); 51 | 52 | Route::get('/dashboard', function () { 53 | return Inertia::render('Dashboard'); 54 | })->middleware(['auth', 'verified'])->name('dashboard'); 55 | 56 | require __DIR__.'/auth.php'; 57 | -------------------------------------------------------------------------------- /storage/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aokitashipro/laravel_uCRM/0ff5a9087ead6c6c7b6d938c0634e84fe0355602/storage/.DS_Store -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const defaultTheme = require('tailwindcss/defaultTheme'); 2 | 3 | /** @type {import('tailwindcss').Config} */ 4 | module.exports = { 5 | content: [ 6 | './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', 7 | './storage/framework/views/*.php', 8 | './resources/views/**/*.blade.php', 9 | './resources/js/**/*.vue', 10 | ], 11 | 12 | theme: { 13 | extend: { 14 | fontFamily: { 15 | sans: ['Nunito', ...defaultTheme.fontFamily.sans], 16 | }, 17 | }, 18 | }, 19 | 20 | plugins: [require('@tailwindcss/forms')], 21 | }; 22 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/Auth/AuthenticationTest.php: -------------------------------------------------------------------------------- 1 | get('/login'); 17 | 18 | $response->assertStatus(200); 19 | } 20 | 21 | public function test_users_can_authenticate_using_the_login_screen() 22 | { 23 | $user = User::factory()->create(); 24 | 25 | $response = $this->post('/login', [ 26 | 'email' => $user->email, 27 | 'password' => 'password', 28 | ]); 29 | 30 | $this->assertAuthenticated(); 31 | $response->assertRedirect(RouteServiceProvider::HOME); 32 | } 33 | 34 | public function test_users_can_not_authenticate_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $this->post('/login', [ 39 | 'email' => $user->email, 40 | 'password' => 'wrong-password', 41 | ]); 42 | 43 | $this->assertGuest(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /tests/Feature/Auth/EmailVerificationTest.php: -------------------------------------------------------------------------------- 1 | create([ 20 | 'email_verified_at' => null, 21 | ]); 22 | 23 | $response = $this->actingAs($user)->get('/verify-email'); 24 | 25 | $response->assertStatus(200); 26 | } 27 | 28 | public function test_email_can_be_verified() 29 | { 30 | $user = User::factory()->create([ 31 | 'email_verified_at' => null, 32 | ]); 33 | 34 | Event::fake(); 35 | 36 | $verificationUrl = URL::temporarySignedRoute( 37 | 'verification.verify', 38 | now()->addMinutes(60), 39 | ['id' => $user->id, 'hash' => sha1($user->email)] 40 | ); 41 | 42 | $response = $this->actingAs($user)->get($verificationUrl); 43 | 44 | Event::assertDispatched(Verified::class); 45 | $this->assertTrue($user->fresh()->hasVerifiedEmail()); 46 | $response->assertRedirect(RouteServiceProvider::HOME.'?verified=1'); 47 | } 48 | 49 | public function test_email_is_not_verified_with_invalid_hash() 50 | { 51 | $user = User::factory()->create([ 52 | 'email_verified_at' => null, 53 | ]); 54 | 55 | $verificationUrl = URL::temporarySignedRoute( 56 | 'verification.verify', 57 | now()->addMinutes(60), 58 | ['id' => $user->id, 'hash' => sha1('wrong-email')] 59 | ); 60 | 61 | $this->actingAs($user)->get($verificationUrl); 62 | 63 | $this->assertFalse($user->fresh()->hasVerifiedEmail()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordConfirmationTest.php: -------------------------------------------------------------------------------- 1 | create(); 16 | 17 | $response = $this->actingAs($user)->get('/confirm-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_password_can_be_confirmed() 23 | { 24 | $user = User::factory()->create(); 25 | 26 | $response = $this->actingAs($user)->post('/confirm-password', [ 27 | 'password' => 'password', 28 | ]); 29 | 30 | $response->assertRedirect(); 31 | $response->assertSessionHasNoErrors(); 32 | } 33 | 34 | public function test_password_is_not_confirmed_with_invalid_password() 35 | { 36 | $user = User::factory()->create(); 37 | 38 | $response = $this->actingAs($user)->post('/confirm-password', [ 39 | 'password' => 'wrong-password', 40 | ]); 41 | 42 | $response->assertSessionHasErrors(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/Feature/Auth/PasswordResetTest.php: -------------------------------------------------------------------------------- 1 | get('/forgot-password'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | 22 | public function test_reset_password_link_can_be_requested() 23 | { 24 | Notification::fake(); 25 | 26 | $user = User::factory()->create(); 27 | 28 | $this->post('/forgot-password', ['email' => $user->email]); 29 | 30 | Notification::assertSentTo($user, ResetPassword::class); 31 | } 32 | 33 | public function test_reset_password_screen_can_be_rendered() 34 | { 35 | Notification::fake(); 36 | 37 | $user = User::factory()->create(); 38 | 39 | $this->post('/forgot-password', ['email' => $user->email]); 40 | 41 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) { 42 | $response = $this->get('/reset-password/'.$notification->token); 43 | 44 | $response->assertStatus(200); 45 | 46 | return true; 47 | }); 48 | } 49 | 50 | public function test_password_can_be_reset_with_valid_token() 51 | { 52 | Notification::fake(); 53 | 54 | $user = User::factory()->create(); 55 | 56 | $this->post('/forgot-password', ['email' => $user->email]); 57 | 58 | Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) { 59 | $response = $this->post('/reset-password', [ 60 | 'token' => $notification->token, 61 | 'email' => $user->email, 62 | 'password' => 'password', 63 | 'password_confirmation' => 'password', 64 | ]); 65 | 66 | $response->assertSessionHasNoErrors(); 67 | 68 | return true; 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /tests/Feature/Auth/RegistrationTest.php: -------------------------------------------------------------------------------- 1 | get('/register'); 16 | 17 | $response->assertStatus(200); 18 | } 19 | 20 | public function test_new_users_can_register() 21 | { 22 | $response = $this->post('/register', [ 23 | 'name' => 'Test User', 24 | 'email' => 'test@example.com', 25 | 'password' => 'password', 26 | 'password_confirmation' => 'password', 27 | ]); 28 | 29 | $this->assertAuthenticated(); 30 | $response->assertRedirect(RouteServiceProvider::HOME); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue'; 4 | 5 | export default defineConfig({ 6 | plugins: [ 7 | laravel({ 8 | input: 'resources/js/app.js', 9 | refresh: true, 10 | }), 11 | vue({ 12 | template: { 13 | transformAssetUrls: { 14 | base: null, 15 | includeAbsolute: false, 16 | }, 17 | }, 18 | }), 19 | ], 20 | }); 21 | --------------------------------------------------------------------------------