Hey I want to group buttons under headings. In my Controller I have a Group ID and Group Name. If several groups have the same ID, and I only want the group name to appear once and all the buttons grouped under that specific group name with the ID. So what I want is that a group name must view only once with the buttons under it.
Here is the HTML:
<div class="col-md-12">
<div class="btn-group" v-for="command in commands">
<div v-if="command.groupID == groupId">
<h4>@{{ command.groupName }}</h4>
</div>
<commands-component
:entity-config="commandConfig(command.id, command.signature, command.arguments, command.title, command.groupID, command.groupName)">
<input type="button" class="btn btn-primary btn-block" v-bind:value="command.title">
</commands-component>
</div>
</div>
Here is the Vue:
methods: {
commandConfig: function(ident, signature, arguments, title, groupId, groupName){
$data = {
id: { text: 'commandModal' + ident, id: null },
modalTitle: title,
buttons: [
{
buttonTitle: 'Run Command',
buttonClass: 'btn btn-success pull-right',
submitUrl: {
url: '/admin/artisan/commands/run',
},
}
],
attributes: [
{name: "message", displayName: "Are you sure you want to proceed with the command?", type: "action-text", col: "12" },
{name: "signature", displayName: "Command Signature", type:'text', col:"12"}
],
data: {
signature:signature,
}
}
return $data;
}
}
here is a part of the controller:
public function index() {
$users = User::all();
$commands = [
[
'id' => 1,
'signature' => 'sync:whatever',
'arguments' =>'',
'title' =>'Sync Whatever',
'groupID' => 1,
'groupName' => 'GroupOne'
],
[
'id' => 2,
'signature' => 'send:whatever',
'arguments' =>'users',
'title' =>'Send Whatever',
'groupID' => 1,
'groupName' => 'GroupOne'
],
[
'id' => 3,
'signature' => 'sync:something',
'arguments' =>'',
'title' =>'Sync Something',
'groupID' => 2,
'groupName' => 'GroupTwo'
],
}