37 lines
861 B
PHP
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;
|
|
}
|
|
}
|