hi good morning community today I would like to ask you how to do a scope in Laravel but this is related to other tables, here in the example I'm looking directly only the id of the installer and I need to look for it through the name but when I try to relate it Why does getinstalador give me any advice I can give? you would be grateful
namespace App;
use Illuminate \ Database \ Eloquent \ Model;
class Installer_point extends Model { protected $ fillable = ['punto_id', 'instalador_id', 'cant_dia', 'fecha_inicio', 'fecha_fin'];
public function getinstalador () {
return $ this-> belongsTo (Installer :: class, 'installer_id');
}
public function getpunto () { return $ this-> belongsTo (Point :: class, 'point_id');
} public function scopeSearch ($ query, $ installer_id) { return $ query-> where ('installer_id', 'LIKE', "% $ installer_id%");
}
//
}
public function instaladoresindex(Punto $punto, Request $request)
{
$instaladores = Instalador_punto::Search($request->instalador_id)->orderBy('id', 'ASC')->paginate(10);
return view('/puntos/instaladores/instaladoresindex')->with(compact('instaladores','punto'));
//
}
id)}} ">
{{csrf_field ()}}
Search for