Skip to content

Commit e449f0a

Browse files
committed
Add new files
2 parents 2dfae8d + b685f53 commit e449f0a

32 files changed

+279
-590
lines changed

README.md

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,6 @@ Une fois que vous avez installé et configuré, pour avoir des dummy data vous d
5656
php artisan db:seed --class=DummyDatabaseSeeder
5757
```
5858

59-
### Media Library Pro (optionnel)
60-
Pour que l'upload de fichier fonctionne en local (pour les elements qui utilise Media Library Pro comme la modification de la photo de profil) vous devez renseignez la Licence avec votre compte de Spatie. Pour ce projet une licence commune est disponible etant une `single Licence` pour ce projet uniquement. Vous devez copier coller ce code dans le fichier `auth.json` qui a ete cree a la racine et relancer la commande `composer install`
61-
62-
```json
63-
{
64-
"http-basic": {
65-
"satis.spatie.be": {
66-
"username": "<YOUR-SPATIE.BE-ACCOUNT-EMAIL-ADDRESS-HERE>",
67-
"password": "<YOUR-MEDIA-LIBRARY-PRO-LICENSE-KEY-HERE>"
68-
}
69-
}
70-
}
71-
```
72-
7359
### Github Authentication (optionnel)
7460
Pour que l'authentification Github fonctionne localement, vous devez [enregistrer une nouvelle application OAuth sur Github](https://github.com/settings/applications/new). Utilisez `http://laravel.cm.test` pour l'URL de la page d'accueil et `http://laravel.cm.test/auth/github` pour l'URL de rappel. Lorsque vous avez créé l'application, remplissez l'ID et le secret dans votre fichier `.env` dans les variables d'environnement ci-dessous. Vous devriez maintenant pouvoir vous authentifier avec Github.
7561

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Http\Controllers;
6+
7+
use Illuminate\Http\Request;
8+
use Illuminate\Http\UploadedFile;
9+
use Illuminate\Support\Facades\Auth;
10+
11+
final class FileUploadController extends Controller
12+
{
13+
public function process(Request $request): void
14+
{
15+
/** @var \App\Models\User $user */
16+
$user = Auth::user();
17+
18+
/** @var UploadedFile[] $files */
19+
$files = $request->allFiles();
20+
21+
if (empty($files)) {
22+
abort(422, __('Aucun fichier n\'a été uploader'));
23+
}
24+
25+
if (count($files) > 1) {
26+
abort(422, __('Un seul fichier peut être téléchargé à la fois.'));
27+
}
28+
29+
$requestKey = array_key_first($files);
30+
31+
$file = is_array($request->input($requestKey))
32+
? $request->file($requestKey)[0] // @phpstan-ignore-line
33+
: $request->file($requestKey);
34+
35+
$user->addMedia($file)->toMediaCollection('avatar');
36+
$user->avatar_type = 'storage';
37+
$user->save();
38+
}
39+
}

app/Http/Controllers/User/SettingController.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function update(UpdateProfileRequest $request): RedirectResponse
3535
'name' => $request->name,
3636
'email' => $request->email,
3737
'username' => strtolower($request->username),
38-
'bio' => trim(strip_tags($request->bio)),
38+
'bio' => trim(strip_tags((string) $request->bio)),
3939
'twitter_profile' => $request->twitter_profile,
4040
'github_profile' => $request->github_profile,
4141
'linkedin_profile' => $request->linkedin_profile,
@@ -44,13 +44,6 @@ public function update(UpdateProfileRequest $request): RedirectResponse
4444
'website' => $request->website,
4545
]);
4646

47-
if ($request->avatar) {
48-
$user->addFromMediaLibraryRequest($request->avatar)
49-
->toMediaCollection('avatar');
50-
$user->avatar_type = 'storage';
51-
$user->save();
52-
}
53-
5447
if ($request->email !== $emailAddress) {
5548
$user->email_verified_at = null;
5649
$user->save();

app/Http/Requests/UpdateProfileRequest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66

77
use Illuminate\Foundation\Http\FormRequest;
88
use Illuminate\Support\Facades\Auth;
9-
use Spatie\MediaLibraryPro\Rules\Concerns\ValidatesMedia;
109

1110
class UpdateProfileRequest extends FormRequest
1211
{
13-
use ValidatesMedia;
14-
1512
/**
1613
* Determine if the user is authorized to make this request.
1714
*
@@ -37,9 +34,6 @@ public function rules(): array
3734
'github_profile' => 'max:255|nullable|unique:users,github_profile,'.Auth::id(),
3835
'bio' => 'nullable|max:160',
3936
'website' => 'nullable|url',
40-
'avatar' => $this->validateSingleMedia()
41-
->extension(['png', 'jpg', 'jpeg', 'gif'])
42-
->maxItemSizeInKb(1024),
4337
];
4438
}
4539
}

auth.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

composer.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"spatie/laravel-feed": "^4.1",
4040
"spatie/laravel-google-fonts": "^1.2",
4141
"spatie/laravel-medialibrary": "^10.4.3",
42-
"spatie/laravel-medialibrary-pro": "^2.0.0",
4342
"spatie/laravel-permission": "^5.1",
4443
"spatie/laravel-sitemap": "^6.1",
4544
"stevebauman/location": "^6.2",
@@ -134,10 +133,6 @@
134133
},
135134
"prefer-stable": true,
136135
"repositories": [
137-
{
138-
"type": "composer",
139-
"url": "https://satis.spatie.be"
140-
},
141136
{
142137
"type": "vcs",
143138
"url": "https://github.com/laravel-shift/uniquewith-validator.git"

composer.lock

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

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
"axios": "^0.21.1",
3939
"canvas-confetti": "^1.4.0",
4040
"choices.js": "^9.0.1",
41+
"filepond": "^4.30.4",
42+
"filepond-plugin-file-validate-size": "^2.2.8",
43+
"filepond-plugin-file-validate-type": "^1.2.8",
44+
"filepond-plugin-image-preview": "^4.6.11",
4145
"highlight.js": "^11.7.0",
4246
"htm": "^3.1.0",
4347
"intl-tel-input": "^17.0.13",

public/js/app.js

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

public/js/app.js.LICENSE.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
/*!
2+
<<<<<<< HEAD
3+
=======
4+
* FilePond 4.30.4
5+
* Licensed under MIT, https://opensource.org/licenses/MIT/
6+
* Please visit https://pqina.nl/filepond/ for details.
7+
*/
8+
9+
/*!
10+
* FilePondPluginFileValidateSize 2.2.8
11+
* Licensed under MIT, https://opensource.org/licenses/MIT/
12+
* Please visit https://pqina.nl/filepond/ for details.
13+
*/
14+
15+
/*!
16+
* FilePondPluginFileValidateType 1.2.8
17+
* Licensed under MIT, https://opensource.org/licenses/MIT/
18+
* Please visit https://pqina.nl/filepond/ for details.
19+
*/
20+
21+
/*!
22+
* FilePondPluginImagePreview 4.6.11
23+
* Licensed under MIT, https://opensource.org/licenses/MIT/
24+
* Please visit https://pqina.nl/filepond/ for details.
25+
*/
26+
27+
/*!
28+
>>>>>>> b685f538ad416e9838d8def7efcb09ec481d8d02
229
* Fuse.js v3.4.6 - Lightweight fuzzy-search (http://fusejs.io)
330
*
431
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)

public/mix-manifest.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{
2+
<<<<<<< HEAD
23
"/js/app.js": "/js/app.js?id=cfb3a1c355f3a16467153c28d697dfd6",
4+
=======
5+
"/js/app.js": "/js/app.js?id=67618e971ac9ca37c6e546e6f96fd9b7",
6+
>>>>>>> b685f538ad416e9838d8def7efcb09ec481d8d02
37
"/css/app.css": "/css/app.css?id=3af27984478dd97b9f235dede4b2ea68"
48
}

resources/css/file-upload.css

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.filepond--root {
2+
@apply mb-0 overflow-hidden;
3+
}
4+
5+
.filepond--panel-root {
6+
@apply rounded-lg border border-skin-input bg-skin-input shadow-sm;
7+
}
8+
9+
.filepond--drip-blob {
10+
@apply bg-skin-card;
11+
}
12+
13+
.filepond--drop-label {
14+
@apply text-skin-muted;
15+
}
16+
17+
/* Compact-only styles, excluding compact circle layouts */
18+
19+
.filepond--root[data-style-panel-layout='compact'] .filepond--item {
20+
@apply mb-0.5;
21+
}
22+
23+
.filepond--root[data-style-panel-layout='compact'] .filepond--drop-label label {
24+
@apply text-sm;
25+
}
26+
27+
.filepond--root[data-style-panel-layout='compact'] .filepond--drop-label {
28+
min-height: 2.625em;
29+
}
30+
31+
.filepond--root[data-style-panel-layout='compact'] .filepond--file {
32+
padding-top: 0.5em;
33+
padding-bottom: 0.5em;
34+
}
35+
36+
/* Grid styles */
37+
38+
.filepond--root[data-style-panel-layout='grid'] .filepond--item {
39+
width: calc(50% - 0.5em);
40+
display: inline;
41+
}
42+
43+
@media screen(lg) {
44+
.filepond--root[data-style-panel-layout='grid'] .filepond--item {
45+
width: calc(33.33% - 0.5em);
46+
}
47+
}
48+
49+
/* Download button styles */
50+
51+
.filepond--download-icon {
52+
@apply pointer-events-auto mr-1 inline-block h-4 w-4 bg-white align-bottom hover:bg-white/70;
53+
-webkit-mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZG93bmxvYWQiPjxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+PHBvbHlsaW5lIHBvaW50cz0iNyAxMCAxMiAxNSAxNyAxMCI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIxNSIgeDI9IjEyIiB5Mj0iMyI+PC9saW5lPjwvc3ZnPg==');
54+
mask-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJmZWF0aGVyIGZlYXRoZXItZG93bmxvYWQiPjxwYXRoIGQ9Ik0yMSAxNXY0YTIgMiAwIDAgMS0yIDJINWEyIDIgMCAwIDEtMi0ydi00Ij48L3BhdGg+PHBvbHlsaW5lIHBvaW50cz0iNyAxMCAxMiAxNSAxNyAxMCI+PC9wb2x5bGluZT48bGluZSB4MT0iMTIiIHkxPSIxNSIgeDI9IjEyIiB5Mj0iMyI+PC9saW5lPjwvc3ZnPg==');
55+
-webkit-mask-repeat: no-repeat;
56+
mask-repeat: no-repeat;
57+
-webkit-mask-size: 100%;
58+
mask-size: 100%;
59+
}
60+
61+
.filepond--open-icon {
62+
@apply pointer-events-auto mr-1 inline-block h-4 w-4 bg-white align-bottom hover:bg-white/70;
63+
-webkit-mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTYgdy02IiBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjIiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTEwIDZINmEyIDIgMCAwMC0yIDJ2MTBhMiAyIDAgMDAyIDJoMTBhMiAyIDAgMDAyLTJ2LTRNMTQgNGg2bTAgMHY2bTAtNkwxMCAxNCIgLz4KPC9zdmc+Cg==);
64+
mask-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGNsYXNzPSJoLTYgdy02IiBmaWxsPSJub25lIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHN0cm9rZT0iY3VycmVudENvbG9yIiBzdHJva2Utd2lkdGg9IjIiPgogIDxwYXRoIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTEwIDZINmEyIDIgMCAwMC0yIDJ2MTBhMiAyIDAgMDAyIDJoMTBhMiAyIDAgMDAyLTJ2LTRNMTQgNGg2bTAgMHY2bTAtNkwxMCAxNCIgLz4KPC9zdmc+Cg==);
65+
-webkit-mask-repeat: no-repeat;
66+
mask-repeat: no-repeat;
67+
-webkit-mask-size: 100%;
68+
mask-size: 100%;
69+
}

0 commit comments

Comments
 (0)