Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
ProfileController
0.00% covered (danger)
0.00%
0 / 20
0.00% covered (danger)
0.00%
0 / 4
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 edit
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 update
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
 update_image
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Http\Controllers\Dashboard;
4
5use App\Http\Controllers\Controller;
6use App\Http\Requests\profile\edit;
7use App\Services\ActivityLogsService;
8use App\Services\UsersService;
9use Illuminate\Http\Request;
10use Illuminate\Support\Facades\Hash;
11
12class ProfileController extends Controller
13{
14    protected $ActivityLogsService;
15    protected $UsersService;
16
17    public function __construct(UsersService $UsersService,
18                                ActivityLogsService $ActivityLogsService) {
19
20        $this->ActivityLogsService = $ActivityLogsService;
21        $this->UsersService = $UsersService;
22    }
23
24    public function edit(){
25        return view('Dashboard.profile.show')->with([
26            'data' => auth('user')->user(),
27        ]);
28    }
29
30    public function update(edit $request){
31        $user = auth('user')->user();
32
33        $this->UsersService->update($user, $request);
34
35        $this->ActivityLogsService->insert([
36            'subject_id'      => $user->id,
37            'subject_type'    => 'App\Models\User',
38            'description'     => 'update',
39            'causer_id'       => auth('user')->user()->id,
40            'causer_type'     => 'App\Models\User',
41            'properties'      => null,
42        ]);
43
44        return redirect('dashboard/profile')->with('success', trans('admin.success'));
45    }
46
47    public function update_image(Request $request){
48        $user = auth('user')->user();
49
50        if($request->hasfile('image'))
51            $this->UsersService->update_user_image($user, $request->file('image'));
52
53        return redirect('dashboard/profile')->with('success', trans('admin.success'));
54    }
55}