I want to form an array like this:
$routes = [
array("key" => 0, "title" => "All"),
array("key" => 1, "title" => "Web Series"),
array("key" => 2, "title" => "Reality Shows"),
array("key" => 3, "title" => "Singing"),
array("key" => 4, "title" => "Vendors")
];
Here, the titles (web series, reality shows, singing) should come as a response from database:
$projectTypes = ProjectType::select('project_type_title')->get()->all();
How to populate an array like above using these values ?
Note:
array("key" => 0,
"title" => "All")
must be predefined and not fetched from database only other project types are fetched from the database
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire