lundi 26 septembre 2016

"Fatal error: Class 'DB' not found" from public php file

I have just started using Laravel and I would like to be able to access the DB class from within a php file of which is located within the public folder.

I get the error "Fatal error: Class 'DB' not found". The php file is accessed by an AJAX require therefore there is no routing to this file

How do I allow my php file to access this class and similar classes to this that are available in Laravel?

File Path:

public/php/ajaxLogin.php

function getPrimaryAdd($user) {
    $result = DB::table('users')
        ->join('address', 'user_address.address_id', '=', 'address.address_id')
        ->select('address.address_id', 'longitude', 'latitude')
        ->where('user_id', $user)
        ->limit(1);
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire