findByField

Navigation:  Development > Function Reference > Model >

findByField

Previous pageReturn to chapter overviewNext page

This is a type of find method but here we can apply condition by Magic Method. See bellow format
 
App::Model(Model)->findBy[Field]([Value]);
 

Return single entry from the table.

 
Here [Field] is any database field of table, [Value] is a data that we want to apply in the query.
 
For example:
 
App::Model('Page')->findById(5);
App::Model('Page')->findByName('about-us');