for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Prateekkarki\Laragen\Models\Types\Relational;
use Prateekkarki\Laragen\Models\Types\RelationalType;
class SingleType extends RelationalType
{
protected $dataType = 'integer';
protected $hasSingleRelation = true;
protected $size = false;
protected $relationalType = false;
protected $formType = 'parent';
protected $stubs = [
'modelMethod' => 'common/Models/fragments/hasOne',
'foreignMethod' => 'common/Models/fragments/belongsTo'
];
public function getValidationRule() {
return 'exists:'.$this->getRelatedModule().',id';
}
public function hasSelfParent(){
return ($this->typeOption == $this->getParentModule() || $this->typeOption == "self");
public function getColumnKey()
return $this->columnName . "_id";