Skip to content

Commit

Permalink
Updated email and filter snippets and created new ones for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
mpmont committed Nov 19, 2020
1 parent f0c99c9 commit 52f8f02
Show file tree
Hide file tree
Showing 15 changed files with 134 additions and 22 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ If you find error or whatever just fork it and send me a pull request.
| ci_new_renderer | New View Renderer |
| ci_render_section =ci_log | Logging information> Render section view |
| ci_extend_layout | Extend layout (insert view into a layout) |
| ci_view_section | View section (content within a view that extends a layout)
| ci_view_section | View section (content within a view that extends a layout)
| ci_view_include | View include |
| ci_get_locale | Get Locale |
| load_database | Load the Database |
Expand All @@ -54,17 +54,29 @@ If you find error or whatever just fork it and send me a pull request.
| ci_iscli | Check if request is CLI |
| ci_issecure | Check if request is HTTPS |
| ci_log | Logging information |
| ci_filter | Create a new filter class |
| ci_db_conn | Create a new database connection |
| ci_entity | Create a new Entity class |
| ci_cache | Save into the cache for x minutes |
| ci_getcache | Grab an instance of the cache engine directly through the Services class |
| ci_email | Basic example demonstrating how you might send email |
| ci_email_config | Basic email Preferences |
| ci_html_table | Create a basic html table based in a given array |
| ci_query_table | Create a basic html table based in query result |
| ci_table_template | Set your basic html table layout |
| ci_inicontroller | Create an init controller function |
| ci_filter | Create a new filter class |
| ci_db_conn | Create a new database connection |
| ci_entity | Create a new Entity class |
| ci_cache | Save into the cache for x minutes |
| ci_getcache | Grab an instance of the cache engine directly through the Services class |
| ci_email | Basic example demonstrating how you might send email |
| ci_email_config | Basic email Preferences |
| ci_html_table | Create a basic html table based in a given array |
| ci_query_table | Create a basic html table based in query result |
| ci_table_template | Set your basic html table layout |
| ci_inicontroller | Create an init controller function |
| ci4_affectedRows | Query builder get the affected rows |
| ci4_countAll | Query builder count all results |
| ci4_db_from | Query builder set From |
| ci4_db_join | Query builder set Join |
| ci4_db_whereNotIn | Query builder Where Not In |
| ci4_db_whereNotInSubquery | Query builder where not in with subquery |
| ci4_getPlatform | Get DB platform |
| ci4_getVersion | Get DB Version |
| ci4_insertID | Get inserted ID |
| ci4_lastQuery | Get last query from query builder |



# Contributors

Expand Down
8 changes: 8 additions & 0 deletions ci4_affectedRows.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->affectedRows();
]]></content>
<tabTrigger>ci_affectedrows</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Displays the number of affected rows, when doing “write” type queries (insert, update, etc.).</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_countAll.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->countAll();
]]></content>
<tabTrigger>ci_countall</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter.</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_db_from.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$builder->from('${1:fields}');
]]></content>
<tabTrigger>ci_from</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Permits you to write the FROM portion of your query</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_db_join.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$builder->join('${1:table_name}', '${2:table_name}.${3:pk} = ${4:table_name}.${1:fk}');
]]></content>
<tabTrigger>ci_join</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Permits you to write the JOIN portion of your query:</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_db_whereNotIn.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$builder->whereNotIn('${1:field}', \$${1:array});
]]></content>
<tabTrigger>ci_db_notin</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with AND if appropriate</description>
</snippet>
10 changes: 10 additions & 0 deletions ci4_db_whereNotInSubquery.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<snippet>
<content><![CDATA[
\$builder->orWhereNotIn('${1:field}', function(BaseBuilder \$builder) {
return \$builder->select('${2:field}')->from('${3:table}')->where('${4:field}', ${5:value});
});
]]></content>
<tabTrigger>ci_db_notinsub</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Generates a WHERE field NOT IN (‘item’, ‘item’) SQL query joined with OR if appropriate with subqueries instead of an array of values.</description>
</snippet>
14 changes: 7 additions & 7 deletions ci4_email_config.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<snippet>
<content><![CDATA[
$config['protocol'] = '${1:sendmail}';
$config['mailPath'] = '${2:/usr/sbin/sendmail}';
$config['charset'] = '${3:utf-8}';
$config['wordWrap'] = ${4:true};
$config['userAgent'] = ${4:CodeIgniter};
$config['mailType'] = ${5:text};
$config['validate'] = ${6:true};
\$config['protocol'] = '${1:sendmail}';
\$config['mailPath'] = '${2:/usr/sbin/sendmail}';
\$config['charset'] = '${3:utf-8}';
\$config['wordWrap'] = ${4:true};
\$config['userAgent'] = ${4:CodeIgniter};
\$config['mailType'] = ${5:text};
\$config['validate'] = ${6:true};
$email->initialize($config);
]]></content>
Expand Down
4 changes: 2 additions & 2 deletions ci4_filter.sublime-snippet
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use CodeIgniter\Filters\FilterInterface;
class ${1:${TM_FILENAME/(.+)\..+|.*/\u$1/:FilterName}}Filter implements FilterInterface
{
public function before(RequestInterface $request)
public function before(RequestInterface \$request, \$arguments = null)
{
${2}
}
//--------------------------------------------------------------------
public function after(RequestInterface $request, ResponseInterface $response)
public function after(RequestInterface \$request, ResponseInterface \$response, \$arguments = null)
{
${3}
}
Expand Down
8 changes: 8 additions & 0 deletions ci4_getPlatform.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->getPlatform();
]]></content>
<tabTrigger>ci_getplatform</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Outputs the database platform you are running (MySQL, MS SQL, Postgres, etc…)</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_getVersion.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->getVersion();
]]></content>
<tabTrigger>ci_version</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Outputs the database version you are running</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_insertID.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->insertID();
]]></content>
<tabTrigger>ci_insertid</tabTrigger>
<scope>source.php</scope>
<description>CI4 - The insert ID number when performing database inserts.</description>
</snippet>
8 changes: 8 additions & 0 deletions ci4_lastQuery.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
\$db->getLastQuery();
]]></content>
<tabTrigger>ci_lastquery</tabTrigger>
<scope>source.php</scope>
<description>CI4 - Returns a Query object that represents the last query that was run (the query string, not the result).</description>
</snippet>
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"install": "messages/install.txt",
"1.0.20": "messages/1.0.20.txt",
"1.0.24": "messages/1.0.24.txt",
"1.0.25": "messages/1.0.25.txt"
"1.0.25": "messages/1.0.25.txt",
"1.1.11": "messages/1.1.11.txt"
}
17 changes: 17 additions & 0 deletions messages/1.1.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Added some more codeigniter 4 snippets to our repo

ci4_affectedRows
ci4_countAll
ci4_db_from
ci4_db_join
ci4_db_whereNotIn
ci4_db_whereNotInSubquery
ci4_getPlatform
ci4_getVersion
ci4_insertID
ci4_lastQuery

Fixed some existing snippets

ci4_email_config
ci4_filter

0 comments on commit 52f8f02

Please sign in to comment.