I have defined services and DAO class (to access DB) in my laravel projects. I need to create an object of the class that can access through functions. Here is the way I tried it? but it's not working
<?php
namespace App\Http\Controllers;
use App\DAO\CategoryDAO;
$categoryDAO = new CategoryDAO();
function categoryReadAll()
{
return $CategoryDAO->categoryReadAll();
}
How can I do this?