public function edit(categoryarea $categoryarea){
$this->categoryarea = $categoryarea;
}
Estoy intentado pasar pasar esto a una Array
para poder obtener solo ID de la siguinte manera:
$this->categoryareaarray = json_decode($this->categoryarea, true);
pero me esta devolviendo el siguiente error
public function editErrorException
htmlspecialchars(categoryarea $categoryarea){
expects parameter 1 to be string, array given
también intente la siguiente consulta
$this->categoryarea>categoryareaarray = $categoryarea;
json_encode( (array) }$this->categoryarea);
si tomo la varible $categoryareay me devuelve el siguiente Jsonesto
object(App\Models\categoryarea\categoryArea)#1421 (28) "{ ["guarded"\"\\u0000*\\u0000guarded\":protected]=> array(0) { } ["connection"[],\"\\u0000*\\u0000connection\":protected]=> string(5) "mysql" ["table"\"mysql\",\"\\u0000*\\u0000table\":protected]=> string(14) "category_areas" ["primaryKey"\"category_areas\",\"\\u0000*\\u0000primaryKey\":protected]=> string(2) "id" ["keyType"\"id\",\"\\u0000*\\u0000keyType\":protected]=> string(3) "int" ["incrementing"]=> bool(\"int\",\"incrementing\":true) ["with",\"\\u0000*\\u0000with\":protected]=> array(0) { } ["withCount"[],\"\\u0000*\\u0000withCount\":protected]=> array(0) { } ["preventsLazyLoading"]=> bool([],\"preventsLazyLoading\":false) ["perPage",\"\\u0000*\\u0000perPage\":protected]=> int(15) ["exists"]=> bool(,\"exists\":true) ["wasRecentlyCreated"]=> bool(,\"wasRecentlyCreated\":false) ["attributes",\"\\u0000*\\u0000attributes\":protected]=> array(8) { ["id"]=> int(\"id\":21) ["id_category"]=> int(,\"id_category\":18) ["id_area"]=> int(,\"id_area\":9) ["ans_cat"]=> int(,\"ans_cat\":5) ["duration_cat"]=> NULL ["description"]=> NULL ["created_at"]=> string(19) "2021,\"duration_cat\":null,\"description\":null,\"created_at\":\"2021-07-14 16:35:28" ["updated_at"]=> string(19) "202128\",\"updated_at\":\"2021-07-17 03:14:32" 32\"} ["original",\"\\u0000*\\u0000original\":protected]=> array(8) { ["id"]=> int(\"id\":21) ["id_category"]=> int(,\"id_category\":18) ["id_area"]=> int(,\"id_area\":9) ["ans_cat"]=> int(,\"ans_cat\":5) ["duration_cat"]=> NULL ["description"]=> NULL ["created_at"]=> string(19) "2021,\"duration_cat\":null,\"description\":null,\"created_at\":\"2021-07-14 16:35:28" ["updated_at"]=> string(19) "202128\",\"updated_at\":\"2021-07-17 03:14:32" 32\"} ["changes",\"\\u0000*\\u0000changes\":protected]=> array(0) { } ["casts"[],\"\\u0000*\\u0000casts\":protected]=> array(0) { } ["classCastCache"[],\"\\u0000*\\u0000classCastCache\":protected]=> array(0) { } ["dates"[],\"\\u0000*\\u0000dates\":protected]=> array(0) { } ["dateFormat"[],\"\\u0000*\\u0000dateFormat\":protected]=> NULL ["appends"null,\"\\u0000*\\u0000appends\":protected]=> array(0) { } ["dispatchesEvents"[],\"\\u0000*\\u0000dispatchesEvents\":protected]=> array(0) { } ["observables"[],\"\\u0000*\\u0000observables\":protected]=> array(0) { } ["relations"[],\"\\u0000*\\u0000relations\":protected]=> array(0) { } ["touches"[],\"\\u0000*\\u0000touches\":protected]=> array(0) { } ["timestamps"]=> bool([],\"timestamps\":true) ["hidden",\"\\u0000*\\u0000hidden\":protected]=> array(0) { } ["visible"[],\"\\u0000*\\u0000visible\":protected]=> array(0) { } ["fillable"[],\"\\u0000*\\u0000fillable\":protected]=> array(0) { } []}
estoy intentado pasar pasar esto a una array para poder obtener solo ID de la siguinete manera
$this->categoryareaarray = json_decode($this->categoryarea, true);
pero me esta devolviendo el siguiente error
ErrorException
htmlspecialchars() expects parameter 1 to be string, array given
también intente la siguiente consulta
$this->categoryareaarray = json_encode( (array) $this->categoryarea);"
y me devuelve esto
"{"\u0000*\u0000guarded":[],"\u0000*\u0000connection":"mysql","\u0000*\u0000table":"category_areas","\u0000*\u0000primaryKey":"id","\u0000*\u0000keyType":"int","incrementing":true,"\u0000*\u0000with":[],"\u0000*\u0000withCount":[],"preventsLazyLoading":false,"\u0000*\u0000perPage":15,"exists":true,"wasRecentlyCreated":false,"\u0000*\u0000attributes":{"id":21,"id_category":18,"id_area":9,"ans_cat":5,"duration_cat":null,"description":null,"created_at":"2021-07-14 16:35:28","updated_at":"2021-07-17 03:14:32"},"\u0000*\u0000original":{"id":21,"id_category":18,"id_area":9,"ans_cat":5,"duration_cat":null,"description":null,"created_at":"2021-07-14 16:35:28","updated_at":"2021-07-17 03:14:32"},"\u0000*\u0000changes":[],"\u0000*\u0000casts":[],"\u0000*\u0000classCastCache":[],"\u0000*\u0000dates":[],"\u0000*\u0000dateFormat":null,"\u0000*\u0000appends":[],"\u0000*\u0000dispatchesEvents":[],"\u0000*\u0000observables":[],"\u0000*\u0000relations":[],"\u0000*\u0000touches":[],"timestamps":true,"\u0000*\u0000hidden":[],"\u0000*\u0000visible":[],"\u0000*\u0000fillable":[]}"
Alguien me podría decir que estoy haciendo mal y quedoque debo hacer para obtener el IDID en modo de arrayArray
, ya que necesito el IDID para hacer una nueva consulta..
Si tomo la varible $categoryarea
me devuelve lo siguiente: