Skip to content

Instantly share code, notes, and snippets.

@shawnsandy
Last active March 15, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnsandy/d22c612cc32200761de053b9f8f3cd9b to your computer and use it in GitHub Desktop.
Save shawnsandy/d22c612cc32200761de053b9f8f3cd9b to your computer and use it in GitHub Desktop.
Laravel components
<?php
/*
* $data = dataset mixed|array|string required
* $title = component title string
* $attributes html attributes
* $view blade template optional
* */
Html::component("component_name", "dash::components.test", ["data", 'title' => 'Title', "attributes" => [], 'view']);
<aside class="panel {{ str_slug($title) }} {{ $attributes['class'] or "" }}">
<div class="panel-body">
<h4 class="h4 text-capitalize">{{ $title }}</h4>
<hr>
<!-- data -->
@foreach($data as $key => $item)
<p class="">
<span class="collection-key collection-key-{{ $key }}">{{ $key }} </span> {{ $item }}
</p>
@endforeach
<!-- end -->
<!-- end -->
</div>
</aside>
<?php
/*
* $data = dataset mixed|array|string
* $title = component title string
* $attributes html attributes
* $view blade template optional
* */
Html::component("panel", "dash::components.test", ["data", 'title' => 'Testing', "attributes" => [], 'view']);
Html::component("widget", "dash::components.widget", ["data", 'title' => 'Widgets', "attributes" => [], 'view']);
Html::component("list-panel", "dash::components.list-panel", ['data', 'title' => 'Data Panel', "attributes" => [], 'view']);
Html::component("data-table", "dash::components.data-table", ['data' => [], 'title' => 'Data Panel', "attributes" => [], 'view']);
Html::component("card", "dash::components.card", ['data', 'title' => 'Card', "attributes" => [], 'view']);
Html::component("story", "dash::components.story", ['data', 'title' => 'Story', "attributes" => [], 'view']);
Html::component("collection", "dash::components.collection", ['data', 'title' => 'Collection', "attributes" => [], 'view']);
Html::component("list-panel-collection", "dash::components.list-panel", ['data', 'title' => 'Data Panel', "attributes" => [], 'view']);
<!-- component -->
{{ Html::component( ["dog", "cat"], 'Component Title') }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment