Level 8
Where exactly are you not making a headway? Are the files not being uploaded at all to local storage? Or are they not being uploaded to s3?
Which is it?
I'm trying to figure out what I'm doing wrong. I'm trying to attempt the following.
I have even recreated a symbolic link with the php artisan storage:link comamnd.
The problem I'm facing is making sure that the images are viewable after redirect from the view from the right location whether it be from S3 bucket or local storage.
foreach ($request->file('contract_asset') as $file) {
$path = Storage::disk('local')->putFile(Carbon::now()->toDateString().'/roofing/projects/'.$project->id.'/contract-assets', $file, 'public');
$project->addContractAsset('contract', $path);
}
$contractAssets = Storage::allFiles(Carbon::now()->toDateString().'/roofing/projects/'.$project->id.'/contract-assets');
ProcessRoofingProjectAssets::dispatch('contract', $contractAssets, $project);
public function addContractAsset($category, $asset)
{
$contract_asset_urls = json_decode($this->contract_asset_urls, true);
$contract_asset_urls[] = ['category' => $category, 'url' => $asset];
$this->update([
'contract_asset_urls' => json_encode($contract_asset_urls)
]);
if ($category == 'approval') {
event(new AssociationApprovalAssetUploaded($this));
}
}
@if( $file_info["extension"] == 'pdf')
<a href="{{ asset($asset->url) }}" target="_blank"><i class="fa fa-file-pdf-o" style="font-size: 40px"></i></a>
@else
<a href="{{ asset($asset->url) }}"
data-lightbox="contract-lightbox"
data-title="<a href='{{ Storage::url($asset->url)}}' target='_blank' class='btn btn-xs btn-info no-mobile-change' style='color: #FFF'>View Full Size</a>"><img
src="{{ Storage::url($asset->url) }}"
class="img-fluid"/>
</a>
@endif
Please or to participate in this conversation.