Author Archives: admin

To Create a SFTP User in Ubuntu

Steps

To Edit SSH config

To Debug SSH

 

Reference:

  1. https://wisdmlabs.com/blog/create-an-sftp-user-with-limited-access-on-ubuntu/

Get last item of an array

Use array_key_last() to get last key. Do not use end(), if the item contain objects, end() will cause error.

Use Laravel Collection Object

 

Where with Subquery

Laravel Example

SQL

 

Reference:

  1. https://justcode.ikeepstudying.com/2016/08/mysql%E5%85%A5%E9%97%A8-%E4%B9%9D-%E5%AD%90%E6%9F%A5%E8%AF%A2-subquery/
  2. https://ithelp.ithome.com.tw/articles/10032121

Function to parse a string for possible combination

 

Order by Array

Sample

Reference

  1. https://stackoverflow.com/questions/8055138/mysql-sort-order-by-array-value
  2. https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_field
  3. Could be replaced with orderRaw()
    https://laravel.com/docs/8.x/queries

Get Daily Data using Laravel Query Builder

Query Builder