Browse Source

Update Outlet model docblocks

pull/3/head
Nafies Luthfi 7 years ago
parent
commit
e5818f1300
  1. 30
      app/Outlet.php

30
app/Outlet.php

@ -7,14 +7,29 @@ use Illuminate\Database\Eloquent\Model;
class Outlet extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'address', 'latitude', 'longitude', 'creator_id',
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
public $appends = [
'coordinate', 'map_popup_content',
];
/**
* Get outlet name_link attribute.
*
* @return string
*/
public function getNameLinkAttribute()
{
$title = __('app.show_detail_title', [
@ -28,11 +43,21 @@ class Outlet extends Model
return $link;
}
/**
* Outlet belongs to User model relation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function creator()
{
return $this->belongsTo(User::class);
}
/**
* Get outlet coordinate attribute.
*
* @return string|null
*/
public function getCoordinateAttribute()
{
if ($this->latitude && $this->longitude) {
@ -40,6 +65,11 @@ class Outlet extends Model
}
}
/**
* Get outlet map_popup_content attribute.
*
* @return string
*/
public function getMapPopupContentAttribute()
{
$mapPopupContent = '';

Loading…
Cancel
Save