@Sebi i'm trying to delete a page using the api like so:
public static function deletePage($data){
if(property_exists($data, 'clients')) {
foreach($data->clients as $client) {
if ($client->changeType == 0) {
if(property_exists($client, 'id')) {
$p = wire('pages')->get($client->id);
wire('pages')->trash($p);
}
}
}
}
}
'package' => [
['OPTIONS', 'update-package', ['POST']],
['POST', 'update-package', Package::class, 'updatePackage', ["auth" => false]],
['DELETE', 'delete-page', Package::class, 'deletePage', ["auth" => false]]
],
for some reason I get an error -> "Trying to get property 'id' of non-object"
After some research I found that the error is located in the isDeletable check from pagesEditor inside the wire.
more specifically the last else if check. When I bypass this whole block it works to delete so the id is fine.
Any suggestions?
Kind regards.