I am trying to pass a value from the URL to a controller to get data with the string from the URL, here is the route that passes the data to the controller this is working fine, and the correct values are making it to the controller
Route::middleware('auth:api')->get('test/{name}', 'EmployeeController@getAllEmployees');
I have tried $name, "$name" , '$name' , '%' . $name . '%' , '%$name%'
class EmployeeController extends Controller
{
public function getAllEmployees($name)
{
$model = Employee::where('Name', 'LIKE', $name)->get();
return $model->tojson();
}
}
Here is the error, as you can see the value doesn't have any quote marks around it which is what sqlsrv is tripping up with when running the query
"SQLSTATE[42S02]: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Invalid object name 'Tabel_Name'. (SQL: select * from [Tabel_Name] where [Name] LIKE test)",
what am i doing wrong?
Laravel 5.5 sqlsrv php 7.0