Skip to content

aesokolowski/AndyGram

Repository files navigation

Following FreeCodeCamp's Laravel tutorial for Instagram clone at https://www.youtube.com/watch?reload=9&v=ImtZ5yENzgE but due to version difference (currently late 2020 tutorial is from May 2019) but keeping track of those deltas here:

  1. make:auth no longer a valid artisan command, had to download laravel/ui and do something like php artisan ui:auth --vue IIRC
  2. \App\<model_name.php> had been changed to \App\Models\<model_name.php> in Laravel
  3. seems the get method changed, instead of second parameter of 'Profile@index' or whatever it's something more like [Path\to\dir], 'index' using two parameters.
  4. in order to mass-save() with tinker like the instructor did, I made the Profile fields "fillable" and left a comment indicating possible future deletion.
  5. IRRELEVENT: much later in the video the instructor shows a cleaner way of accomplishing this, keeping notes though. SOLVED: having trouble with findOrFail for User with no Profile (getting Laravel debug screen instead of simple 404) SOLUTION: even disabling debug mode I got 500 responses instead of 404 so I hacked it out two separate ways A: threw in a bunch of a ? b : c statements to guard against accessing profile fields for profileless users which worked, so I took that out and tried to find a way to do things on the database level and changed the default Register controller to save the created user in a variable then create a profile from that object before returning the user object. So instead of getting 404s for users with no profiles now all users automatically get a profile with their id as the foreign key. So now 500 will be the correct error if findOrFail returns it (though much more unlikely). LATER NOTE: I was looking through the topic list on the YouTube scrubbar and noticed "forcing a profile to be created via Model Events" so this will get changed to something more standard in the future.
  6. Blade error handling uses different syntax, @error instead of @if and conditional (error block and class attribute, respectively).
  7. By the 1h:50m point of the tutorial (out of 4 and a half hours) I'm starting to deviate from the video in minor ways often enough I'm not going to bother adding changes to this file unless it's something significant, I might note it in a commit message.
  8. In ProfilesController I use array_merge inside the if(request('image')) block instead of outside of it.
  9. I put the default profile picture in /img/ instead of in /storage/ because I want it to be tracked by git
  10. Apparently he hit two snags in ia row I did not hit but I credit that to notes #7 and #8 above
  11. Different method to alter my Follow button on profile.index
  12. async await instead of .then
  13. Use v-bind and v-on instead of Vue shorthands (in the video's case I think he simply wrote the prop name like a normal attribute, I assume that's an older version of Vue?), preference since I'm new to Vue I want to always be reminded when I'm looking at Vue stuff
  14. Creating ProfileUser model myself acted the same way, I couldn't do $profiles = ProfileUser::all(); like with a regular model. I've wasted enough hours trying to get the $user->following thing to work but he must have some library installed that I don't, because I do not see anything about that kind of thing working in the documentation. For accessing pivot table I'll hack something together. EDIT: within the web app itself $user->following->etc seems to work fine, which is different from all the nulls I was getting using Laravel's "tinker" php shell. Logged in as user 3 I set users 1 and 2 as following then with changes of the code to dump the data when you visit the profiles certainly enough my boolean $follows variable gets the correct value for each profile.

About

Instagram clone, following tutorial at https://www.youtube.com/watch?reload=9&v=ImtZ5yENzgE to familiarize myself with Laravel and Vue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages