android - 如何通过登录应用程序访问 laravel 控制器功能
问题描述
我在我的应用程序中有这个控制器,我正在尝试使用 httpRequest 通过 android 应用程序访问该控制器,但我正在获取应用程序 bcz 的登录页面我无法在没有登录的情况下访问此功能
那么我怎样才能使其无需登录即可访问
//控制器代码
class sobha_tab_empVer_Controller extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
}
public function employeeverification(Request $request){
$EmpDetails = employees::select()
->where('employees.EMPID', '=', $request->emp_id)
//->where('vw_assembly_plan_reports.id', '=', $request->zone)
->get();
//dd($EmpDetails);
// dd($ProjectDetails);
// return response($EmpDetails);
return response()->json($EmpDetails);
}
}
//安卓端
//Some url endpoint that you may have
String myUrl = "http://......./employeeverification?emp_id=1350";
//String to place our result in
String result;
//Instantiate new instance of our class
HttpGetRequest getRequest = new HttpGetRequest();
//Perform the doInBackground method, passing in our url
try {
result = getRequest.execute(myUrl).get();
Log.e("RESULT", "RESULT: " + result);
} catch (ExecutionException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
解决方案
消除
$this->middleware('auth');
在 __construct()
推荐阅读
- java - JUnit4 - 并行启动测试套件
- c - 使用 fgets() 从 CSV 文件打印行
- angular - 类型可观察
不可分配给 Observable 类型 > - wordpress - 如何在代码模板中使用特定标签过滤 woocommerce 网店中的所有产品?
- google-app-engine - 使用 Flask 和 GAE 的 ImportError
- php - 将自定义数据添加到 laravel 日志
- c# - 文化不变量 bool.TryParse
- sql - 创建一个带有预填充列的临时表
- android - Sonarqube 在 xamarin android 中显示为返回类型的错误
- mysql - 分析模式(每天获取视图)