mirror of
https://codeberg.org/vlw/wp.git
synced 2026-02-26 03:51:58 +01:00
wip: 2026-02-14T02:50:05+0100 (1771033805)
This commit is contained in:
parent
d8cebde6a4
commit
97b48aaf52
1 changed files with 2 additions and 2 deletions
|
|
@ -23,10 +23,10 @@
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return static|null
|
* @return static|null
|
||||||
*/
|
*/
|
||||||
public static function from_name(string $name): ?static {
|
public static function from_name(string $name, bool $slugify = true): ?static {
|
||||||
$query = Database::current()
|
$query = Database::current()
|
||||||
->from(Database::get_table(Posts::TABLE_NAME))
|
->from(Database::get_table(Posts::TABLE_NAME))
|
||||||
->where([Posts::POST_NAME->value => slugify($name)])
|
->where([Posts::POST_NAME->value => $slugify ? slugify($name) : $name])
|
||||||
->limit(1)
|
->limit(1)
|
||||||
->select(Posts::ID->value);
|
->select(Posts::ID->value);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue