faasie
1/9/2017 - 7:03 PM

Eloquent Relationship snippets for Sublime Text

Eloquent Relationship snippets for Sublime Text

<snippet>
    <content><![CDATA[
public function ${1:relationship}()
{
    return \$this->belongsToMany(${1/^(.+)$/(?1\u$1:)/g}::class, {$2:table});
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>belm</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>
<snippet>
    <content><![CDATA[
public function ${1:relationship}()
{
    return \$this->belongsTo(${1/^(.+)$/(?1\u$1:)/g}::class);
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>belo</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>
<snippet>
    <content><![CDATA[
public function ${1:relationship}()
{
    return \$this->hasMany(${1/^(.+)$/(?1\u$1:)/g}::class);
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>hasm</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>
<snippet>
    <content><![CDATA[
public function ${1:relationship}()
{
    return \$this->hasOne(${1/^(.+)$/(?1\u$1:)/g}::class);
}
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>haso</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>