for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Redaxscript\Model;
/**
* abstract class to create a model class
*
* @since 4.0.0
* @package Redaxscript
* @category Model
* @author Henry Ruhs
*/
abstract class ContentAbstract extends ModelAbstract
{
* get all by order
* @param string $orderColumn name of the column to order
* @return object|null
public function getAllByOrder(string $orderColumn = null) : ?object
return $this->query()->orderBySetting($orderColumn)->findMany() ? : null;
}
* get the content by language and order
* @param string $language
public function getByLanguageAndOrder(string $language = null, string $orderColumn = null) : ?object
return $this
->query()
->whereLanguageIs($language)
->where('status', 1)
->orderBySetting($orderColumn)
->findMany() ? : null;
* get the content by id and language and order
* @param int $contentId
public function getByIdAndLanguageAndOrder(int $contentId = null, string $language = null, string $orderColumn = null) : ?object
->whereIn('id', $this->getIdArrayBySibling($contentId))
* get id array by sibling
* @param int $siblingId identifier of the content
* @return array|null
public function getIdArrayBySibling(int $siblingId = null) : ?array
->select('id')
->whereAnyIs(
[
'id' => $siblingId
],
'sibling' => $siblingId
]
])
->findFlatArray();
* publish by date
* @since 3.3.0
* @param string $date
* @return int
public function publishByDate(string $date = null) : int
->whereLt('date', $date)
->where('status', 2)
->findMany()
->set('status', 1)
->save()
->count();