vendredi 3 août 2018

return data is not displaying?

this is the route file
web.route

          Route::get('/', 'HomeController@index');

        //Backend Route


        Route::get('/admin', 'AdminController@index');
        Route::get('/dashboard', 'AdminController@show_dashboard');
        Route::post('/admin-dashboard','AdminController@dashboard');

           migration file 

              public function up()
            {
                Schema::create('admins', function (Blueprint $table) {
                    $table->increments('adminid');

                    $table->string('name');
                    $table->string('password');
                    //$table->string('country');
                  //  $table->string('city');
                  //  $table->string('branch');
                 //   $table->integer('branch_id')->unsigned();

                    $table->timestamps();
                });
            }

            /**
             * Reverse the migrations.
             *
             * @return void
             */
            public function down()
            {
                Schema::dropIfExists('admins');
            }
        }

this is the controller file Controller

                <?php

            namespace App\Http\Controllers;

            use Illuminate\Http\Request;
            use DB;
            use App\Http\Requests;
            use Session;
            use Illuminate\Support\Facades\Redirect;
            session_start();
            class AdminController extends Controller
            {
                public function index()
                {
                    return view('admin.admin_login');

                }


                public function show_dashboard()
                {
                    return view('admin.dashboard');
                }

                public function dashboard(Request $request)
                {

                     $admin_username=$request->admin_name;
                     $admin_passwoard=md5($request->admin_passwoard);
                     //$admin_branch=$request->admin_branch;
                    // $admin_country=$request->admin_country;
                    // $admin_city=$request->admin_city;
                    // $admin_branch_id=$request->admin_branch_id;



                     $result=DB::table('admins')
                         ->where('name',$admin_username)
                        // ->where('country',$admin_country)
                        // ->where('branch',$admin_branch)
                         ->where('password',$admin_passwoard)
                         //->where('city',$admin_city)
                        // ->where('branch_id',$admin_branch_id)
                         ->first();

                      echo "<pre>";
                      print_r($result);
                      exit();

                }
            }

it go to the correct page but mot displaying any data need quick help how to fix the problem it does not show any error but also do not also show the return value and also if i create the session then it not login it execute the else statement

Aucun commentaire:

Enregistrer un commentaire