Open sidebar
<?php class ClientsModel extends \Eloquent { /** * Tablo tanımı * * @var string */ protected $table = 'clients'; /** * Tablo birincil anahtar * * @var string */ protected $primaryKey = 'id'; /** * Birincil anahtara göre tabloları eşler * * @return invoices */ public function invoices() { return $this->belongsTo('InvoicesModel','id','client_id'); } } /////////////////////////////////////// <?php class InvoiceAmountsModel extends \Eloquent { /** * Tablo tanımı * * @var string */ protected $table = 'invoice_amounts'; /** * Tablo birincil anahtar * * @var string */ protected $primaryKey = 'invoice_id'; } /////////////////////////////////////// <?php class InvoiceItemsModel extends \Eloquent { /** * Tablo tanımı * * @var string */ protected $table = 'invoice_items'; /** * Tablo birincil anahtar * * @var string */ protected $primaryKey = 'invoice_id'; } /////////////////////////////////////// <?php class InvoicesModel extends \Eloquent { /** * Tablo tanımı * * @var string */ protected $table = 'invoices'; /** * Tablo birincil anahtar * * @var string */ protected $primaryKey = 'id'; /** * Birincil anahtara göre tabloları eşler * * @return invoices */ public function amounts() { return $this->belongsTo('AmountsModel','id','invoice_id'); } /** * Birincil anahtara göre tabloları eşler * * @return invoices */ public function items() { return $this->belongsTo('ItemsModel','id','invoice_id'); } }
Close sidebar
Back
Please note that all pasted data is publicly available.
Twitter
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
Twitter
GitHub
Use setting