FOF30\Model\DataModel::firstOrCreate PHP Method

firstOrCreate() public method

Return the first item found or create a new one based on the provided $data
public firstOrCreate ( array $data ) : static
$data array Data for the newly created item
return static
    public function firstOrCreate($data)
    {
        $item = $this->get(true, 0, 1)->first();
        if (is_null($item)) {
            $item = clone $this;
            $item->create($data);
        }
        return $item;
    }