Rants and Raves

Welcome to Rants and Raves! I kept hearing that I needed to write, so here is the blog that I ended up starting. It is mostly an accounting of my progression through creating a web site, nuances with code, and tips about what I did to make things work. In there you will find sprinkled about some gems of life, and letting loose fun. Enjoy!

Fill In Blank Post Dates
2022-11-26
Now that I have figured out how to get the data I want to work with using: $null_posts = Blog::whereNull('post_at')->get(); I can now loop through and set the null post date to the created date with: foreach ($null_posts as $post) { $post->post_at = $post->created_at; $post->save();} Next would be to switch to sorting and filtering by post date, and allow me to have accurate created dates.
Needed Troubleshooting Functions
2022-11-25
Useful commands for troubleshooting: dump($variable); Spits out the values of the supplied variable into the view and keeps progressing through the code. dd($variable); Spits out the values of the supplied variable into the view and halts the rest of the code.
Make Sure To Use ->Get()
2022-11-24
When using Laravel's Eloquent and/or maybe Query Builder the data returned is different depending on how the statement is built. $variable=Table::whereNull('field'); gets you database connection/query info. $variable=Table::whereNull('field')->get(); gets you the data from the table to be able to work with.
Make A Controller From A Laravel Template
2022-11-23
Using Homestead and the built-in PHP you can create a controller that has the default functions in it. If you have PHP installed on your machine you can skip the Homestead/Vagrant portion. CD into Homestead directory Run: "vagrant up" Run: "vagrant ssh" CD into code folder Run: "php artisan make:controller NameController -r
Laravel Controller Default Functions
2022-11-22
There are default functions that the route can automatically utilize, they are: index() - Display a listing of the resource. create() - Show the form for creating a new resource. store(Request $request) - Store a newly created resource in storage. show($id) - Display the specified resource. edit($id) - Show the form for editing the specified resource. update(Request $request, $id) - Update the specified resource in storage. destroy($id) - Remove the specified resource from storage.
Lego Time
2022-11-21
I built Lego set 31130 today. It's a 3-in-1 set so they give you instructions for 3 different things you can build with the set. I went with the submarine with a giant octopus and treasure vault. There's something nice about the Legos; the colors, sounds, smells, modularity, ingenuity. I really like them. https://www.lego.com/en-us/product/sunken-treasure-mission-31130
Laravel MVC Refresher
2022-11-20
MVC stands for Model, View, Controller. In the case of Laravel: Model - Does the actual database work, talks to the controller. View - The GUI, what the user sees, input/output, talks to the controller. Controller - Does a lot of the logic between the Model and View, has basic pre-defined functions that can be adjusted or add your own, talks between the Model and the View. https://blog.pusher.com/laravel-mvc-use/
GIT Commits Need Some Defaults
2022-11-19
Now that GIT is installed again I have a bunch of changes that it would like to commit. At a minimum a name and email are required for logging. git config --global user.name "John Doe" git config --global user.email johndoe@example.com https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
RRAAVVEE!!
2022-11-18
Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a Boom Chick-a
Homestead .env File
2022-11-17
I decided to also put my Homestead configuration settings into a .env.homestead file. This does require editing the .yaml file in the root of the homestead folder with: variables: - key: APP_ENV value: homestead Now Homestead will provide a server app environment variable of "homestead", and Laravel will try to find and run the settings from the .env.homestead file. Make sure to run "vagrant reload --provision" after the .yaml file has been adjusted.
Id Title Body Post At