Files
freeu-project/app/Models/Chat.php
Ritikesh yadav c661166e1d first commit
2024-03-28 14:52:40 +05:30

37 lines
861 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Chat extends Model
{
use HasFactory;
protected $fillable = ['user_id','admin_id','message','file','by'];
public function user(){
return $this->belongsTo(User::class,'user_id');
}
public function admin(){
return $this->belongsTo(User::class,'admin_id');
}
// const path = 'https://jerichoalternatives.in/public/uploads/profile/img/';
// const filePath = 'https://jerichoalternatives.in/storage/app/chat/';
public function getProfileImageAttribute($value)
{
return imagePath('public/uploads/profile/img/') . $value;
}
public function getFileAttribute($value)
{
if($value)
return imagePath('storage/app/chat/') . $value;
}
}