Início / Optitravel / Models
findAll()
This method retrieves all records from the model's associated database table. It’s useful when you want to fetch all entries without any specific conditions or filters.
By default, it returns all columns (*), but you can modify this behavior by using other methods or by specifying columns directly in queries.
Returns:
- An array of objects, each representing a record from the table.
Example
use \App\Models\User;
$user = new User();
$users = $user->findAll();
foreach ($users as $user) {
echo $user->name;
}
↑ (Última atualização: 06/05/2025)