PMC-585-A

This commit is contained in:
Roly Rudy Gutierrez Pinto
2019-05-15 20:20:24 -04:00
parent 5d8949255b
commit bc1862db3d
5 changed files with 670 additions and 38 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace ProcessMaker\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
/**
* Class Dynaform
* @package ProcessMaker\Model
*
* Represents a dynaform object in the system.
*/
class Dynaform extends Model
{
protected $table = 'DYNAFORM';
public $timestamps = false;
public function process()
{
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
}
/**
* Get dynaforms by PRO_UID.
* @param string $proUid
* @return object
*/
public static function getByProUid($proUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.PRO_UID', '=', $proUid)
->get();
}
/**
* Get dynaform by DYN_UID.
* @param string $dynUid
* @return object
*/
public static function getByDynUid($dynUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.DYN_UID', '=', $dynUid)
->first();
}
/**
* Get dynaforms by PRO_UID except the DYN_UID specified in the second parameter.
* @param string $proUid
* @param string $dynUid
* @return object
*/
public static function getByProUidExceptDynUid($proUid, $dynUid)
{
return DB::table('DYNAFORM')
->select()
->where('DYNAFORM.PRO_UID', '=', $proUid)
->where('DYNAFORM.DYN_UID', '!=', $dynUid)
->get();
}
}