mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-08 01:14:29 +01:00
Icon controller
This commit is contained in:
parent
dfc8a70ec8
commit
5ef450566c
32
app/Http/Controllers/IconController.php
Normal file
32
app/Http/Controllers/IconController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
|
||||
class IconController extends Controller
|
||||
{
|
||||
/**
|
||||
* Handle uploaded qr code image
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function upload(Request $request)
|
||||
{
|
||||
|
||||
if($request->hasFile('icon')){
|
||||
|
||||
$path = $request->file('icon')->storePublicly('public');
|
||||
|
||||
return response()->json('storage/' . pathinfo($path)['basename'], 201);
|
||||
}
|
||||
else {
|
||||
return response()->json('no file in $request', 204);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user