From 64edbbc08e3c7faca959bec58c67279938863fa1 Mon Sep 17 00:00:00 2001 From: Patrick Samson Date: Wed, 20 Jul 2016 16:23:53 -0400 Subject: [PATCH] Add Relations snippets --- README.md | 1 + messages.json | 3 ++- messages/1.2.11.txt | 17 +++++++++++++++++ .../Relation-belongsTo.sublime-snippet | 11 +++++++++++ .../Relation-belongsToMany.sublime-snippet | 11 +++++++++++ .../Relations/Relation-hasMany.sublime-snippet | 11 +++++++++++ .../Relation-hasManyThrough.sublime-snippet | 11 +++++++++++ .../Relations/Relation-hasOne.sublime-snippet | 11 +++++++++++ 8 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 messages/1.2.11.txt create mode 100644 snippets/Relations/Relation-belongsTo.sublime-snippet create mode 100644 snippets/Relations/Relation-belongsToMany.sublime-snippet create mode 100644 snippets/Relations/Relation-hasMany.sublime-snippet create mode 100644 snippets/Relations/Relation-hasManyThrough.sublime-snippet create mode 100644 snippets/Relations/Relation-hasOne.sublime-snippet diff --git a/README.md b/README.md index 7392be0..ede38ba 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Input | Log | Mail | Redirect | +Relation | To create model relationships. Response | Route | Schema | Contains two sub-categories : `Schema::` for snippets related to the database table itself; and `Column::` for snippets related to the columns. diff --git a/messages.json b/messages.json index 445bd86..8246a1a 100644 --- a/messages.json +++ b/messages.json @@ -4,5 +4,6 @@ "1.1.2": "messages/1.1.2.txt", "1.1.3": "messages/1.1.3.txt", "1.2.0": "messages/1.2.0.txt", - "1.2.4": "messages/1.2.4.txt" + "1.2.4": "messages/1.2.4.txt", + "1.2.11": "messages/1.2.11.txt" } diff --git a/messages/1.2.11.txt b/messages/1.2.11.txt new file mode 100644 index 0000000..a550bd0 --- /dev/null +++ b/messages/1.2.11.txt @@ -0,0 +1,17 @@ +Laravel 5 Snippets for Sublime Text +https://github.com/Lykegenes/laravel-5-snippets + + +Version 1.2.11 +******************************************************************************** + +#### NEW SNIPPETS + +New Route snippets have been added for the get/post/put/delete actions. + +New snippets have been added to create model relationships. +They are now available under the `Relation::` trigger keyword. + +Happy coding! + +Improvements or suggestions? Contribute on GitHub! diff --git a/snippets/Relations/Relation-belongsTo.sublime-snippet b/snippets/Relations/Relation-belongsTo.sublime-snippet new file mode 100644 index 0000000..f940b92 --- /dev/null +++ b/snippets/Relations/Relation-belongsTo.sublime-snippet @@ -0,0 +1,11 @@ + + belongsTo('${2:App\User}'${3:, '${4:foreign_key}'}${5:, '${6:other_key}'}); +} +]]> + Relation::belongsTo + source.php + A one-to-one inverse relationship. + diff --git a/snippets/Relations/Relation-belongsToMany.sublime-snippet b/snippets/Relations/Relation-belongsToMany.sublime-snippet new file mode 100644 index 0000000..994a8f5 --- /dev/null +++ b/snippets/Relations/Relation-belongsToMany.sublime-snippet @@ -0,0 +1,11 @@ + + belongsToMany('${2:App\Role}'${3:, '${4:role_user_table}'}${5:, '${6:user_id}'}${7:, '${8:role_id}'}); +} +]]> + Relation::belongsToMany + source.php + A many-to-many relationship. + diff --git a/snippets/Relations/Relation-hasMany.sublime-snippet b/snippets/Relations/Relation-hasMany.sublime-snippet new file mode 100644 index 0000000..532819b --- /dev/null +++ b/snippets/Relations/Relation-hasMany.sublime-snippet @@ -0,0 +1,11 @@ + + hasMany('${2:App\Comment}'${3:, '${4:foreign_key}'}${5:, '${6:local_key}'}); +} +]]> + Relation::hasMany + source.php + A one-to-many relationship. + diff --git a/snippets/Relations/Relation-hasManyThrough.sublime-snippet b/snippets/Relations/Relation-hasManyThrough.sublime-snippet new file mode 100644 index 0000000..d248d03 --- /dev/null +++ b/snippets/Relations/Relation-hasManyThrough.sublime-snippet @@ -0,0 +1,11 @@ + + hasManyThrough('${2:App\Comment}', ${3:App\Post}); +} +]]> + Relation::hasManyThrough + source.php + A Has Many Through relationship. + diff --git a/snippets/Relations/Relation-hasOne.sublime-snippet b/snippets/Relations/Relation-hasOne.sublime-snippet new file mode 100644 index 0000000..385db9f --- /dev/null +++ b/snippets/Relations/Relation-hasOne.sublime-snippet @@ -0,0 +1,11 @@ + + hasOne('${2:App\User}'${3:, '${4:foreign_key}'}${5:, '${6:local_key}'}); +} +]]> + Relation::hasOne + source.php + A one-to-one relationship. +