Skip to content

Commit f3accdb

Browse files
author
maharshi
committed
Admin Profile - Image upload option
1 parent 3e75a6a commit f3accdb

File tree

19 files changed

+296
-29
lines changed

19 files changed

+296
-29
lines changed

.idea/php.xml

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

.idea/redux_thunk_admin.iml

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

.idea/workspace.xml

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

app/Http/Controllers/APIController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
use Illuminate\Http\Request;
55
use App\User;
66
use Illuminate\Support\Facades\Hash;
7+
use Illuminate\Support\Facades\Storage;
78
use Illuminate\Support\Facades\Validator;
89
use Illuminate\Validation\Rule;
910
use JWTAuth;
1011
use JWTAuthException;
12+
use Illuminate\Support\Str;
1113

1214
class APIController extends Controller
1315
{
@@ -59,6 +61,12 @@ public function updateProfile(Request $request)
5961
]);
6062
}
6163

64+
if ($request->avatar){
65+
$image = $request->avatar;
66+
$name = time().'.' . explode('/', explode(':', substr($image, 0, strpos($image, ';')))[1])[1];
67+
Storage::disk('public')->putFileAs('avatar', $image,$name);
68+
$user->avatar = $name;
69+
}
6270
$user->name = $request->name;
6371
$user->email = $request->email;
6472

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"require-dev": {
2020
"facade/ignition": "^2.0",
21-
"fzaninotto/faker": "^1.9.1",
21+
"fzaninotto/faker": "^1.9.1",
2222
"mockery/mockery": "^1.3.1",
2323
"nunomaduro/collision": "^4.1",
2424
"phpunit/phpunit": "^8.5",

composer.lock

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

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"sass-loader": "^8.0.0"
2727
},
2828
"dependencies": {
29-
"react-feather": "^2.0.8",
29+
"react-feather": "^2.0.8",
3030
"react-redux": "^7.2.1",
31+
"react-router": "latest",
3132
"react-router-dom": "^5.2.0",
3233
"redux": "^4.0.5",
33-
"redux-thunk": "^2.3.0",
34-
"react-router": "latest"
34+
"redux-thunk": "^2.3.0"
3535
}
3636
}

public/avatar\1600080919.png

77.4 KB
Loading
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)