mercredi 1 juin 2016

Laravel restful api error 500(store and destroy)

I am new to restful api,and I met a problem,problem is :when I request destroy with delete method and store with post method,both will return 500 error.But I use get method to request index and show,both are ok.What is the problem? Here is my codes and request:

delete http://ift.tt/24jCHiZ

get http://ift.tt/24jCHiZ

post http://ift.tt/25BMzdP


 class CustomersController extends Controller
 {
    public function index(){

    $customersInfo = customers::all();
    return $customersInfo;

    }

    public function show($cust_id){

    $customer = customers::where('cust_id',$cust_id)->first();
    return $customer;
    }
    public function store()
    {

    echo "store";
    }

   public function destroy()
   {

      return "success";
   }
}


Route::resource('customers','CustomersController');


The apache log : "DELETE /RestfulPrac/public/customers/1000000001 HTTP/1.0" 500 20246 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"

if any one can help me ,I'd appreciate it!Thanks in advanced!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire