api code global jain

This commit is contained in:
Abhishek Mali
2025-11-05 10:37:10 +05:30
commit 52fe7e2bec
2834 changed files with 1784903 additions and 0 deletions

30
app/Models/PostImage.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
namespace App\Models;
use App\Constant\Constant;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PostImage extends Model
{
use HasFactory;
protected $fillable = [
'post_id',
'image_name',
];
/**
* @return string
*/
public function getImageNameAttribute($value): string
{
if (!empty($value)) {
// $imagePath = Constant::POST_IMAGE_UPLOAD_PATH . '/' . $value;
// return getImage($value, Constant::POST_IMAGE_UPLOAD_PATH, '');
return asset('storage/app/public/images/posts/' . $value);
}
return asset('public/images/misc/placeholder.png');; // Need to set default image
}
}