Skip to content

Commit 780666d

Browse files
committed
fix(uploads): fixing upload
1 parent 9c5e35e commit 780666d

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

app/Http/Controllers/Auth/SocialitePlusController.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Http\Controllers\Auth;
44

5+
use App\Http\Controllers\Controller;
56
use App\Models\User;
6-
use Illuminate\Http\Request;
77
use Blaspsoft\SocialitePlus\SocialitePlusFactory;
8+
use Illuminate\Http\Request;
89
use Illuminate\Support\Facades\Auth;
9-
use App\Http\Controllers\Controller;
1010

1111
class SocialitePlusController extends Controller
1212
{
@@ -19,8 +19,6 @@ class SocialitePlusController extends Controller
1919

2020
/**
2121
* Create a new SocialLoginController instance.
22-
*
23-
* @param SocialitePlusFactory $socialitePlus
2422
*/
2523
public function __construct(SocialitePlusFactory $socialitePlus)
2624
{
@@ -30,7 +28,6 @@ public function __construct(SocialitePlusFactory $socialitePlus)
3028
/**
3129
* Redirect to the social login page
3230
*
33-
* @param string $provider
3431
* @return \Illuminate\Http\RedirectResponse
3532
*/
3633
public function redirect(string $provider)
@@ -47,20 +44,21 @@ public function redirect(string $provider)
4744
/**
4845
* Handle the social login callback
4946
*
50-
* @param string $provider
51-
* @param Request $request
5247
* @return \Illuminate\Http\RedirectResponse
5348
*/
5449
public function callback(string $provider, Request $request)
5550
{
56-
if (!$request->has('code')) return redirect()->route('login')->with('error', 'Invalid request');
51+
if (! $request->has('code')) {
52+
return redirect()->route('login')->with('error', 'Invalid request');
53+
}
5754

5855
$user = $this->socialitePlus->build($provider)->user();
5956

6057
$existingUser = User::where('email', $user->getEmail())->first();
6158

6259
if ($existingUser) {
6360
Auth::login($existingUser);
61+
6462
return redirect()->intended('/dashboard');
6563
}
6664

app/Http/Controllers/FileUploadController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function store(Request $request)
3838

3939
$file = $request->file('file');
4040
$originalFilename = $file->getClientOriginalName();
41-
$filename = Str::uuid() . '.' . $file->getClientOriginalExtension();
41+
$filename = Str::uuid().'.'.$file->getClientOriginalExtension();
4242

4343
// Store the file in the storage/app/uploads directory (private)
4444
$path = $file->storeAs('uploads', $filename);
@@ -77,11 +77,11 @@ public function download(FileUpload $fileUpload)
7777
}
7878

7979
// Debugging information
80-
Log::info('Download requested by User: ' . Auth::id() . ' for File: ' . $fileUpload->id . ' Path: ' . $fileUpload->path);
80+
Log::info('Download requested by User: '.Auth::id().' for File: '.$fileUpload->id.' Path: '.$fileUpload->path);
8181

8282
// Force download the file
8383
return response()->download(
84-
storage_path('app/' . $fileUpload->path),
84+
storage_path('app/'.$fileUpload->path),
8585
$fileUpload->original_filename,
8686
['Content-Type' => $fileUpload->mime_type]
8787
);

routes/web.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@
5050
->middleware(HandleSocialitePlusProviders::class)
5151
->name('login');
5252

53-
require __DIR__ . '/settings.php';
54-
require __DIR__ . '/auth.php';
53+
require __DIR__.'/settings.php';
54+
require __DIR__.'/auth.php';

0 commit comments

Comments
 (0)