1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-10 21:04:02 +00:00
Laravel Code Tips https://laravel-code.tips
Find a file
2022-12-01 12:24:35 +01:00
app Weekly thread #5-#7, use actual created_at timestamp in Thread creation (#27) 2022-02-21 17:24:21 +01:00
bootstrap initial commit 2021-04-06 18:27:18 +02:00
config initial commit 2021-04-06 18:27:18 +02:00
content Week 35/2022 (#32) 2022-12-01 12:24:35 +01:00
database initial commit 2021-04-06 18:27:18 +02:00
public asset build prod 2021-11-10 16:20:08 +05:00
resources Update banner.blade.php 2022-01-03 16:46:03 +05:00
routes improve thread links 2021-04-09 18:53:27 +02:00
static unignore static/ 2021-04-06 22:13:55 +02:00
storage initial commit 2021-04-06 18:27:18 +02:00
tests initial commit 2021-04-06 18:27:18 +02:00
.DS_Store back/forward buttons, fix timestamps in DB 2021-04-07 20:16:47 +02:00
.editorconfig initial commit 2021-04-06 18:27:18 +02:00
.env.example initial commit 2021-04-06 18:27:18 +02:00
.gitattributes initial commit 2021-04-06 18:27:18 +02:00
.gitignore gitignore composer.lock 2022-03-07 00:55:10 +01:00
.styleci.yml initial commit 2021-04-06 18:27:18 +02:00
artisan initial commit 2021-04-06 18:27:18 +02:00
composer.json wip 2021-10-29 21:06:39 +02:00
package-lock.json Add weekly tips thread 2021-10-24 13:25:04 +02:00
package.json wip 2021-04-07 18:31:59 +02:00
phpunit.xml initial commit 2021-04-06 18:27:18 +02:00
README.md Fix content, add command, update readme 2021-08-27 18:37:33 +02:00
server.php initial commit 2021-04-06 18:27:18 +02:00
tailwind.config.js wip 2021-04-07 18:31:59 +02:00
webpack.mix.js wip 2021-04-07 18:31:59 +02:00

Laravel Code Tips

This project is a simple Laravel application that uses:

  • Ryan Chandler's Orbit package for storing data in markdown files,
  • custom command for generating a static version of the website (this will later be extracted to a separate and more robust package),
  • Flipp for beautiful OpenGraph & Twitter Card previews,
  • Lars Klopstra's amazing design skills. Thanks a ton for the design ❤️

The live version can be found on laravel-code.tips or if you like emojis, that's 💻🔥💡.y.at.

Definitely feel free to submit content; it can be a great way to promote your work (not that you can't submit others' tips, we accept all that are good!).

Right now all tips should be on Twitter, but later we'll make it easier to add them standalone as well. That said, it's best to share your work on your Twitter profile before adding it here, since we link back to your Twitter post & profile, which will help you grow an audience.

Submitting tips

Open a PR adding a new file to content/tips. The file name should be a unique slug of the tip. The content should look like this:

---
title: 'Use strict comparison'
tweet_id: '1272826452652810240'
thread_slug: laravel-clean-code-tactics
author_username: samuelstancl
images:
    - 'https://pbs.twimg.com/media/Ean722QXgAENwmW.jpg'
created_at: 2021-04-06T16:07:36+00:00
slug: use-strict-comparison
---

ALWAYS use strict comparison (=== and !==). If needed, cast things go the correct type before comparing. Better than weird == results

Also consider enabling strict types in your code. This will prevent passing variables of wrong data types to functions

The slug matches the file name, the author_username is the Twitter handle of the tip author, tweet_id is the id of the tweet with the tip, and images is an array of images that should be shown between the heading and the content.'

Make sure you also create a record in content/users for your Twitter handle if your Author is not created yet. The tip's author_username needs to reference an Author model.

Helper command

You can also use the php artisan tweet:add command to add content, just make sure that the tweet's "dependencies" (author and possibly thread) are in place.

Local setup

If you'd like to seed the database with content, create a new Twitter application and set the TWITTER_TOKEN variable in .env to the Bearer token of the app. That said, you likely won't need this because all the default data is available in this repository already. So you only need to do this if you want to add a lot of tweets in bulk.

Otherwise, the project doesn't require any database, so you can just git clone it and open it in your browser, e.g. using Valet or artisan serve.

To generate the static HTML run composer generate and to preview it run composer serve.