Name the columns key for both the view and edit lists 'columns'

This commit is contained in:
Kevin MacMartin 2018-01-21 19:37:11 -05:00
parent b900f56b71
commit a5f8d2aa78
3 changed files with 7 additions and 15 deletions

View file

@ -42,7 +42,7 @@ class DashboardController extends Controller {
'heading' => 'Contact Form Submissions',
'model' => 'contact',
'rows' => Contact::getContactSubmissions(),
'cols' => Contact::$dashboard_columns
'columns' => Contact::$dashboard_columns
]);
}
@ -52,7 +52,7 @@ class DashboardController extends Controller {
'heading' => 'Subscriptions',
'model' => 'subscriptions',
'rows' => Subscriptions::getSubscriptions(),
'cols' => Subscriptions::$dashboard_columns
'columns' => Subscriptions::$dashboard_columns
]);
}

View file

@ -40,7 +40,7 @@ First add a function to generate the page:
'heading' => 'Contact Form Submissions',
'model' => 'contact',
'rows' => Contact::getContactSubmissions(),
'cols' => Contact::$dashboard_columns
'columns' => Contact::$dashboard_columns
]);
}
```
@ -48,7 +48,7 @@ First add a function to generate the page:
* `heading`: The title that will appear for this page
* `model`: The model that will be accessed on this page
* `rows`: A function returning an array containing the data to be shown on this page
* `cols`: Expects a variable called `$dashboard_columns` in the respective model that contains an array:
* `columns`: Expects a variable called `$dashboard_columns` in the respective model that contains an array:
```php
public static $dashboard_columns = [
@ -143,15 +143,7 @@ This function should be named the same as the one above except with `Edit` at th
'id' => $id,
'item' => $item,
'help_text' => '<strong>NOTE:</strong> This is some help text for the current page',
'columns' => [
[ 'name' => 'venue', 'type' => 'text' ],
[ 'name' => 'date', 'type' => 'date' ],
[ 'name' => 'address', 'type' => 'text' ],
[ 'name' => 'phone', 'type' => 'text' ],
[ 'name' => 'website', 'type' => 'text' ],
[ 'name' => 'cover', 'type' => 'text' ],
[ 'name' => 'description', 'type' => 'mkd' ]
]
'columns' => $dashboard_columns
]);
}
```

View file

@ -8,7 +8,7 @@
<table class="table">
<thead>
<tr class="heading-row">
@foreach($cols as $column)
@foreach($columns as $column)
<th>{{ $column[0] }}</th>
@endforeach
</tr>
@ -17,7 +17,7 @@
<tbody>
@foreach($rows as $row)
<tr>
@foreach($cols as $column)
@foreach($columns as $column)
<td><strong class="mobile-heading">{{ $column[0] }}: </strong>{{ $row[$column[1]] }}</td>
@endforeach
</tr>