Skip to content

Instantly share code, notes, and snippets.

@AdenFraser
Last active July 22, 2016 14:06
Show Gist options
  • Save AdenFraser/b4517e583fb7dd7ba58d06010ab0986b to your computer and use it in GitHub Desktop.
Save AdenFraser/b4517e583fb7dd7ba58d06010ab0986b to your computer and use it in GitHub Desktop.
Laravel Model Sublime Snippets
<snippet>
<content><![CDATA[
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected \$appends = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>appen</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected \$casts = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>casts</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected \$dates = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>dates</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected \$fillable = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>fill</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected \$hidden = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>hidd</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The number of models to return for pagination.
*
* @var int
*/
protected \$perPage = ${1};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>perPa</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The table associated with the model.
*
* @var array
*/
protected \$table = '${1:name}';
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>table</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = ${1};
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>timestam</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The relationships that should be touched on save.
*
* @var array
*/
protected \$touches = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>touch</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The attributes that should be visible in arrays.
*
* @var array
*/
protected \$visible = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>visi</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
<snippet>
<content><![CDATA[
/**
* The relations to eager load on every query.
*
* @var array
*/
protected \$with = [
'${1}',
];
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>with</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
</snippet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment