Skip to content

Instantly share code, notes, and snippets.

@NBZ4live
Created February 10, 2018 21:27
Show Gist options
  • Save NBZ4live/398e2bb2df0d9a0872c0dcca4b76cb01 to your computer and use it in GitHub Desktop.
Save NBZ4live/398e2bb2df0d9a0872c0dcca4b76cb01 to your computer and use it in GitHub Desktop.
Laravel backpack clone button. (resources/views/vendor/backpack/crud/buttons/custom/clone.blade.php)
@if ($crud->hasAccess('create'))
@php($parameters = [])
@php($attributes = collect($entry->getAttributes()))
@foreach($crud->getFields('create') as $field)
@if($attributes->has($field['name']))
@php($parameters[$field['name']] = $attributes->get($field['name']))
@endif
@endforeach
<a href="{{ url($crud->route.'/create') . '?' . http_build_query($parameters) }}" class="btn btn-xs btn-default">
<i class="fa fa-clone"></i> {{ trans('backpack::crud.clone') }}
</a>
@endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment