First time I'm working with multi-tenant, and I have multiple tenants, the thing is that I don't know how to upload to Storage to the corresponding tenant image.
For example: Tenant 1: Upload your company logo
Tenant 2: Upload your own company logo
I'm currently working with tenant 59138 (storage/app/tenancy/tenants/59138/[here add image folder]
Config Filesystems
'tenancy' => [
'driver' => 'local',
'root' => storage_path('app/tenancy/tenants/'),
],
Controller
public function storeImage(Request $request){
//dd($request->all());
if ($request->file('logo')) {
$fileLogo = $request->file('logo');
$path = Storage::disk('tenancy')->put('public',$fileLogo);
}
}
public function uploadFile(Request $request){
$File = $request->file('data');
//First Parameter is the Folder Name and Second Parameter is the File Object
$stored = \Storage::disk('public')->put("your_folder_name", $File);
$url = tenant_asset($stored);
return response()->json(['success' =>$url], 200);
}