Skip to content

Instantly share code, notes, and snippets.

@brnpimentel
Created December 16, 2021 18:27
Show Gist options
  • Save brnpimentel/7820de255f03390060872dcc1ad3fc70 to your computer and use it in GitHub Desktop.
Save brnpimentel/7820de255f03390060872dcc1ad3fc70 to your computer and use it in GitHub Desktop.
PHP VSCODE SNIPPET
{
"public function": {
"prefix": "met",
"body": [
"public function $1($2) {",
" $3",
"}",
""
],
"description": ""
},
"set attibute": {
"prefix": "set",
"body": [
"public function set$1Attribute(\\$value) {",
" \\$this->attributes['$1'] = \\$value;",
"}",
""
],
"description": ""
},
"get attibute": {
"prefix": "get",
"body": [
"public function get$1Attribute() {",
" return $2;",
"}",
""
],
"description": ""
},
"scope": {
"prefix": "scope",
"body": [
"public function scope$1(\\$q, $2) {",
" return \\$q->$3",
"}",
"",
"$4"
],
"description": ""
},
"boot function": {
"prefix": "boot",
"body": [
"public static function boot() {",
" parent::boot();",
" ",
" $1",
"}",
""
],
"description": ""
},
"Table Foreign": {
"prefix": "foreign",
"body": [
"\\$table->foreign('$1')->references('$2')->on('$3');"
],
"description": "Adicionar foreign key na migration"
},
"Unsigned Integer to Migration": {
"prefix": "uint",
"body": [
"\\$table->unsignedInteger('$1');"
],
"description": ""
},
"Unsigned BigInteger to Migration": {
"prefix": "bint",
"body": [
"\\$table->unsignedBigInteger('$1');"
],
"description": ""
},
"String to Migration": {
"prefix": "str",
"body": [
"\\$table->string('$1');"
],
"description": ""
},
"Create Guarded Param": {
"prefix": "guarded",
"body": [
"protected \\$guarded = [];",
],
"description": ""
},
"Create Dates Param": {
"prefix": "dates",
"body": [
"protected \\$dates = [",
" '$1',",
"];"
],
"description": ""
},
"Casts": {
"prefix": "casts",
"body": [
"protected \\$casts = [",
" '$1' => '$2',",
"];"
],
"description": ""
},
"Create Deleted at Param": {
"prefix": "deleted_at",
"body": [
"protected \\$dates = [",
" 'deleted_at',",
"];"
],
"description": ""
},
"Table Laravel": {
"prefix": "table",
"body": [
"protected \\$table = '$1';"
],
"description": ""
},
"Belongs To": {
"prefix": "bt",
"body": [
"public function $1()",
"{",
" return \\$this->belongsTo($2);",
"}",
""
],
"description": ""
},
"HasMany": {
"prefix": "hm",
"body": [
"public function $1() {",
"{",
" return \\$this->hasMany($2);",
"}",
""
],
"description": ""
},
"hasManyThrough": {
"prefix": "hmt",
"body": [
"public function $1() {",
"{",
" return \\$this->hasManyThrough($2, $3);",
"}",
""
],
"description": ""
},
"Line": {
"prefix": "line",
"body": [
"\\$this->line('$1');"
],
"description": ""
},
"Char 9": {
"prefix": "9",
"body": [
". chr(9) . "
],
"description": ""
},
"Def Space": {
"prefix": "d1",
"body": [
"/** ",
" * ===============================================================",
" * $1",
" * $1",
" * $1",
" */",
"$2",
],
"description": ""
},
"Def Space 2": {
"prefix": "d2",
"body": [
"/** ",
" * ================================================",
" * $1",
" * $1",
" */",
"$2",
],
"description": ""
},
"Def Space 3": {
"prefix": "d3",
"body": [
"// ====================================",
"// $1",
],
"description": ""
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment