api code global jain
This commit is contained in:
30
app/Models/PostImage.php
Normal file
30
app/Models/PostImage.php
Normal 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user