Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 119 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"laravel",
"php",
"blade",
"eloquent"
"eloquent",
"snippet"
],
"icon": "icon.png",
"homepage": "https://github.com/laravel/vs-code-extension",
Expand All @@ -23,7 +24,8 @@
"url": "https://github.com/laravel/vs-code-extension/issues"
},
"categories": [
"Other"
"Other",
"Snippets"
],
"activationEvents": [
"onLanguage:php"
Expand Down Expand Up @@ -405,7 +407,121 @@
"description": null
}
}
}
},
"snippets": [
{
"language": "php",
"path": "./snippets/arr.json"
},
{
"language": "php",
"path": "./snippets/auth.json"
},
{
"language": "php",
"path": "./snippets/cache.json"
},
{
"language": "php",
"path": "./snippets/config.json"
},
{
"language": "php",
"path": "./snippets/console.json"
},
{
"language": "php",
"path": "./snippets/cookie.json"
},
{
"language": "php",
"path": "./snippets/crypt.json"
},
{
"language": "php",
"path": "./snippets/db.json"
},
{
"language": "php",
"path": "./snippets/eloquent.json"
},
{
"language": "php",
"path": "./snippets/event.json"
},
{
"language": "php",
"path": "./snippets/hash.json"
},
{
"language": "php",
"path": "./snippets/helper.json"
},
{
"language": "php",
"path": "./snippets/log.json"
},
{
"language": "php",
"path": "./snippets/mail.json"
},
{
"language": "php",
"path": "./snippets/model.json"
},
{
"language": "php",
"path": "./snippets/redirect.json"
},
{
"language": "php",
"path": "./snippets/relation.json"
},
{
"language": "php",
"path": "./snippets/request.json"
},
{
"language": "php",
"path": "./snippets/response.json"
},
{
"language": "php",
"path": "./snippets/route.json"
},
{
"language": "php",
"path": "./snippets/schema.json"
},
{
"language": "php",
"path": "./snippets/session.json"
},
{
"language": "php",
"path": "./snippets/storage.json"
},
{
"language": "php",
"path": "./snippets/view.json"
},
{
"language": "php",
"path": "./snippets/passport.json"
},
{
"language": "php",
"path": "./snippets/str.json"
},
{
"language": "php",
"path": "./snippets/broadcast.json"
},
{
"language": "blade",
"path": "./snippets/collective_form_html.json"
}
]
},
"scripts": {
"pretest": "npm run compile && npm run lint",
Expand Down
17 changes: 17 additions & 0 deletions snippets/arr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"Arr-keyBy": {
"prefix": "Arr::keyBy",
"body": "Arr::keyBy(${1:\\$array}, '${2:key}')",
"description": "Key an associative array by a field or using a callback (Laravel v9.2)"
},
"Arr-join": {
"prefix": "Arr::join",
"body": "Arr::join(${1:\\$array}, '${2:glue}')",
"description": "Join array elements with a string (Laravel v9.11)"
},
"Arr-map": {
"prefix": "Arr::map",
"body": "Arr::map(${1:\\$array}, ${2:\\$callback})",
"description": "Arr::map iterates through the array and passes each value and key to the given callback (Laravel v9.13)"
}
}
72 changes: 72 additions & 0 deletions snippets/auth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"Auth-check.sublime-snippet": {
"prefix": "Auth::check",
"body": [
"Auth::check()"
],
"description": "Determine if the current user is authenticated."
},
"Auth-guest.sublime-snippet": {
"prefix": "Auth::guest",
"body": [
"Auth::guest()"
],
"description": "Determine if the current user is a guest."
},
"Auth-logout.sublime-snippet": {
"prefix": "Auth::logout",
"body": [
"Auth::logout();"
],
"description": "Log the user out of the application."
},
"Auth-user.sublime-snippet": {
"prefix": "Auth::user",
"body": [
"Auth::user()"
],
"description": "Get the currently authenticated user."
},
"Auth-guard": {
"prefix": "Auth::guard",
"body": [
"Auth::guard('${1:guardName}')$2"
],
"description": "customize the \"guard\" that is used to authenticate and register users"
},
"Auth-attempt": {
"prefix": "Auth::attempt",
"body": [
"Auth::attempt([${1:'email' => \\$email, 'password' => \\$password}])$2"
],
"description": "Log by passing an array with key-value"
},
"Auth-login": {
"prefix": "Auth::login",
"body": [
"Auth::login(${1:\\$user});$2"
],
"description": "Log an existing user instance into your application"
},
"Auth-loginUsingId": {
"prefix": "Auth::loginUsingId",
"body": [
"Auth::loginUsingId($1);$2"
],
"description": "To log a user into the application by their ID"
},
"Auth-viaRemember": {
"prefix": "Auth::viaRemember",
"body": [
"Auth::viaRemember()"
],
"description": "Determine if the user was authenticated using the \"remember me\" cookie."
},
"Auth-routes": {
"prefix": "Auth::routes",
"body": [
"Auth::routes();"
],
"description": "Set authentication routes (v5.3)"
}
}
7 changes: 7 additions & 0 deletions snippets/broadcast.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"Broadcast-channel": {
"prefix": "Broadcast::channel",
"body": "Broadcast::channel('${1}', ${2}::class);${3}",
"description": "Broadcast Channel Classes"
}
}
105 changes: 105 additions & 0 deletions snippets/cache.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"Cache-add.sublime-snippet": {
"prefix": "Cache::add",
"body": [
"Cache::add('${1:key}', ${2:\\$value}, ${3:\\$ttl});$4"
],
"description": "Store an item in the Cache if it doesn't exist."
},
"Cache-decrement.sublime-snippet": {
"prefix": "Cache::decrement",
"body": [
"Cache::decrement('${1:key}', ${2:\\$amount});$3"
],
"description": "Decrement a Cached value"
},
"Cache-flush.sublime-snippet": {
"prefix": "Cache::flush",
"body": [
"Cache::flush();"
],
"description": "Remove all items from the cache."
},
"Cache-forever.sublime-snippet": {
"prefix": "Cache::forever",
"body": [
"Cache::forever('${1:key}', ${2:\\$value});$3"
],
"description": "Store an item in the Cache Permanently"
},
"Cache-forget.sublime-snippet": {
"prefix": "Cache::forget",
"body": [
"Cache::forget('${1:key}');$2"
],
"description": "Remove an Item from the Cache"
},
"Cache-get.sublime-snippet": {
"prefix": "Cache::get",
"body": [
"Cache::get('${1:key}', '${2:default}');$3"
],
"description": "Retrieve an Item from the Cache"
},
"Cache-has.sublime-snippet": {
"prefix": "Cache::has",
"body": [
"Cache::has('${1:key}')$2"
],
"description": "Check for existence in Cache"
},
"Cache-increment.sublime-snippet": {
"prefix": "Cache::increment",
"body": [
"Cache::increment('${1:key}', ${2:\\$amount});$3"
],
"description": "Increment a Cached value"
},
"Cache-pull.sublime-snippet": {
"prefix": "Cache::pull",
"body": [
"Cache::pull('${1:key}');$2"
],
"description": "Pulling An Item From The Cache"
},
"Cache-put.sublime-snippet": {
"prefix": "Cache::put",
"body": [
"Cache::put('${1:key}', ${2:\\$value}, ${3:\\$ttl});$4"
],
"description": "Store an item in the Cache (key, value, ttl)"
},
"Cache-remember.sublime-snippet": {
"prefix": "Cache::remember",
"body": [
"Cache::remember('${1:key}', ${2:\\$ttl}, function () {",
" $3",
"});"
],
"description": "Retrieve item or Store a default value if it doesn't exist"
},
"Cache-rememberForever.sublime-snippet": {
"prefix": "Cache::rememberForever",
"body": [
"Cache::rememberForever('${1:key}', function () {",
" $2",
"});"
],
"description": "Retrieve item or Store a default value permanently"
},
"Cache-lock-get": {
"prefix": "Cache::lock-get",
"body": "Cache::lock('${1:lock-name}', ${2:60})->get()",
"description": "obtaining arbitrary locks"
},
"Cache-lock-release": {
"prefix": "Cache::lock-release",
"body": "Cache::lock('${1:lock-name}')->release()",
"description": "release locks"
},
"Cache-lock-block": {
"prefix": "Cache::lock-block",
"body": "Cache::lock('${1:lock-name}', ${2:60})->block(${3:10})",
"description": "block until the lock becomes available"
}
}
Loading