@nicho What you are doing man?
That's not how you should write laravel code!
If you want to improve your code, my suggestion to watch this series first: https://laracasts.com/series/laravel-8-from-scratch
I want to add a video in to the row of gallery column, i am able to upload an image into the row of gallery, and i want to upload the video into that row of gallery as well
The Blade :
<div class="form-group">
<label class="control-label">{{__("Gallery")}}</label>
{!! \Modules\Media\Helpers\FileHelper::fieldGalleryUpload('gallery',$row->gallery) !!}
</div>
The FileHelper :
public static function fieldGalleryUpload($inputId = '', $oldValue = '')
{
$oldIds = $oldValue ? explode(',', $oldValue) : [];
ob_start();
?>
<div class="dungdt-upload-multiple <?php if (!empty($file)) echo 'active' ?>" data-val="<?php echo $oldValue ?>">
<div class="attach-demo d-flex">
<?php
foreach ($oldIds as $id) {
$file = (new MediaFile())->findById($id);
if (!empty($file)) {
?>
<div class="image-item">
<div class="inner">
<?php
$oldPath = '';
if (!empty($file)){$oldPath = $file->getEditPath();}
?>
<a class="edit-img btn btn-sm btn-primary edit-multiple" data-id="<?php echo $id ?>" data-file="<?php echo $oldPath ?>"><i class="fa fa-edit"></i></a>
<span class="delete btn btn-sm btn-danger"><i class="fa fa-trash"></i></span><img src="<?php echo FileHelper::url($file, 'thumb').'?time='.strtotime('now') ?>" class="image-responsive image-preview">
</div>
</div>
<?php
}
}
?>
</div>
<div class="upload-box" v-show="!value">
<input type="hidden" name="<?php echo $inputId ?>" v-model="value" value="<?php echo htmlspecialchars($oldValue) ?>">
<div class="text-left">
<span class="btn btn-info btn-sm btn-field-upload" @click="openUploader"><i class="fa fa-plus-circle"></i> <?php echo __("Select images") ?></span>
</div>
</div>
</div>
<?php
return ob_get_clean();
}
@Nicho So my opinion is you should re-write the part you touch. Because there is no point to maintain such legacy code that pulls you back from your development process.
The general process for how to upload videos:
/storage directory)where/did/you/upload/your/videofile)Please or to participate in this conversation.