2018-08-08 19:32:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Modules\Fatture;
|
|
|
|
|
2018-10-05 11:22:32 +02:00
|
|
|
use Common\Row;
|
2018-08-08 19:32:20 +02:00
|
|
|
|
2018-09-25 16:47:44 +02:00
|
|
|
class Riga extends Row
|
2018-08-08 19:32:20 +02:00
|
|
|
{
|
|
|
|
protected $table = 'co_righe_documenti';
|
|
|
|
|
2018-09-25 16:47:44 +02:00
|
|
|
/**
|
|
|
|
* Crea una nuova riga collegata ad una fattura.
|
|
|
|
*
|
|
|
|
* @param Fattura $fattura
|
|
|
|
*
|
|
|
|
* @return self
|
|
|
|
*/
|
2018-10-02 18:25:52 +02:00
|
|
|
public static function make(Fattura $fattura)
|
2018-08-08 19:32:20 +02:00
|
|
|
{
|
2018-10-02 18:25:52 +02:00
|
|
|
$model = parent::make();
|
2018-09-25 16:47:44 +02:00
|
|
|
|
|
|
|
$model->fattura()->associate($fattura);
|
2018-09-25 11:55:52 +02:00
|
|
|
|
2018-09-25 16:47:44 +02:00
|
|
|
return $model;
|
2018-08-08 19:32:20 +02:00
|
|
|
}
|
2018-08-09 10:14:26 +02:00
|
|
|
|
2018-09-25 11:55:52 +02:00
|
|
|
public function fattura()
|
2018-08-09 10:14:26 +02:00
|
|
|
{
|
2018-09-25 11:55:52 +02:00
|
|
|
return $this->belongsTo(Fattura::class, 'iddocumento');
|
2018-08-09 10:14:26 +02:00
|
|
|
}
|
2018-08-08 19:32:20 +02:00
|
|
|
}
|