1. Go to this page and download the library: Download lfyw/file-manager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class FilesController extends Controller
{
public function store(Request $request)
{
return \Lfyw\FileManager\Models\File::upload($request->file('file'), $keepOriginalName = false, $guessExtension = true);
}
}
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Lfyw\FileManager\Traits\HasFiles;
class User extends Authenticatable
{
use HasFactory, Notifiable, HasFiles;