Last active
August 29, 2015 14:02
-
-
Save that0n3guy/e8c25b6146f5b5b896ed to your computer and use it in GitHub Desktop.
ocalist model and contact model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace OCA\Blasts\Models; | |
use Model; | |
/** | |
* Contact Model | |
*/ | |
class Contact extends Model | |
{ | |
/** | |
* @var string The database table used by the model. | |
*/ | |
public $table = 'oca_blasts_contacts'; | |
/** | |
* @var array Guarded fields | |
*/ | |
protected $guarded = ['*']; | |
/** | |
* @var array Fillable fields | |
*/ | |
protected $fillable = ['firstname','lastname','name','email','phone']; | |
/** | |
* @var array Validation rules | |
*/ | |
public $rules = ['phone'=>'required']; | |
/** | |
* @var array Relations | |
*/ | |
public $morphToMany = [ | |
'lists' => ['OCA\Blasts\Models\Ocalist', 'table' => 'oca_blasts_ocalistables', 'name'=>'ocalistable'], // @todo need timestamps | |
]; | |
} | |
<?php namespace OCA\Blasts\Models; | |
use Model; | |
/** | |
* Ocalist Model | |
*/ | |
class Ocalist extends Model | |
{ | |
/** | |
* @var string The database table used by the model. | |
*/ | |
public $table = 'oca_blasts_ocalists'; | |
/** | |
* @var array Guarded fields | |
*/ | |
protected $guarded = ['*']; | |
/** | |
* @var array Fillable fields | |
*/ | |
protected $fillable = ['name']; | |
/** | |
* @var array Validation rules | |
*/ | |
public $rules = ['name'=>'required']; | |
/** | |
* @var array Relations | |
*/ | |
public $morphedByMany = [ | |
'contacts' => ['OCA\Blasts\Models\Contact', 'table' => 'oca_blasts_ocalistables', 'name'=>'ocalistable'], | |
]; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment