I want to extract the values from array in a column from database. For example, my value in my permission column is ["Create","Edit","Delete]. So when I dd($user->permission) it would return like that. How can I get the value from it so that I can return the result in a list. I have really no idea for now and what I cannot find similar question to mine.
Add a comment
|
1 Answer
This is a task for mutators. Simply add to your model:
protected $casts = [
'permission' => 'array',
];