update addon HRM
Some checks failed
Some checks failed
This commit is contained in:
@@ -19,7 +19,6 @@ public function index()
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'purchase_code' => 'required',
|
||||
'file' => 'required|file|mimes:zip',
|
||||
]);
|
||||
|
||||
@@ -27,7 +26,7 @@ public function store(Request $request)
|
||||
$is_valid = true;
|
||||
$module_name = pathinfo($request->file('file')->getClientOriginalName(), PATHINFO_FILENAME);
|
||||
|
||||
if ($is_valid || $request->purchase_code == 'acnoo_license') {
|
||||
if (true) {
|
||||
|
||||
$uploadedFile = $request->file('file');
|
||||
// Open the ZIP file using ZipArchive without saving it first
|
||||
|
||||
49
app/Traits/ImageUrlTrait.php
Normal file
49
app/Traits/ImageUrlTrait.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
trait ImageUrlTrait
|
||||
{
|
||||
/**
|
||||
* Automatically prepend the base URL to image fields.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttribute($key)
|
||||
{
|
||||
$value = parent::getAttribute($key);
|
||||
|
||||
// Check if the current key is in the imageFields array
|
||||
if (isset($this->imageFields) && in_array($key, $this->imageFields) && $value) {
|
||||
// Check if it's already a full URL
|
||||
if (!filter_var($value, FILTER_VALIDATE_URL)) {
|
||||
return asset($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle serialization to array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributesToArray()
|
||||
{
|
||||
$attributes = parent::attributesToArray();
|
||||
|
||||
if (isset($this->imageFields)) {
|
||||
foreach ($this->imageFields as $field) {
|
||||
if (isset($attributes[$field]) && $attributes[$field]) {
|
||||
if (!filter_var($attributes[$field], FILTER_VALIDATE_URL)) {
|
||||
$attributes[$field] = asset($attributes[$field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user