Creating new app in laravel 5.2

Here's a step-by-step guide to creating a new app in Laravel 5.2:

Step 1: Install Composer

If you haven't already, install Composer, the PHP package manager, on your system. You can download it from the official Composer website: https://getcomposer.org/

Step 2: Create a new Laravel project

Open your terminal and run the following command to create a new Laravel project:

composer create-project --prefer-dist laravel/laravel project-name

Replace project-name with the name you want to give your app.

Step 3: Change into the project directory

Navigate into the newly created project directory:

cd project-name

Step 4: Install dependencies

Run the following command to install the required dependencies:

composer install

Step 5: Set up the database

Laravel uses a database to store data. You'll need to set up a database and configure the database settings in the config/database.php file.

Create a new database and update the database.php file with the following settings:

'default' => [
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'database_name',
    'username' => 'database_username',
    'password' => 'database_password',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
],

Replace database_name, database_username, and database_password with your actual database settings.

Step 6: Run the migrations

Laravel uses migrations to manage the database schema. Run the following command to create the necessary tables:

php artisan migrate

Step 7: Create a new controller

Controllers handle HTTP requests and interact with the model layer. Create a new controller by running the following command:

php artisan make:controller ControllerName

Replace ControllerName with the name you want to give your controller.

Step 8: Create a new route

Routes define how the app responds to HTTP requests. Create a new route by adding the following code to the routes.php file:

Route::get('/', 'ControllerName@index');

This route maps the root URL (/) to the index method of the ControllerName controller.

Step 9: Create a new view

Views are used to render HTML templates. Create a new view by creating a new file in the resources/views directory. For example, create a new file called welcome.blade.php:

<!-- resources/views/welcome.blade.php -->

<h1>Welcome to my app!</h1>

Step 10: Run the app

Finally, run the app by executing the following command:

php artisan serve

This will start the development server, and you can access your app by navigating to http://localhost:8000 in your web browser.

That's it! You've created a new Laravel app. From here, you can start building your app by creating models, controllers, and views, and defining routes and migrations as needed.