Код: Выделить всё
public function toArray($request)
{
return [
'name' => $this->name,
'links' => [
'edit' => action([PermissionController::class, 'edit'], $this),
'delete' => action([PermissionController::class, 'destroy'], $this),
],
'meta' => [
'id' => $this->id
]
];
}
< /code>
table.vue
import { computed, ref } from 'vue';
const props = defineProps({
data: {
type: Object,
required: true
}
});
const hasActionLinks = ref(props.data.filter((item) => item.hasOwnProperty('links')));
const hasRowSelector = ref(props.data.filter((item) => item.hasOwnProperty('meta')));
{{ heading }}
Actions
{{ value }}
// EDIT AND DELETE LINKS HERE
Подробнее здесь: https://stackoverflow.com/questions/795 ... s-based-on