/freeCodeGram

Laravel project with Vue.js

Primary LanguagePHP

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

Learning Laravel

Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.

If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.

License

The Laravel framework is open-sourced software licensed under the MIT license.

List of commands to start

Install PHP Install Composer Install Node

composer global require laravel/installer
laravel new freeCodeGram

Edit php --init and uncomment extension=fileinfo

cd freeCodeGram
git init
php artisan serve
^C
composer require laravel/ui
php artisan ui:auth
php artisan ui:vue
npm i && npm run dev
nul >database/database.sqlite

Delete the DB_... lines in .env file Declare DB_CONNECTION=sqlite in .env file Edit php --init and uncomment extension=pdo_sqlite

php artisan migrate
php artisan serve

Create a new user Modified files for add username field files: register.blade.php, ...create_users_table.php, RegisterController.php

php artisan tinker
>>> User::all();
>>> exit
php artisan migrate:fresh

Create a new user Modified files for add username field files: app/User.php

php artisan tinker
>>> User::all();
>>> exit
php artisan make:controller ProfilesController

Edit controller ProfilesController.php and files: app.blade.php, web.php, home.blade.php

php artisan make:model Profile -m
# Edit ...create_profiles_table.php
php artisan migrate

Edit app/User.php and Profile/User.php

php artisan tinker
>>> $profile = new \App\Profile();
>>> $profile -> title = 'Cool Title';
>>> $profile -> description = 'Description';
>>> $profile -> user_id = 1;
>>> $profile -> save();
>>> $profile -> user;
>>> $user = App\User::find(1);
>>> $user -> profile;
>>> $user -> profile -> url = 'freecodecamp.org';
>>> $user -> push();    # Saves all the changes and relationships modified
>>> exit                # The simple -> doesn't work here

Edit ProfilesController.php to method ::findOrFail();

php artisan make:model Post -m
# Edit ...create_posts_table.php
php artisan migrate
php artisan make:controller PostsController

Add methods create and store to PostsController Add post route "/" for store with PostsController Add a new post for a user Verified it in tinker

php artisan tinker
>>> Post::all();
>>> exit

Change the method to store the image, because we are only saving a storage class of the image

php artisan storage:link
# This command only have to be run once to create a symbolic link
# from "public/storage" to "storage/app/public"

Now delete the previous posts with tinker

php artisan tinker
>>> Post::truncate();
>>> exit

Adding a new library to manipulate images

composer require intervention/image
# The package is automatically discovered but we need
# Edit php.ini and uncomment extension=gd2

Adding method edit and update to ProfileController

php artisan make:policy ProfilePolicy -m Profile

Make edits in the files web.php, ProfilePolicy.php, ProfilesController, index.blade.php and ...create_profiles_table.php

php artisan migrate:fresh

Added new function in ProfilesController for default profile picture Added new Vue component: follow-button

npm run dev
php artisan make:controller FollowsController
php artisan make:migration creates_profile_user_pivot_table --create profile_user
# Edit the two factors in the table
php artisan migrate

Edit the Vue component: follow-button Add the corresponding methods to User.php and Profile.php

composer require laravel/telescope
php artisan telescope:install
php artisan migrate
# php artisan telescope:clear

Edit the Views to store some cache data, and changing the ProfilesController.php Create mail functionality

php artisan make:mail NewUserWelcomeMail -m emails.welcome-email
# Edit the two factors in the table

To-Do List

  • Make an edit route for posts
  • Make auto-follow to one master user on register
  • Make comments available
  • [check] Make public profiles