質問編集履歴
1
Call to a member function update\(\) on nullとなった。
test
CHANGED
File without changes
|
test
CHANGED
@@ -50,8 +50,80 @@
|
|
50
50
|
|
51
51
|
```
|
52
52
|
|
53
|
-
|
54
|
-
|
55
53
|
かなり検索して試しましたが、動きません。
|
56
54
|
|
57
55
|
宜しくお願い致します。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
___________________________________________________
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
追記
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
public function update($id, Request $request) {
|
70
|
+
|
71
|
+
User::find($id)->update(
|
72
|
+
|
73
|
+
array(
|
74
|
+
|
75
|
+
'avatar' => $request->avatar,
|
76
|
+
|
77
|
+
'profile' => $request->profile
|
78
|
+
|
79
|
+
)
|
80
|
+
|
81
|
+
);
|
82
|
+
|
83
|
+
return view('users.update')->with('user', $user);
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
@extends('layout')
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
@section('content')
|
96
|
+
|
97
|
+
@if (Auth::check() && Auth::user()->id == $user->id)
|
98
|
+
|
99
|
+
<section id="intro">
|
100
|
+
|
101
|
+
<header>
|
102
|
+
|
103
|
+
{{ Form::open(['url' => 'users/$user->id', 'method' => 'PATCH', 'files' => true]) }}
|
104
|
+
|
105
|
+
{{ Form::label('fileName', 'Please select your avatar') }}
|
106
|
+
|
107
|
+
<input type="file" name="avatar" value="avatar">
|
108
|
+
|
109
|
+
<textarea name="profile" rows="3" value="profile" style="width: 95%; margin-right: auto; margin-left: auto; margin-top: 1.5em;" placeholder="Tell me what kind of person are you...?">{{ $user->profile }}</textarea>
|
110
|
+
|
111
|
+
<input type="submit" value="update" style="margin: 3em 0 2em 0;">
|
112
|
+
|
113
|
+
{{ Form::close() }}
|
114
|
+
|
115
|
+
</header>
|
116
|
+
|
117
|
+
</section>
|
118
|
+
|
119
|
+
@endif
|
120
|
+
|
121
|
+
@endsection
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
上記に書き換えたところ($fileName = $request->avatar->getClientOriginalName();を消した)、Call to a member function update() on nullと表示されました。
|