api code global jain
This commit is contained in:
53
app/Models/SantLocation.php
Normal file
53
app/Models/SantLocation.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use App\Models\Traits\SantLocation\Relationships\SantLocationRelationships;
|
||||
|
||||
class SantLocation extends Model
|
||||
{
|
||||
use HasFactory, SantLocationRelationships;
|
||||
|
||||
protected $appends = ['created_ago', 'updated_ago'];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'sant_id',
|
||||
'sangh_id',
|
||||
'type',
|
||||
'location',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'created_by',
|
||||
'updated_by'
|
||||
];
|
||||
|
||||
protected $guarded = [
|
||||
'id',
|
||||
];
|
||||
|
||||
/**
|
||||
* Returns model in days since created_at.
|
||||
*/
|
||||
public function getCreatedAgoAttribute() {
|
||||
return $this->created_at->diffForHumans();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns model in days since updated_at.
|
||||
*/
|
||||
public function getUpdatedAgoAttribute() {
|
||||
if ($this->updated_at) {
|
||||
return $this->updated_at->diffForHumans();
|
||||
} else {
|
||||
return Constant::NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user