Yes, you can add tags to blog posts by creating a many-to-many relationship between posts and tags. This requires three tables:
posts: Table to store blog posts.tags: Table to store tags.post_tag: Pivot table to associate posts with tags.
| body { | |
| font: 22px/1.6 system-ui,sans-serif; | |
| margin: auto; | |
| max-width: 35em; | |
| padding: 0 1em; | |
| } | |
| img, video { | |
| max-width: 100%; | |
| height: auto; |
Note: From ChatGPT. Thank you ChatGPT!
To implement click tracking with jQuery and store it in a backend API, we can outline the following steps:
You can use a database table to store unique clicks, capturing the necessary details like the browser, IP address, and clicked_at timestamp.
SQL for the table:
| { | |
| "generated_at": "2024-09-11 00:27:52", | |
| "meetups": [ | |
| { | |
| "name": "Why you should consider Drupal for your next project", | |
| "user_group_name": "#pugMi: PHP User Group Milano", | |
| "local_date": "2024-09-11", | |
| "local_time": "17:00", | |
| "utc_start_date_time": "1726074000", | |
| "city": "Milano", |
Setting up a Jekyll environment with Docker can streamline your development process, especially if you're looking to maintain consistency across different environments. Below, I'll guide you through creating a working Jekyll Docker environment using the official Jekyll Docker image.
First, create a Dockerfile to define your Jekyll environment. Create a file named Dockerfile in your project directory with the following content:
# Use the official Jekyll imagedu -cks * | sort -rn | head -11
alias ducks='while read -r line;do du -sh "$line";done < <(ls -1A) | sort -rh | head -n11'
| # Add this function to your ~/.zshrc file | |
| art() { | |
| # Define a function with a case statement | |
| case $1 in | |
| "cc") | |
| php artisan config:clear && php artisan config:cache | |
| # Add your code for option 1 here | |
| ;; | |
| "oc") | |
| php artisan optimize:clear |
LARAVEL's resource classes allow you to expressively and easily transform your models and model collections into JSON.Basically you can generate a nice json formatted data right from Eloquent. Laravel's resource classes allow you to expressively and easily transform your models and model collections into JSON. Let’s learn how to generate api resources.Consider you have a user table in your database and you want to generate api resources for your User model.Run following command on your terminal window while being on laravel project root directory:
app/Http/Resources directory of your application. Resources extend the Illuminate\Http\Resources\Json\JsonResource class:| <?php # idea from https://www.netmeister.org/blog/epoch.html | |
| // so Mac apparently set their origin of time using to 2001-01-01 00:00:00 (clock monotonic) which is unix epoch (1971-01-01) aka -30 years ago. | |
| # ((31556926) * 30) = (number of seconds per year according to epochconverter) * 30 years = 946707780 | |
| # per article, it is -978307200 (2001-01-01 00:00:00) so I wonder what explains the diff?? | |
| functions get_monotonic($timestamp) { | |
| return time() - strtotime('2001-01-01 00:00:00')); | |
| } | |
| return get_monotonic(); |
| ```sh | |
| # Your cron | |
| * * * * * root /usr/bin/php /var/app/current/artisan schedule:run >> /dev/null 2>&1 | logger | |
| ``` |