mardi 29 août 2023

How to fetch data from database using multiple dropdown in form laravel 5.4?

I have blade view which is basically a form consists of 3 dropdown value such as Division,District and Upazila. Blade View

my Index blade looks like below image. Index Blade

after the submit button clicked,it shows me page not found.i don't have any idea why it didn't go to controller method. enter image description here

Route:

Route::get('booksnew/allinstbyupazila', [
                'as' => 'admin.booksnew.allinstbyupazila',
                'uses' => 'BooksNewController@allinstbyupazila']);

Controller:

public function allinstbyupazila(BooksRequest $request) {

        $module_name = $this->module_name;
        $module_icon = $this->module_icon;
        $module_model = $this->module_model;

        $module_action = "List";

        $title = "Upazila wise Institute List";
        $page_heading = $title;

        $division = $request->division_id;
        $district = $request->district_id;
        $upazila = $request->upazila_id;
        dd($request->all());

        if ($division == '' || $district == '' || $upazila == ''){
            Log::info("'$title' viewed by User:" . Auth::user()->name . '(ID:' . Auth::user()->id . ')');

            return view("backend.$module_name.upazila_input", compact('page_heading', 'title', 'module_name', 'module_icon', 'page_heading', 'module_action'));

        } else {
            if (Auth::user()->hasRole('Administrator')) {
            
                $$module_name = $module_model::where('division_id', $division)
                    ->where('district_id', $district)
                    ->where('upazila_id', $upazila)
                    ->get();
                
            }else

                return redirect()->back()->with('flash_warning', '<i class="fa fa-exclamation-triangle"></i> Do not have the permission');

        }

        Log::info("'$title' viewed by User:" . Auth::user()->name . '(ID:' . Auth::user()->id . ')');
        
        return view("backend.$module_name.index", compact('division', 'district','upazila', 'title', 'module_name', "$module_name", 'module_icon', 'page_heading', 'module_action'));

I try everything i could but didn't find any solution yet.i just need to fetch data from the dropdown value as parameter and show the fetched data in another blade view.help me asap.



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

Aucun commentaire:

Enregistrer un commentaire