From 2be0c3228c4ad7d82397e807391fc0c29f6d8a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ellis=20Keny=C5=91?= Date: Sat, 6 Aug 2022 15:35:31 +0100 Subject: [PATCH 1/2] feat(+php-laravel-mode): add __ snippet --- +php-laravel-mode/.yas-parents.el | 26 ++++++++++++++++++++++++++ +php-laravel-mode/__ | 11 +++++++++++ 2 files changed, 37 insertions(+) create mode 100644 +php-laravel-mode/.yas-parents.el create mode 100644 +php-laravel-mode/__ diff --git a/+php-laravel-mode/.yas-parents.el b/+php-laravel-mode/.yas-parents.el new file mode 100644 index 00000000..290dfc3a --- /dev/null +++ b/+php-laravel-mode/.yas-parents.el @@ -0,0 +1,26 @@ +(eval-when-compile (require 'subr-x)) + +(defun +php-laravel-mode--get-namespace () + "Get a formatted namespace for the current PHP file" + (substring + (replace-regexp-in-string "/" (regexp-quote "\\") + (thread-first + buffer-file-name + (file-relative-name (doom-project-root)) + file-name-directory + capitalize)) + 0 + -1)) + +(defun +php-laravel-mode--get-class-name () + "Get a formatted class name for the current PHP file" + (string-join (mapcar 'capitalize + (split-string + (let ((case-fold-search nil)) + (replace-regexp-in-string + "\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2" + (replace-regexp-in-string + "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)" "\\1 \\2" + (file-name-base buffer-file-name)))) + "[^[:word:]0-9]+" + t)))) \ No newline at end of file diff --git a/+php-laravel-mode/__ b/+php-laravel-mode/__ new file mode 100644 index 00000000..77c88e58 --- /dev/null +++ b/+php-laravel-mode/__ @@ -0,0 +1,11 @@ +# -*- mode: snippet -*- +# name: PHP template +# -- + Date: Sat, 6 Aug 2022 15:37:51 +0100 Subject: [PATCH 2/2] feat(+php-laravel-mode): add migration snippet --- +php-laravel-mode/migration | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 +php-laravel-mode/migration diff --git a/+php-laravel-mode/migration b/+php-laravel-mode/migration new file mode 100644 index 00000000..3ba9a6ab --- /dev/null +++ b/+php-laravel-mode/migration @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: Laravel Migration method +# key: mig +# uuid: mig +# -- +Schema::table('$1', function (Blueprint $table) { + `%`$0 +});