usually query on model

how to change this "SELECT a., as name_cat, r., as name_al FROM gallery_category a LEFT JOIN gallery r ON a.default_image ="

to instead use a model?


Creating the models => Setting the relationships => Finding records =>

When you set the relationships and search a record, the record will have a property with the name of the associated table, so you can access it's properties from the original record.


I've tried it but to no avail did not show me the results in Table gallery


You don't show the results in the model; you return then from the model to the controller, and there set up for the view.