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

View File

@@ -0,0 +1,55 @@
<?php
namespace App\Models;
use App\Models\Sant;
use App\Models\User;
use App\Models\Sangh;
use Illuminate\Database\Eloquent\Model;
class Notifications extends Model
{
protected $table = 'notifications';
protected $casts = [
'extra_fields' => 'array',
];
public function getCreatedAtAttribute()
{
if(isset($this->attributes['created_at'])) {
return str_replace('-', '/', $this->attributes['created_at']);
}
}
/**
* @return mixed
*/
public function user()
{
return $this->belongsTo(User::class, 'extra_fields->user_id');
}
/**
* @return mixed
*/
public function sant()
{
return $this->belongsTo(Sant::class, 'extra_fields->from_id');
}
/**
* @return mixed
*/
public function sangh()
{
return $this->belongsTo(Sangh::class, 'extra_fields->sangh_id');
}
public function getAttribute($key)
{
[$key, $path] = preg_split('/(->|\.)/', $key, 2) + [null, null];
return data_get(parent::getAttribute($key), $path);
}
}