Skip to content

First project made by myself with laravel with basic CRUD functions

Notifications You must be signed in to change notification settings

memosk8/laravel_crud

Repository files navigation

This was the first ever laravel project made by myself. It only features basic CRUD operations and some basic bootstrap classes for displaying and spacing the records in the database.

Requirements to run this project

There are 2 ways of installing the required tools for this laravel project:

By Installing the tools one by one

Or by simply installing XAMPP which already includes PHP, Apache server and Mysql

Once the requirements are fullfilled, we can download or clone repository, install the project and run it

  1. First Download project folder OR clone using git bash https://git-scm.com/downloads
  2. Then we need to change the ".env.example" file name to just ".env" and change de database connection parameters inside of it to your own db user and password if required

  3. Once downloaded or cloned to your computer, access to project folder with the git bash cli (or cmd, powershell, whatever you use) and run the following commands:
    • composer install #this will install the packages specified in composer.json file, required by the project

    •  composer update #check for new versions of those packages

    •  php artisan serve #this will launch the laravel development server

    • now simply navigate to the link provided by the server (localhost:8000/productos) and you should be able to see the project running

Creating the database and setting up the tables

To set up our database and create the required columns we don´t have to write any sql statements. Laravel comes with a CLI (command line interface) that helps us build what we need without writting any php code or such.

So, for adding columns to our actual database (which in this case is called carnes but we can change the name on the .env file), first we have to create it, so go ahead and create a new database called "carnes" so that we can run the project right away without modifying any of the actual code just to see it running.

Once the database is created and confirmed that the name on the .env file is the right one, we can go ahead and create the columns for it, which are the attributes we have already defined in class. As I said, laravel gives us a command line interface to interact with laravel and do so many things, called Artisan and executed by PHP.

Go to your terminal and type

 php artisan migrate 
and check the database. If everything went OK, you should now see the columns into the database

Once we have the database ready, we can really test the CRUD operations on the db from laravel. So access localhost:8000/products/create and the form for adding new products to the db should display. Try adding values to it and save it, go to the database and check for that new record.

About

First project made by myself with laravel with basic CRUD functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published