Skip to content

Instantly share code, notes, and snippets.

@varyym
Created November 2, 2015 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save varyym/1e69c4b182eed0fa2353 to your computer and use it in GitHub Desktop.
Save varyym/1e69c4b182eed0fa2353 to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use SleepingOwl\Models\SleepingOwlModel;
class Company extends SleepingOwlModel
{
public static function boot()
{
parent::boot();
static::deleting(function ($item)
{
//dd('Deleting event handler executed on item #' . $item->id);
});
}
protected $fillable = [
'title',
'address',
'phone',
'mydate'
];
protected $hidden = [
'created_at',
'updated_at'
];
public function scopeDefaultSort($query)
{
return $query->orderBy('title', 'asc');
}
public function contacts()
{
return $this->belongsToMany('Contact');
}
public static function getList()
{ //dd(static::lists('title', 'id')->all());
//return static::lists('title', 'id')->all();
return ["1"=>"2"];
}
public function getDates()
{
return array_merge(parent::getDates(), ['mydate']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment