PHP code example of fauzantaqiyuddin / laravel-minio
1. Go to this page and download the library: Download fauzantaqiyuddin/laravel-minio 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/ */
fauzantaqiyuddin / laravel-minio example snippets
bash
php artisan vendor:publish --provider="Fauzantaqiyuddin\LaravelMinio\MiniojanServiceProvider"
namespace App\Http\Controllers;
use Fauzantaqiyuddin\LaravelMinio\Facades\Miniojan;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function uploadFile(Request $request)
{
$request->validate([
'berkas' => 'file ke MinIO
$response = Miniojan::upload($directory, $filePath);
unlink($filePath);
return back()->with('message', $response);
}
public function getFileUrl(Request $request)
{
$request->validate([
'file_name' => ');
$fileName = $request->input('file_name');
$directory = $request->input('directory');
$response = Miniojan::delete($directory, $fileName);
return back()->with('message', $response);
}