Skip to content

Commit d3d18ab

Browse files
committed
フロントエンドのエラーを修正
1 parent 1e75a61 commit d3d18ab

File tree

6 files changed

+52
-16
lines changed

6 files changed

+52
-16
lines changed

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace App\Http\Controllers\Auth;
44

5-
use App\User;
5+
use App\Models\User;
66
use App\Http\Controllers\Controller;
77
use Illuminate\Support\Facades\Hash;
88
use Illuminate\Support\Facades\Validator;
@@ -59,7 +59,7 @@ protected function validator(array $data)
5959
* Create a new user instance after a valid registration.
6060
*
6161
* @param array $data
62-
* @return \App\User
62+
* @return \App\Models\User
6363
*/
6464
protected function create(array $data)
6565
{

config/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
'providers' => [
6969
'users' => [
7070
'driver' => 'eloquent',
71-
'model' => App\User::class,
71+
'model' => App\Models\User::class,
7272
],
7373

7474
// 'users' => [

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"private": true,
3+
"type": "module",
34
"scripts": {
45
"dev": "vite",
56
"build": "vite build"

resources/js/bootstrap.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
1-
window._ = require('lodash');
1+
import axios from 'axios';
2+
3+
window.axios = axios;
4+
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
5+
6+
7+
8+
// window._ = require('lodash');
29

310
/**
411
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
512
* for JavaScript based Bootstrap features such as modals and tabs. This
613
* code may be modified to fit the specific needs of your application.
714
*/
815

9-
try {
10-
window.Popper = require('popper.js').default;
11-
window.$ = window.jQuery = require('jquery');
16+
// try {
17+
// window.Popper = require('popper.js').default;
18+
// window.$ = window.jQuery = require('jquery');
1219

13-
require('bootstrap');
14-
} catch (e) {}
20+
// require('bootstrap');
21+
// } catch (e) {}
1522

1623
/**
1724
* We'll load the axios HTTP library which allows us to easily issue requests
1825
* to our Laravel back-end. This library automatically handles sending the
1926
* CSRF token as a header based on the value of the "XSRF" token cookie.
2027
*/
2128

22-
window.axios = require('axios');
29+
// window.axios = require('axios');
2330

24-
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
31+
// window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
2532

2633
/**
2734
* Next we will register the CSRF Token as a common header with Axios so that

routes/web.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?php
22

33
use App\Http\Controllers\ProfileController;
4+
use App\Http\Controllers\PostController;
45
use Illuminate\Foundation\Application;
56
use Illuminate\Support\Facades\Route;
7+
use Illuminate\Support\Facades\Auth;
68
use Inertia\Inertia;
79

810
Route::get('/', function () {
911
return Inertia::render('Welcome', [
12+
'auth' => [
13+
'user' => Auth::user(),
14+
],
1015
'canLogin' => Route::has('login'),
1116
'canRegister' => Route::has('register'),
1217
'laravelVersion' => Application::VERSION,
@@ -15,13 +20,36 @@
1520
});
1621

1722
Route::get('/dashboard', function () {
18-
return Inertia::render('Dashboard');
23+
return Inertia::render('Dashboard',[
24+
'auth' => [
25+
'user' => Auth::user(),
26+
],
27+
]);
1928
})->middleware(['auth', 'verified'])->name('dashboard');
2029

2130
Route::middleware('auth')->group(function () {
22-
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
31+
Route::get('/profile', function () {
32+
return Inertia::render('Profile/Edit', [
33+
'auth' => [
34+
'user' => Auth::user(),
35+
],
36+
]);
37+
})->name('profile.edit');
38+
2339
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
2440
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
2541
});
2642

43+
Route::get('/home', 'HomeController@index')->name('home');
44+
45+
// Route::get('/', [PostController::class, 'index'])->name('index');
46+
// Route::get('/create', [PostController::class, 'create'])->name('create');
47+
// Route::post('/store', [PostController::class, 'store'])->name('store');
48+
// Route::get('/show/{id}', [PostController::class, 'show'])->name('show');
49+
// Route::get('/edit/{id}', [PostController::class, 'edit'])->name('edit');
50+
// Route::put('/update', [PostController::class, 'update'])->name('update');
51+
// Route::delete('/delete', [PostController::class, 'destroy'])->name('delete');
52+
53+
// Route::post('/ajax/eval',[PostController::class, 'eval'])->name('ajax/eval');
54+
2755
require __DIR__.'/auth.php';

0 commit comments

Comments
 (0)