{"id":20523088,"url":"https://github.com/itstructure/laravel-detail-view","last_synced_at":"2025-03-06T00:45:09.620Z","repository":{"id":56994573,"uuid":"361149051","full_name":"itstructure/laravel-detail-view","owner":"itstructure","description":"Detail view table for laravel framework","archived":false,"fork":false,"pushed_at":"2025-03-01T01:18:56.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-01T02:11:37.005Z","etag":null,"topics":["detail","details-view","laravel","table","view"],"latest_commit_sha":null,"homepage":"https://pack-develop.info/en/product/laravel-detail-view","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itstructure.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-24T11:53:21.000Z","updated_at":"2025-03-01T01:18:37.000Z","dependencies_parsed_at":"2024-03-27T02:43:20.762Z","dependency_job_id":null,"html_url":"https://github.com/itstructure/laravel-detail-view","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"2d365539b194659c319257f6935049323d82540c"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itstructure%2Flaravel-detail-view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itstructure%2Flaravel-detail-view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itstructure%2Flaravel-detail-view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itstructure%2Flaravel-detail-view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itstructure","download_url":"https://codeload.github.com/itstructure/laravel-detail-view/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242128320,"owners_count":20076177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detail","details-view","laravel","table","view"],"created_at":"2024-11-15T22:37:55.203Z","updated_at":"2025-03-06T00:45:09.614Z","avatar_url":"https://github.com/itstructure.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Detail View\n\n[![Latest Stable Version](https://poser.pugx.org/itstructure/laravel-detail-view/v/stable)](https://packagist.org/packages/itstructure/laravel-detail-view)\n[![Latest Unstable Version](https://poser.pugx.org/itstructure/laravel-detail-view/v/unstable)](https://packagist.org/packages/itstructure/laravel-detail-view)\n[![License](https://poser.pugx.org/itstructure/laravel-detail-view/license)](https://packagist.org/packages/itstructure/laravel-detail-view)\n[![Total Downloads](https://poser.pugx.org/itstructure/laravel-detail-view/downloads)](https://packagist.org/packages/itstructure/laravel-detail-view)\n[![Build Status](https://scrutinizer-ci.com/g/itstructure/laravel-detail-view/badges/build.png?b=main)](https://scrutinizer-ci.com/g/itstructure/laravel-detail-view/build-status/main)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/itstructure/laravel-detail-view/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/itstructure/laravel-detail-view/?branch=main)\n\n## Introduction\n\nThis package is to displaying the model data in a Detail table.\n\n![Detail view appearance](https://github.com/itstructure/laravel-detail-view/blob/main/laravel_detail_view_appearance_en.png)\n\n## Requirements\n- laravel 5.5+ | 6+ | 7+ | 8+ | 9+ | 10+ | 11+ | 12+\n- php \u003e= 7.1\n- composer\n\n## Installation\n\n### General from remote packagist repository\n\nRun the composer command:\n\n`composer require itstructure/laravel-detail-view \"~1.0.6\"`\n\n### If you are testing this package from a local server directory\n\nIn application `composer.json` file set the repository, as in example:\n\n```json\n\"repositories\": [\n    {\n        \"type\": \"path\",\n        \"url\": \"../laravel-detail-view\",\n        \"options\": {\n            \"symlink\": true\n        }\n    }\n],\n```\n\nHere,\n\n**../laravel-detail-view** - directory path, which has the same directory level as application and contains Detail View package.\n\nThen run command:\n\n`composer require itstructure/laravel-detail-view:dev-main --prefer-source`\n\n### Publish files (Not necessary)\n\n- To publish views run command:\n\n    `php artisan detail_view:publish --only=views`\n    \n    It stores view files to `resources/views/vendor/detail_view` folder.\n    \n- To publish translations run command:\n                \n    `php artisan detail_view:publish --only=lang`\n    \n    It stores translation files to `resources/lang/vendor/detail_view` folder.\n    \n- To publish all parts run command without `only` argument:\n\n    `php artisan detail_view:publish`\n    \n    Else you can use `--force` argument to rewrite already published files.\n\nElse you can use `--force` argument to rewrite already published file.\n\n## Usage\n\n### View template part\n\nUse `@detailView()` directive with config array in a blade view template.\n\n#### Simple quick usage\n\nYou can simply set rows to display as **string** format in `rowFields` array.\n\nNote: `$model` must be instance of `Illuminate\\Database\\Eloquent\\Model`.\n\n```php\n@php\n$detailData = [\n    'model' =\u003e $model,\n    'title' =\u003e 'Detail table',\n    'rowFields' =\u003e [\n        'id',\n        'active',\n        'icon',\n        'created_at'\n    ]\n];\n@endphp\n```\n\n```php\n@detailView($detailData)\n```\n\nAlternative variant without a blade directive:\n\n```php\n{!! detail_view([\n    'model' =\u003e $model,\n    'title' =\u003e 'Detail table',\n    'rowFields' =\u003e [\n        'id',\n        'active',\n        'icon',\n        'created_at'\n    ]\n]) !!}\n```\n\n#### Setting custom options\n\n##### Rows\n\nSimple example:\n\n```php\n@detailView([\n    'model' =\u003e $model,\n    'rowFields' =\u003e [\n        [\n            'label' =\u003e 'First Name', // Row label.\n            'attribute' =\u003e 'first_name', // Attribute, by which the row data will be taken from a model.\n        ],\n        [\n            'label' =\u003e 'Last Name',\n            'value' =\u003e function ($model) {\n                return $model-\u003elast_name;\n            }\n        ],\n    ]\n])\n```\n    \n##### Formatters\n\nThere are the next formatter keys:\n\n- **html** - is for passing a row content with html tags.\n- **image** - is for inserting a row data in to `src` attribute of `\u003cimg\u003e` tag.\n- **text** - applies `strip_tags()` for a row data.\n- **url** - is for inserting a row data in to `href` attribute of `\u003ca\u003e` tag.\n\nFor that keys there are the next formatters:\n\n- `HtmlFormatter`\n- `ImageFormatter`\n- `TextFormatter`\n- `UrlFormatter`\n\nAlso you can set formatter with some addition options. See the next simple example:\n\n```php\n@detailView([\n    'model' =\u003e $model,\n    'rowFields' =\u003e [\n        [\n            'attribute' =\u003e 'url',\n            'format' =\u003e [\n                'class' =\u003e Itstructure\\DetailView\\Formatters\\UrlFormatter::class,\n                'title' =\u003e 'Source',\n                'htmlAttributes' =\u003e [\n                    'target' =\u003e '_blank'\n                ]\n            ]\n        ],\n        [\n            'attribute' =\u003e 'content',\n            'format' =\u003e 'html'\n        ]\n    ]\n])\n```\n\n##### Table heads\n\nTo set column titles, you can set `captionColumnConfig` and `valueColumnConfig` as in example:\n\n```php\n@detailView([\n    'model' =\u003e $model,\n    'captionColumnConfig' =\u003e [\n        'label' =\u003e 'Custom title column',\n        'htmlAttributes' =\u003e [\n            'class' =\u003e 'th-title-class'\n        ]\n    ],\n    'valueColumnConfig' =\u003e [\n        'label' =\u003e 'Custom value column',\n        'htmlAttributes' =\u003e [\n            'class' =\u003e 'th-value-class'\n        ]\n    ],\n    'rowFields' =\u003e [\n        [\n            'attribute' =\u003e 'content',\n        ]\n    ]\n])\n```\n\nTo hide all table row with head titles:\n\n```php\n@detailView([\n    'model' =\u003e $model,\n    'showHead' =\u003e false,\n    'rowFields' =\u003e [\n        [\n            'attribute' =\u003e 'content',\n        ]\n    ]\n])\n```\n\n##### Complex extended example\n\n```php\n@php\n$detailData = [\n    'model' =\u003e $model,\n    'title' =\u003e 'Detail title', // It can be empty ''\n    'htmlAttributes' =\u003e [\n        'class' =\u003e 'table table-bordered table-striped'\n    ],\n    'captionColumnConfig' =\u003e [\n        'label' =\u003e 'Custom title column',\n        'htmlAttributes' =\u003e [\n            'class' =\u003e 'th-title-class'\n        ]\n    ],\n    'valueColumnConfig' =\u003e [\n        'label' =\u003e 'Custom value column',\n        'htmlAttributes' =\u003e [\n            'class' =\u003e 'th-value-class'\n        ]\n    ],\n    'rowFields' =\u003e [\n        [\n            'attribute' =\u003e 'id', // REQUIRED if value is not defined. Attribute name to get row model data.\n            'label' =\u003e 'ID', // Row label.\n            'htmlAttributes' =\u003e [\n                'class' =\u003e 'tr-class'\n            ]\n        ],\n        [\n            'label' =\u003e 'Active', // Row label.\n            'value' =\u003e function ($model) { // You can set 'value' as a callback function to get a row data value dynamically.\n                return '\u003cspan class=\"icon fas '.($model-\u003eactive == 1 ? 'fa-check' : 'fa-times').'\"\u003e\u003c/span\u003e';\n            },\n            'format' =\u003e 'html', // To render row content without lossless of html tags, set 'html' formatter.\n        ],\n        [\n            'label' =\u003e 'Url link', // Row label.\n            'attribute' =\u003e 'url', // REQUIRED if value is not defined. Attribute name to get row model data.\n            'format' =\u003e [ // Set special formatter. $model-\u003e{$this-\u003eattribute} will be inserted in to 'href' attribute of \u003ca\u003e tag.\n                'class' =\u003e Itstructure\\DetailView\\Formatters\\UrlFormatter::class, // REQUIRED. For this case it is necessary to set 'class'.\n                'title' =\u003e 'Source', // title between a tags.\n                'htmlAttributes' =\u003e [ // Html attributes for \u003ca\u003e tag.\n                    'target' =\u003e '_blank'\n                ]\n            ]\n        ],\n        [\n            'label' =\u003e 'Icon', // Row label.\n            'value' =\u003e function ($model) { // You can set 'value' as a callback function to get a row data value dynamically.\n                return $model-\u003eicon;\n            },\n            'format' =\u003e [ // Set special formatter. If $model-\u003eicon value is a url to image, it will be inserted in to 'src' attribute of \u003cimg\u003e tag.\n                'class' =\u003e Itstructure\\DetailView\\Formatters\\ImageFormatter::class, // REQUIRED. For this case it is necessary to set 'class'.\n                'htmlAttributes' =\u003e [ // Html attributes for \u003cimg\u003e tag.\n                    'width' =\u003e '100'\n                ]\n            ]\n        ],\n        'created_at', // Simple row setting by string.\n    ]\n];\n@endphp\n```\n\n```php\n@detailView($detailData)\n```\n\n## License\n\nCopyright © 2021-2025 Andrey Girnik girnikandrey@gmail.com.\n\nLicensed under the [MIT license](http://opensource.org/licenses/MIT). See LICENSE.txt for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitstructure%2Flaravel-detail-view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitstructure%2Flaravel-detail-view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitstructure%2Flaravel-detail-view/lists"}