From e573b3020c032400eed60b649a2cbf55266e6bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 30 Jun 2016 16:03:25 +0200 Subject: Add current configurations from old repository --- .../vim-snippets/UltiSnips/php-laravel.snippets | 270 +++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 vim/bundle/vim-snippets/UltiSnips/php-laravel.snippets (limited to 'vim/bundle/vim-snippets/UltiSnips/php-laravel.snippets') diff --git a/vim/bundle/vim-snippets/UltiSnips/php-laravel.snippets b/vim/bundle/vim-snippets/UltiSnips/php-laravel.snippets new file mode 100644 index 0000000..7367a14 --- /dev/null +++ b/vim/bundle/vim-snippets/UltiSnips/php-laravel.snippets @@ -0,0 +1,270 @@ +#resource controller +snippet l_rsc "Laravel resource controller" b +/*! + * \class $1 + * + * \author ${3:`!v g:snips_author`} + * \date `!v strftime('%d-%m-%y')` + */ + +class ${1:`!v expand('%:t:r')`} extends ${2:BaseController} { + function __construct() { + } + + public function index() { + } + + public function create() { + } + + public function store() { + } + + public function show($id) { + } + + public function edit($id) { + } + + public function update($id) { + } + + public function destroy($id) { + } +} +endsnippet + +#service service provider +snippet l_ssp "Laravel service provider for service" b +app->bind('${4}Service', function ($app) { + return new ${5}( + $app->make('Repositories\\${6}Interface') + ); + }); + } +} +endsnippet + +#repository service provider +snippet l_rsp "Laravel service provider for repository" b +app->bind('$2\\$1Interface', function($app) { + return new $1Repository(new $1()); + }); + } + + /*! + * \brief If $defer == true need this fn + */ + public function provides() { + return ['$2\\$1Interface']; + } +} +endsnippet + +#model +snippet l_md "Laravel simple model" b +model = $model; + } + + /*! + * \fn all + * + * \return Illuminate\Database\Eloquent\Collection + */ + public function all($columns = array('*')) { + return $this->model->all()->toArray(); + } + + /*! + * \fn create + * + * \return Illuminate\Database\Eloquent\Model + */ + public function create(array $attributes) { + return $this->model->create($attributes); + } + + /*! + * \fn destroy + * + * \return int + */ + public function destroy($ids) { + return $this->model->destroy($ids); + } + + /*! + * \fn find + * + * \return mixed + */ + public function find($id, $columns = array('*')) { + return $this->model->find($id, $columns); + } +} +endsnippet + +#repository +snippet l_r "Laravel Repository" b +$5 = $repo; + } +} +endsnippet + +#facade +snippet l_f "Laravel Facade" b +