My data returns look like:
Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[admin] => Admin
[user] => User
[abcd] => Abcd
)
)
I want to remove admin
array in above result. I tried this way unset($data->items->admin)
Getting the error message Property [items] does not exist on this collection instance.
.
Protected is a visibility permission set. http://php.net/manual/en/language.oop5.visibility.php
from the looks of the error it looks like your forgetting to extend the sub class.
Here is an example of what your trying to do.
class a{
protected $b;
function __construct(){
$this->b = Array('test'=>Array());
}
}
class b extends a{
function __construct(){
parent::__construct();// construct extended class
out($this->b); //returns Array ( [test] => Array ( ) )
unset($this->b['test']);
out($this->b); // returns Array ( )
}
}
function out($arr){ // function to output text
echo "<pre>";
print_r($arr);
echo "</pre>";
}
$b_test = new b();