1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\Controllers; |
4
|
|
|
|
5
|
|
|
use App\User; |
6
|
|
|
use Faker\Provider\Image; |
7
|
|
|
use Illuminate\Http\Request; |
8
|
|
|
|
9
|
|
|
use App\Http\Requests; |
10
|
|
|
use Illuminate\Support\Facades\Input; |
11
|
|
|
|
12
|
|
|
class ProfileController extends Controller |
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* ProfileController constructor. |
16
|
|
|
*/ |
17
|
|
|
public function __construct() |
18
|
|
|
{ |
19
|
|
|
$this->middleware('auth'); |
20
|
|
|
$this->middleware('lang'); |
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Update the profile information. |
25
|
|
|
* |
26
|
|
|
* @param Requests\ProfileValidator $input |
27
|
|
|
* @return \Illuminate\Http\RedirectResponse |
28
|
|
|
*/ |
29
|
|
|
public function updateProfile(Requests\ProfileValidator $input) |
30
|
|
|
{ |
31
|
|
|
// User information |
32
|
|
|
User::find(auth()->user()->id)->update($input->except(['_token', 'avatar'])); |
|
|
|
|
33
|
|
|
|
34
|
|
|
// User image information. |
35
|
|
|
if (Input::file()) { |
36
|
|
|
$image = Input::file('avatar'); |
37
|
|
|
$filename = time() . '.' . $image->getClientOriginalExtension(); |
38
|
|
|
$path = public_path('profilepics/' . $filename); |
39
|
|
|
|
40
|
|
|
Image::make($image->getRealPath())->resize(80, 80)->save($path); |
|
|
|
|
41
|
|
|
|
42
|
|
|
$avatar = User::find(auth()->user()->id); |
|
|
|
|
43
|
|
|
$avatar->avatar = $filename; |
44
|
|
|
$avatar->save(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
session()->flash('message', 'Your profile information has been updated.'); |
48
|
|
|
return redirect()->back(302); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Update your password. |
53
|
|
|
* |
54
|
|
|
* @param Requests\PasswordValidation $input |
55
|
|
|
* @return \Illuminate\Http\RedirectResponse |
56
|
|
|
*/ |
57
|
|
|
public function updateSecurity(Requests\PasswordValidation $input) |
58
|
|
|
{ |
59
|
|
|
$data['password'] = bcrypt($input->password); |
|
|
|
|
60
|
|
|
|
61
|
|
|
User::find(auth()->user()->id)->update($data); |
|
|
|
|
62
|
|
|
session()->flash('message', 'Your password has been updated.'); |
63
|
|
|
|
64
|
|
|
return redirect()->back(302); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.