Skip to content

Commit

Permalink
fixing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
digitaldreams committed Dec 31, 2018
1 parent 7c735a6 commit 12d5634
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion resources/templates/view/4/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col-sm-9">
<a href="{{route('@@showRoute@@',$record->@@routeModelKey@@)}}"> @@headline@@</a>
</div>
<div class="col-sm-3">
<div class="col-sm-3 text-right">
<div class="btn-group">
@@editLink@@
@@deleteLink@@
Expand Down
2 changes: 1 addition & 1 deletion src/lara-crud/Crud/RequestResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private function getAuthCode($methodName)
{
$auth = 'true';
if (class_exists($this->policy) && method_exists($this->policy, $methodName)) {
if (in_array($methodName, ['create', 'store'])) {
if (in_array($methodName, ['index', 'create', 'store'])) {
$code = '\\' . $this->model . '::class)';
} else {
$modelName = (new \ReflectionClass($this->model))->getShortName();
Expand Down
7 changes: 4 additions & 3 deletions src/lara-crud/View/Partial/Panel.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ public function template()
"\t\t" . '</tr>' . PHP_EOL;
}
$link = new Link($this->table->name());
$routeKey = $this->dataStore['routeModelKey'] ?? 'id';
$tempMan = new TemplateManager("view/{$this->version}/panel.html", [
'headline' => '{{$record->id}}',
'table' => $this->table->name(),
'routeModelKey' => $this->dataStore['routeModelKey'] ?? 'id',
'showLink' => $link->show(),
'showLink' => $link->show($routeKey),
'showRoute' => Page::getRouteName('show', $this->table->name()),
'editLink' => $this->editedBy == 'form' ? $link->edit() : $link->editModal($this->table),
'deleteLink' => $link->destroy(),
'editLink' => $this->editedBy == 'form' ? $link->edit($routeKey) : $link->editModal($this->table),
'deleteLink' => $link->destroy($routeKey),
'tableBody' => $bodyHtml
]);
return $tempMan->get();
Expand Down

0 comments on commit 12d5634

Please sign in to comment.