You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
694 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
class GeneralController extends Controller
{
public function index()
{
return inertia('Dashboard');
}
public function maintance()
{
return inertia('Maintance');
}
public function upload(Request $request)
{
$request->validate(['image' => 'required|file']);
$file = $request->file('image');
$file->store('uploads', 'public');
return response()->json([
'id' => Str::ulid(),
'name' => $file->getClientOriginalName(),
'url' => asset($file->hashName('uploads')),
]);
}
}