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

Loading…
Cancel
Save