These are the snippets that I use in all of my installations of Sublime Text. Geared towards the person workin with Laravel and its environment.
To install the snippets in your sublime, you will have to clone this repo into your own computer(s).
In your terminal, run the following command
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/
git clone [email protected]:vicgonvt/snippets.git
This will create a directory called snippets
which will contain all of the snippets.
That's it! It's that easy.
Contributions and suggestions welcomed!!!
- Shortcut:
met
public function [METHOD_NAME]()
{
//
}
- Shortcut:
pmet
private function [METHOD_NAME]()
{
//
}
- Shortcut:
prmet
protected function [METHOD_NAME]()
{
//
}
- Shortcut:
smet
public static function [METHOD_NAME]()
{
//
}
- Shortcut:
cmet
public function __construct()
{
//
}
- Shortcut:
dd
For those of us that use Laravel, dd() is missed when working outside the framework. Here is a workaround.
die(var_dump($[VAR]));
Quick helper for outputting variables in blade templates.
{{ $var }}
Laravel relationships are easy to write and now they take a second or two. Big thank you to Adam Wathan for the original idea on these. Modified a little bit for my personal preference. I mostly label my relationships to make sense regardless of my model's name. There is a stop at the method name, a second, optional, stop for the model's name and in some cases another stop to specify the table's field name.
- Shortcut:
belt
public function relationship()
{
return $this->belongsTo(Relationship::class, 'field_name');
}
- Shortcut:
belm
public function relationship()
{
return $this->belongsToMany(Relationship::class, 'field_name');
}
- Shortcut:
hasm
public function relationship()
{
return $this->hasMany(Relationship::class, 'field_name');
}
- Shortcut:
haso
public function relationship()
{
return $this->hasOne(Relationship::class);
}
- Shortcut:
fil
/**
* @var array
*/
protected $fillable = ['FIELD'];
Quick helper for scaffolding a new test method.
public function testName()
{
//
}