I am kind of new to laravel, i get this on the log files.
Add [0] to fillable property to allow mass assignment on [App\Pemex].
i need to have all of the fields on fillable model?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Whenever i try and call my store api call i get a 500 error. i have no idea if it is womething on the client side not sending correctly the json or something on my server side. I get this response back.
"{\"errorMessages\":[\"The remote server returned an error: (500) Internal Server Error.\"],\"errors\":{}}"
my controller method looks like the following, the dd(); is to see how the data is coming through. obiously the 500 error is when it is commented out.
public function store(Request $request)
{
//dD($request->all());
$Pemex = Pemex::create($request->all());
return response()->json($Pemex, 201);
}
whenever i uncomment the DD(); i get the following info back:
array:1 [\n 0 => array:9 [\n \"Economico\" => \"TLN-42\"\n \"Latitude\" => 25.3958788\n \"Longitud\" => -100.1214968\n \"ActivityDateTime\" => \"2019-05-08T19:41:48\"\n \"EventSubType\" => \"SMDP_EVENT_VEHICLE_MOVED_WITH_IGIOFF\"\n \"Speed\" => 0\n \"Company\" => \"Teletrac Navman\"\n \"OwnerID\" => \"a387f15b-1769-482f-a5e4-c6829e1483a9\"\n \"VehicleID\" => \"d33182ba-beb3-48dc-934f-ffb157aa815e\"\n ]\n]\n
what could be wrong? how can i debug this?
Also wondering about what you're actually passing in the request... Is it a nested array?
Does
$Pemex = Pemex::create([
"Economico" => "TLN-42"
// anything else you need
]);
work? Or give a different error?
Please or to participate in this conversation.