and i have table called journal_entries
and inside this table i have tow column
price
price_t
now if the person is admin i want him to see the price column but if the person is not admin i want him to see price_t as price and this is my accessor code
public function getTotalNetPriceAttribute()
{
if(!Gate::allows('info'))
{
if(isset($this->attributes['total_net_price_t']))
{
if($this->attributes['total_net_price_t'] == null)
return $this->attributes['total_net_price'];
else
return $this->attributes['total_net_price_t'];
}
if(isset($this->attributes['total_net_price']))
return $this->attributes['total_net_price'];
}
else
{
if(isset($this->attributes['total_net_price']))
return $this->attributes['total_net_price'];
}
}
now if the person is admin the code tack normal time like 1 to 2 min as treal balace in accunting its normal time but with the accessor if the user now admin its tack long long time is there any way to speed it up thanks..
the problem was with the gate file its working good now thanks for all
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.