The error message indicates that the column sections.nom_region is not found in the database. Double-check that the column exists and is spelled correctly.
If the column exists, it's possible that the search query is not properly formatted. Try modifying the search query to explicitly reference the table name for the nom_region column:
$instances = DB::table('sections')
->leftJoin('regions', 'sections.id_region', '=', 'regions.id')
->leftJoin('dioceses', 'sections.id_diocese', '=', 'dioceses.id')
->select('sections.nom_section', 'dioceses.nom_diocese', 'regions.nom_region')
->addSelect(DB::raw('COALESCE(regions.nom_region, "") as nom_region'))
->where(function($query) use ($search) {
$query->where('sections.nom_section', 'LIKE', "%$search%")
->orWhere('regions.nom_region', 'LIKE', "%$search%")
->orWhere('dioceses.nom_diocese', 'LIKE', "%$search%");
})
->paginate(30);
This modified query adds a where clause to search for the nom_region column explicitly. The $search variable should contain the search term entered by the user.
Note that this solution assumes that the nom_region column exists in the regions table. If it exists in a different table, modify the query accordingly.