vendredi 9 décembre 2022

Controller does not exist in laravel 5.6

I have this error where it said that the controller does not exist

My routes

use App\Http\Controllers\PasienController;  
Route::resource('/pasien', PasienController::class)->only(['index']);

The controller

<?php

namespace App\Http\Controllers;

use App\Token;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use RealRashid\SweetAlert\Facades\Alert;

class PasienController extends Controller
{
    public function index(Request $request)
    {
        $patient = null;
        if (isset($request->nik)) {
            $response = $this->patient_by_nik($request->nik);
            $data = $response->getData();
            if ($response->status() == 200) {
                if ($data->total) {
                    $patient = $data->entry[0]->resource;
                    Alert::success($response->statusText(), 'Pasien Ditemukan');
                } else {
                    Alert::error('Not Found', 'Pasien Tidak Ditemukan');
                }
            } else {
                Alert::error($response->statusText() . ' ' . $response->status());
            }
        }
        
}

I was trying to get data from an API and return the data



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/u3t8Ynq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire