没有错误,但未显示数据,正在处理中

时间:2019-06-11 13:13:48

标签: php laravel laravel-5.1

enter image description here 这些是我的文件,没有以html显示我的数据,只有数据正在处理,也没有错误。我想通过laravel在html文件中查看我的数据库,但它只是在处理,也不显示任何错误。所以请帮我解决这个错误。

  • 没有错误,ajax响应良好,但是未显示数据,并且处理框一直显示。

  • Yajra 9.0

  • Laravel 5.8

MemberController.php

<?php

namespace App\Http\Controllers;
use App\Models\Member;
use Illuminate\Http\Request;
use Datatables;
use Validator;

class MemberController extends Controller
{
public function addSocialMember(){
  return view("home.views.social-member");
}

public function listMember(){
  return view("home.views.memberlist");
}

public function listAllMember(){
  $memberlist = Member::query();
  return Datatables::of($memberlist)->make(true);
}

public function saveMember(Request $request){
    $validator = Validator::make(array(
      "name"=>$request->name,
      "email"=>$request->email,
      "phone"=>$request->phone,
      "state"=>$request->state,
      "city"=>$request->city,
      "issue"=>$request->issue,
      "message"=>$request->message,
    ),array(
      "name"=>"required",
      "email"=>"required|unique:member",
      "phone"=>"required",
      "state"=>"required",
      "city"=>"required",
      "issue"=>"required",
      "message"=>"required",
    ));

    if($validator->fails()){

      return redirect("social-member")->withErrors($validator)->withInput();
    }else{

      //successfully we have passed our form
      $member = new Member;
      $member->name = $request->name;
      $member->email = $request->email;
      $member->phone = $request->phone;
      $member->state = $request->state;
      $member->city = $request->city;
      $member->issue = $request->issue;
      $member->message = $request->message;

      $member->save();

      $request->session()->flash("message","Member has been submitted form successfully");

      return redirect("social-member");
    }
}

}

Memberlist.blade.php

 @extends("home.layouts.layout")

    @section("title","Social Member | Bheekho Foundation")

    @section("content")
    <div class="container padding-top-three">
    <br/>
      <blockquote><h4>We need  Help</h4></blockquote>
    <br/>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped table-bordered" id="memberlist">
              <thead>
                <th>Name</th>
                <th>Email</th>
                <th>Phone</th>
                <th>State</th>
                <th>City</th>
                <th>Issue</th>
                <th>Describe Your Issues</th>
                      <th>Status</th>
              </thead>
            </table>
        </div>
      </div>
  </div>
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3./jquery.min.js"></script>
    @endsection

web.php

<?php

Route::get("/","HomeController@homepage");

 //Social Member Route
Route::get("/social-member","MemberController@addSocialMember")->name("addsocialmember");


Route::get("/memberlist","MemberController@listMember")->name("listmember");


Route::get("/memberlist-data","MemberController@listAllMember")->name("listallmember");


Route::post("/save-member","MemberController@saveMember")->name("savemember");

0 个答案:

没有答案