mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
update
This commit is contained in:
parent
e53a643e3d
commit
1ab37bd478
209 changed files with 79957 additions and 0 deletions
49
my-snippets/laravel-blade/snippets/blade.json
Normal file
49
my-snippets/laravel-blade/snippets/blade.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"Blade-component": {
|
||||
"prefix": "Blade::component",
|
||||
"body": "Blade::component('${1:package-name}', ${2:PackageNameComponent}::class);",
|
||||
"description": "Registering Package Components (AppServiceProvider boot method)"
|
||||
},
|
||||
"Blade-include": {
|
||||
"prefix": "Blade::include",
|
||||
"body": "Blade::include('${1:includes.input}', '${2:input}');",
|
||||
"description": "Aliasing Includes (AppServiceProvider boot method)"
|
||||
},
|
||||
"Blade-if": {
|
||||
"prefix": "Blade::if",
|
||||
"body": [
|
||||
"Blade::if('${1:env}', function ($${2:environment}) {",
|
||||
" ${3:return app()->environment($$environment);}",
|
||||
"});"
|
||||
],
|
||||
"description": "Custom If Statements (AppServiceProvider boot method)"
|
||||
},
|
||||
"Blade-directive": {
|
||||
"prefix": "Blade::directive",
|
||||
"body": [
|
||||
"Blade::directive('${1:datetime}', function ($${2:expression}) {",
|
||||
" ${3:return \"<?php echo ($$expression)->format('m/d/Y H:i'); ?>\";}",
|
||||
"});"
|
||||
],
|
||||
"description": "Custom directive (AppServiceProvider boot method)"
|
||||
},
|
||||
"Blade-stringable": {
|
||||
"prefix": "Blade::stringable",
|
||||
"body": [
|
||||
"Blade::stringable(function (${1:Money} $${2:money}) {",
|
||||
" ${3:return $$money->formatTo('en_GB');}",
|
||||
"});"
|
||||
],
|
||||
"description": "Custom echo handlers (AppServiceProvider boot method)"
|
||||
},
|
||||
"Blade-render": {
|
||||
"prefix": "Blade::render",
|
||||
"body": "Blade::render(${1:'Blade template string'}, ${2:\\$data});",
|
||||
"description": "Transform a raw Blade template string into valid HTML (Laravel 9.x)"
|
||||
},
|
||||
"Blade-renderComponent": {
|
||||
"prefix": "Blade::renderComponent",
|
||||
"body": "Blade::renderComponent(new ${1:HelloComponent}(${2:\\$params}));",
|
||||
"description": "Render a given class component by passing the component instance to the method (Laravel 9.x)"
|
||||
}
|
||||
}
|
62
my-snippets/laravel-blade/snippets/helpers.json
Normal file
62
my-snippets/laravel-blade/snippets/helpers.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
/* Paths */
|
||||
"Path-elixir": {
|
||||
"prefix": "lv:elixir",
|
||||
"body": "{{ elixir('${1:file}') }}",
|
||||
"description": "(deprecated) elixir path"
|
||||
},
|
||||
"Path-mix": {
|
||||
"prefix": "lv:mix",
|
||||
"body": "{{ mix('${1:file}') }}",
|
||||
"description": "mix path"
|
||||
},
|
||||
/* Strings */
|
||||
"String-trans": {
|
||||
"prefix": "lv:trans",
|
||||
"body": "{{ trans('$1') }}",
|
||||
"description": "trans"
|
||||
},
|
||||
/* URLs */
|
||||
"URL-action": {
|
||||
"prefix": "lv:action",
|
||||
"body": "{{ action('${1:ControllerName}', [${2:'id'=>1}]) }}",
|
||||
"description": "URL-action"
|
||||
},
|
||||
"URL-secure-asset": {
|
||||
"prefix": "lv:secure-asset",
|
||||
"body": "{{ secure_asset('$1', ${2:\\$title}, ${3:\\$attributes=[]}) }}",
|
||||
"description": "URL-secure-asset"
|
||||
},
|
||||
"URL-url": {
|
||||
"prefix": "lv:url",
|
||||
"body": "{{ url('${1:url}', [$2]) }}",
|
||||
"description": "URL-url"
|
||||
},
|
||||
"URL-asset": {
|
||||
"prefix": "lv:asset",
|
||||
"body": "{{ asset('$1') }}",
|
||||
"description": "URL-asset"
|
||||
},
|
||||
"URL-route": {
|
||||
"prefix": "lv:route",
|
||||
"body": "{{ route('${1:routeName}', [${2:'id'=>1}]) }}",
|
||||
"description": "URL-route"
|
||||
},
|
||||
/* Miscellaneous */
|
||||
"Form-csrf-field": {
|
||||
"prefix": "lv:csrf-field",
|
||||
"body": "{{ csrf_field() }}",
|
||||
"description": "CSRF hidden field"
|
||||
},
|
||||
"csrf-token": {
|
||||
"prefix": "lv:csrf-token",
|
||||
"body": "{{ csrf_token() }}",
|
||||
"description": "CSRF token"
|
||||
},
|
||||
/* Paginate */
|
||||
"Paginate-links": {
|
||||
"prefix": "lv:pagination-links",
|
||||
"body": "{{ \\$${1:collection}->links() }}",
|
||||
"description": "pagination links"
|
||||
}
|
||||
}
|
17
my-snippets/laravel-blade/snippets/livewire.json
Normal file
17
my-snippets/laravel-blade/snippets/livewire.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"livewireStyles": {
|
||||
"prefix": "livewire:styles",
|
||||
"body": "@livewireStyles",
|
||||
"description": "Livewire Styles directive"
|
||||
},
|
||||
"livewireScripts": {
|
||||
"prefix": "livewire:scripts",
|
||||
"body": "@livewireScripts",
|
||||
"description": "Livewire Scripts directive"
|
||||
},
|
||||
"livewire-component": {
|
||||
"prefix": "livewire:component",
|
||||
"body": "@livewire('${1:component}', ['${2:user}' => \\$${3:user}]${4:, key(\\$$3->id)})",
|
||||
"description": "Livewire nesting components"
|
||||
}
|
||||
}
|
460
my-snippets/laravel-blade/snippets/snippets.json
Normal file
460
my-snippets/laravel-blade/snippets/snippets.json
Normal file
|
@ -0,0 +1,460 @@
|
|||
{
|
||||
/* Extending a layout */
|
||||
"Extend layout": {
|
||||
"prefix": "b:extends",
|
||||
"body": "@extends('${1:name}')",
|
||||
"description": "extends view layout"
|
||||
},
|
||||
"Yield content": {
|
||||
"prefix": "b:yield",
|
||||
"body": "@yield('${1:name}')",
|
||||
"description": "yield content section"
|
||||
},
|
||||
"Content Section": {
|
||||
"prefix": "b:section",
|
||||
"body": [
|
||||
"@section('${1:name}')",
|
||||
" $2",
|
||||
"@endsection"
|
||||
],
|
||||
"description": "content section"
|
||||
},
|
||||
"Content Section Show": {
|
||||
"prefix": "b:section-show",
|
||||
"body": [
|
||||
"@section('$1')",
|
||||
" $2",
|
||||
"@show"
|
||||
],
|
||||
"description": "content section show"
|
||||
},
|
||||
/* Include sub-view */
|
||||
"Include view": {
|
||||
"prefix": "b:include",
|
||||
"body": "@include('${1:name}')",
|
||||
"description": "include view"
|
||||
},
|
||||
/* If Statements */
|
||||
"If-block": {
|
||||
"prefix": "b:if",
|
||||
"body": [
|
||||
"@if ($1)",
|
||||
" $2",
|
||||
"@endif"
|
||||
],
|
||||
"description": "@if block"
|
||||
},
|
||||
"If-else-block": {
|
||||
"prefix": "b:if-else",
|
||||
"body": [
|
||||
"@if ($1)",
|
||||
" $2",
|
||||
"@else",
|
||||
" $3",
|
||||
"@endif"
|
||||
],
|
||||
"description": "if-else block"
|
||||
},
|
||||
"Has Section": {
|
||||
"prefix": "b:has-section",
|
||||
"body": [
|
||||
"@hasSection ('${1:name}')",
|
||||
" $2",
|
||||
"@else",
|
||||
" $3",
|
||||
"@endif"
|
||||
],
|
||||
"description": "@hasSection condition"
|
||||
},
|
||||
"Unless-block": {
|
||||
"prefix": "b:unless",
|
||||
"body": [
|
||||
"@unless ($1)",
|
||||
" $2",
|
||||
"@endunless"
|
||||
],
|
||||
"description": "@unless block"
|
||||
},
|
||||
/* Loops */
|
||||
"For-block": {
|
||||
"prefix": "b:for",
|
||||
"body": [
|
||||
"@for (\\$i = ${1:0}; \\$i < ${2:\\$count}; \\$i++)",
|
||||
" $3",
|
||||
"@endfor"
|
||||
],
|
||||
"description": "@for block"
|
||||
},
|
||||
"Foreach-block": {
|
||||
"prefix": "b:foreach",
|
||||
"body": [
|
||||
"@foreach (${1:\\$collection} as ${2:\\$item})",
|
||||
" $3",
|
||||
"@endforeach"
|
||||
],
|
||||
"description": "@foreach block"
|
||||
},
|
||||
"forelse-block": {
|
||||
"prefix": "b:forelse",
|
||||
"body": [
|
||||
"@forelse (${1:\\$collection} as ${2:\\$item})",
|
||||
" $3",
|
||||
"@empty",
|
||||
" $4",
|
||||
"@endforelse"
|
||||
],
|
||||
"description": "@forelse block"
|
||||
},
|
||||
"while-block": {
|
||||
"prefix": "b:while",
|
||||
"body": [
|
||||
"@while ($1)",
|
||||
" $2",
|
||||
"@endwhile"
|
||||
],
|
||||
"description": "@while block"
|
||||
},
|
||||
/* Rendering views for collections */
|
||||
"each loop": {
|
||||
"prefix": "b:each",
|
||||
"body": "@each('${1:view.name}', ${2:\\$collection}, '${3:variable}', '${4:view.empty}')",
|
||||
"description": "@each loop"
|
||||
},
|
||||
/* Comments */
|
||||
"blade comment": {
|
||||
"prefix": "b:comment",
|
||||
"body": "{{-- ${1:comment} --}}",
|
||||
"description": "comment block"
|
||||
},
|
||||
/* Display Data */
|
||||
"blade echo-data": {
|
||||
"prefix": "b:echo",
|
||||
"body": "{{ ${1:\\$data} }}",
|
||||
"description": "echo data"
|
||||
},
|
||||
"blade echo-unescaped-data": {
|
||||
"prefix": "b:echo-html",
|
||||
"body": "{!! ${1:\\$html_data} !!}",
|
||||
"description": "echo unescaped data (allow html outputs)"
|
||||
},
|
||||
"blade echo-untouch": {
|
||||
"prefix": "b:echo-raw",
|
||||
"body": "@{{ ${1:variable} }}",
|
||||
"description": "echo untouched data (allow javascript expression)"
|
||||
},
|
||||
"blade verbatim": {
|
||||
"prefix": "b:verbatim",
|
||||
"body": [
|
||||
"@verbatim",
|
||||
"{{ ${1:variable} }}",
|
||||
"@endverbatim"
|
||||
],
|
||||
"description": "displaying JavaScript variables in a large portion of your template"
|
||||
},
|
||||
/* Stacks */
|
||||
"Push stack": {
|
||||
"prefix": "b:push",
|
||||
"body": [
|
||||
"@push('${1:name}')",
|
||||
" $2",
|
||||
"@endpush"
|
||||
],
|
||||
"description": "@push stack"
|
||||
},
|
||||
"Stack": {
|
||||
"prefix": "b:stack",
|
||||
"body": "@stack('${1:name}')",
|
||||
"description": "@stack"
|
||||
},
|
||||
/* Service Injection */
|
||||
"inject service": {
|
||||
"prefix": "b:inject",
|
||||
"body": "@inject('${1:name}', '${2:class}')",
|
||||
"description": "@inject Service"
|
||||
},
|
||||
/* Authorizing */
|
||||
"can": {
|
||||
"prefix": "b:can",
|
||||
"body": [
|
||||
"@can('${1:update}', ${2:\\$post})",
|
||||
" $3",
|
||||
"@endcan"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
"can-elsecan": {
|
||||
"prefix": "b:can-elsecan",
|
||||
"body": [
|
||||
"@can('${1:update}', ${2:\\$post})",
|
||||
" $3",
|
||||
"@elsecan('create', App\\Models\\\\${4:Post}::class)",
|
||||
" $5",
|
||||
"@endcan"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
"canany": {
|
||||
"prefix": "b:canany",
|
||||
"body": [
|
||||
"@canany(['update', 'view', 'delete'], ${1:\\$post})",
|
||||
" $2",
|
||||
"@endcanany"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
"canany-elsecanany": {
|
||||
"prefix": "b:canany-elsecanany",
|
||||
"body": [
|
||||
"@canany(['update', 'view', 'delete'], ${1:\\$post})",
|
||||
" $2",
|
||||
"@elsecanany(['create'], App\\Models\\\\${3:Post}::class)",
|
||||
" $4",
|
||||
"@endcanany"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
"cannot": {
|
||||
"prefix": "b:cannot",
|
||||
"body": [
|
||||
"@cannot('${1:update}', ${2:\\$post})",
|
||||
" $3",
|
||||
"@endcannot"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
"cannot-elsecannot": {
|
||||
"prefix": "b:cannot-elsecannot",
|
||||
"body": [
|
||||
"@cannot('${1:update}', ${2:\\$post})",
|
||||
" $3",
|
||||
"@elsecannot('create', App\\Models\\\\${5:Post}::class)",
|
||||
" $6",
|
||||
"@endcannot"
|
||||
],
|
||||
"description": "display a portion of the page only if the user is authorized to perform a given action."
|
||||
},
|
||||
/* v5.3 - $loop variable */
|
||||
"loop": {
|
||||
"prefix": "b:loop",
|
||||
"body": [
|
||||
"\\$loop->${1:first}"
|
||||
],
|
||||
"description": "$loop->(index|remaining|count|first|last|depth|parent)"
|
||||
},
|
||||
"loop first": {
|
||||
"prefix": "b:loop-first",
|
||||
"body": [
|
||||
"@if (\\$loop->first)",
|
||||
" ${1:{{-- This is the first iteration --\\}\\}}",
|
||||
"@endif"
|
||||
],
|
||||
"description": "$loop->first"
|
||||
},
|
||||
"loop last": {
|
||||
"prefix": "b:loop-last",
|
||||
"body": [
|
||||
"@if (\\$loop->last)",
|
||||
" ${1:{{-- This is the last iteration --\\}\\}}",
|
||||
"@endif"
|
||||
],
|
||||
"description": "$loop->last"
|
||||
},
|
||||
"php": {
|
||||
"prefix": "b:php",
|
||||
"body": [
|
||||
"@php",
|
||||
" $1",
|
||||
"@endphp"
|
||||
],
|
||||
"description": "@php block code in view"
|
||||
},
|
||||
"includeIf": {
|
||||
"prefix": "b:includeIf",
|
||||
"body": "@includeIf('${1:view.name}'${2:, ['some' => 'data']})",
|
||||
"description": "include a view that may or may not be present, you should use the @includeIf directive"
|
||||
},
|
||||
/* v5.4 */
|
||||
"component": {
|
||||
"prefix": "b:component",
|
||||
"body": [
|
||||
"@component('$1')",
|
||||
" $2",
|
||||
"@endcomponent"
|
||||
],
|
||||
"description": "component"
|
||||
},
|
||||
"slot": {
|
||||
"prefix": "b:slot",
|
||||
"body": [
|
||||
"@slot('$1')",
|
||||
" $2",
|
||||
"@endslot"
|
||||
],
|
||||
"description": "slot"
|
||||
},
|
||||
"isset": {
|
||||
"prefix": "b:isset",
|
||||
"body": [
|
||||
"@isset(${1:\\$record})",
|
||||
" $2",
|
||||
"@endisset"
|
||||
],
|
||||
"description": "isset"
|
||||
},
|
||||
"empty": {
|
||||
"prefix": "b:empty",
|
||||
"body": [
|
||||
"@empty(${1:\\$record})",
|
||||
" $2",
|
||||
"@endempty"
|
||||
],
|
||||
"description": "empty"
|
||||
},
|
||||
"error": {
|
||||
"prefix": "b:error",
|
||||
"body": [
|
||||
"@error('${1:record}')",
|
||||
" $2",
|
||||
"@enderror"
|
||||
],
|
||||
"description": "error"
|
||||
},
|
||||
"includeWhen": {
|
||||
"prefix": "b:includeWhen",
|
||||
"body": "@includeWhen(${1:\\$boolean}, '${2:view.name}', [${3:'some' => 'data'}])",
|
||||
"description": "includeWhen"
|
||||
},
|
||||
/* v5.5 */
|
||||
"auth": {
|
||||
"prefix": "b:auth",
|
||||
"body": [
|
||||
"@auth",
|
||||
" $1",
|
||||
"@endauth"
|
||||
],
|
||||
"description": "auth"
|
||||
},
|
||||
"guest": {
|
||||
"prefix": "b:guest",
|
||||
"body": [
|
||||
"@guest",
|
||||
" $1",
|
||||
"@endguest"
|
||||
],
|
||||
"description": "guest"
|
||||
},
|
||||
"switch": {
|
||||
"prefix": "b:switch",
|
||||
"body": [
|
||||
"@switch(${1:\\$type})",
|
||||
" @case(${2:1})",
|
||||
" $3",
|
||||
" @break",
|
||||
" @case(${4:2})",
|
||||
" $5",
|
||||
" @break",
|
||||
" @default",
|
||||
" $6",
|
||||
"@endswitch"
|
||||
],
|
||||
"description": "switch"
|
||||
},
|
||||
"includeFirst": {
|
||||
"prefix": "b:includeFirst",
|
||||
"body": "@includeFirst(['${1:view.name}', '${2:variable}'], [${3:'some' => 'data'}])",
|
||||
"description": "includeFirst"
|
||||
},
|
||||
/* v5.6 */
|
||||
"csrf": {
|
||||
"prefix": "b:csrf",
|
||||
"body": "@csrf",
|
||||
"description": "form csrf field"
|
||||
},
|
||||
"method": {
|
||||
"prefix": "b:method",
|
||||
"body": "@method($1)",
|
||||
"description": "form method field"
|
||||
},
|
||||
"dump": {
|
||||
"prefix": "b:dump",
|
||||
"body": "@dump($1)",
|
||||
"description": "dump"
|
||||
},
|
||||
/* Retrieving Translation Strings */
|
||||
"lang": {
|
||||
"prefix": "b:lang",
|
||||
"body": "@lang('${1:messages.welcome}')",
|
||||
"description": "lang"
|
||||
},
|
||||
/* v6.x */
|
||||
"includeUnless": {
|
||||
"prefix": "b:includeUnless",
|
||||
"body": "@includeUnless(${1:\\$boolean}, '${2:view.name}', [${3:'some' => 'data'}])",
|
||||
"description": "includeUnless"
|
||||
},
|
||||
/* v7.x */
|
||||
"props": {
|
||||
"prefix": "b:props",
|
||||
"body": "@props(['${1:propName}'])",
|
||||
"description": "Blade component data properties"
|
||||
},
|
||||
"env": {
|
||||
"prefix": "b:env",
|
||||
"body": [
|
||||
"@env('${1:staging}')",
|
||||
" $2",
|
||||
"@endenv"
|
||||
],
|
||||
"description": "env"
|
||||
},
|
||||
"production": {
|
||||
"prefix": "b:production",
|
||||
"body": [
|
||||
"@production",
|
||||
" $1",
|
||||
"@endproduction"
|
||||
],
|
||||
"description": "production"
|
||||
},
|
||||
"once": {
|
||||
"prefix": "b:once",
|
||||
"body": [
|
||||
"@once",
|
||||
" $1",
|
||||
"@endonce"
|
||||
],
|
||||
"description": "define a portion of template that will only be evaluated once per rendering cycle"
|
||||
},
|
||||
/* v8.x */
|
||||
"aware": {
|
||||
"prefix": "b:aware",
|
||||
"body": "@aware(['${1:propName}'])",
|
||||
"description": "Accessing data from a parent component (Laravel 8.64)"
|
||||
},
|
||||
"js": {
|
||||
"prefix": "b:js",
|
||||
"body": "@js(${1:\\$data})",
|
||||
"description": "This directive is useful to properly escape JSON within HTML quotes"
|
||||
},
|
||||
"class": {
|
||||
"prefix": "b:class",
|
||||
"body": "@class(['${1:p-4}', ${2:'font-bold' => true}])",
|
||||
"description": "conditionally compiles a CSS class string. (Laravel 8.51)"
|
||||
},
|
||||
/* v9.x */
|
||||
"checked": {
|
||||
"prefix": "b:checked",
|
||||
"body": "@checked(${1:true})",
|
||||
"description": "This directive will echo checked if the provided condition evaluates to true (Laravel 9.x)"
|
||||
},
|
||||
"selected": {
|
||||
"prefix": "b:selected",
|
||||
"body": "@selected(${1:true})",
|
||||
"description": "The @selected directive may be used to indicate if a given select option should be \"selected\" (Laravel 9.x)"
|
||||
},
|
||||
"disabled": {
|
||||
"prefix": "b:disabled",
|
||||
"body": "@disabled(${1:true})",
|
||||
"description": "The @disabled directive may be used to indicate if a given element should be \"disabled\" (Laravel 9.x)"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue