<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mahzaib Mirza</title>
    <description>The latest articles on DEV Community by Mahzaib Mirza (@mahzaib_mirza).</description>
    <link>https://dev.to/mahzaib_mirza</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F995809%2F24621f97-81fa-485f-9c41-eaa90faac9c9.jpeg</url>
      <title>DEV Community: Mahzaib Mirza</title>
      <link>https://dev.to/mahzaib_mirza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahzaib_mirza"/>
    <language>en</language>
    <item>
      <title>How to create RESTFUL APIs with Laravel step by step</title>
      <dc:creator>Mahzaib Mirza</dc:creator>
      <pubDate>Sun, 08 Jan 2023 19:24:07 +0000</pubDate>
      <link>https://dev.to/mahzaib_mirza/how-to-create-restful-apis-with-laravel-step-by-step-26en</link>
      <guid>https://dev.to/mahzaib_mirza/how-to-create-restful-apis-with-laravel-step-by-step-26en</guid>
      <description>&lt;p&gt;Hello Artisans,&lt;br&gt;
Today, I'm going to show you how to create a restful api with laravel step by step. We create laravel apis when we work with mobile applications. We can easily develop the APIs with Laravel.&lt;/p&gt;

&lt;p&gt;In this tutorial we will create a restful apis with laravel. So let's start the tutorial to create laravel rest apis.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1: Install the Laravel
&lt;/h2&gt;

&lt;p&gt;First of all, you need to install laravel application with the following command to create the rest apis. You can skip this step if you have already installed Laravel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer create-project laravel/laravel Laravel-Apis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can specify the laravel version by following the command if you want to install any specific version of laravel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer create-project laravel/laravel:^8.0 Laravel-Apis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Database Configuration
&lt;/h2&gt;

&lt;p&gt;In the second step you need to configure the database in .env file to create the rest apis in laravel&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_username
DB_PASSWORD=database_password
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 3: Create a table
&lt;/h2&gt;

&lt;p&gt;In this step you need to create a table to store data. Just run the following command to create table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:migration create_posts_table
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now update the migration file with the following code to add the columns in table.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table-&amp;gt;id();
            $table-&amp;gt;string('title');
            $table-&amp;gt;string('slug');
            $table-&amp;gt;text('body');
            $table-&amp;gt;timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have to run the following command to migrate the table. I have added slug column also for SEO purposes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Create Api Routes
&lt;/h2&gt;

&lt;p&gt;In this step you have to create api routes in your routes/api.php file. We will use resource routes to manage curd operation. Just add the following the code in your routes/api.php file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use App\Http\Controllers\PostController;

Route::resource('posts', PostController::class);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Create Controller &amp;amp; Model
&lt;/h2&gt;

&lt;p&gt;Now you have to create controller and model to create the rest apis in laravel. Just run the following command in your terminal to create the post controller and model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Post -r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running above command, you will find newly created files Post.php and PostController.php in Models and Controllers folder respectively.&lt;/p&gt;

&lt;p&gt;In the controller, we have seven methods by default as given below that will be used for crud operation.&lt;/p&gt;

&lt;p&gt;index()&lt;br&gt;
create()&lt;br&gt;
store()&lt;br&gt;
show()&lt;br&gt;
edit()&lt;br&gt;
update()&lt;br&gt;
destroy()&lt;/p&gt;

&lt;p&gt;But we don't have to use create() and edit() methods because these methods are used to show create and edit forms. So, now update the PostController file with the following code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Http\Controllers;

use App\Models\Post;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

class PostController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $posts = Post::latest()-&amp;gt;paginate(10);
        return [
            "status" =&amp;gt; 1,
            "data" =&amp;gt; $posts
        ];
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $request-&amp;gt;validate([
            'title' =&amp;gt; 'required',
            'body' =&amp;gt; 'required',
        ]);

        $request['slug'] = Str::slug($request-&amp;gt;title,'-');
        $post = Post::create($request-&amp;gt;all());
        return [
            "status" =&amp;gt; 1,
            "data" =&amp;gt; $post
        ];
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Post $post
     * @return \Illuminate\Http\Response
     */
    public function show(Post $post)
    {
        return [
            "status" =&amp;gt; 1,
            "data" =&amp;gt;$post
        ];
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Post $post
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Post $post)
    {
        $request-&amp;gt;validate([
            'title' =&amp;gt; 'required',
            'body' =&amp;gt; 'required',
        ]);

        $request['slug'] = Str::slug($request-&amp;gt;title,'-');
        $post-&amp;gt;update($request-&amp;gt;all());

        return [
            "status" =&amp;gt; 1,
            "data" =&amp;gt; $post,
            "msg" =&amp;gt; "Post updated successfully"
        ];
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Models\Blog  $blog
     * @return \Illuminate\Http\Response
     */
    public function destroy(Post $post)
    {
        $post-&amp;gt;delete();
        return [
            "status" =&amp;gt; 1,
            "data" =&amp;gt; $post,
            "msg" =&amp;gt; "Post deleted successfully"
        ];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Run the Application
&lt;/h2&gt;

&lt;p&gt;Finally, you can start your application to test your rest apis. Just run the following command to run the laravel application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Testing Rest APIs
&lt;/h2&gt;

&lt;p&gt;We have successfully created Laravel restful apis. Now you can test these apis with Postman.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Post&lt;/strong&gt;&lt;br&gt;
url: &lt;a href="http://127.0.0.1:8000/api/posts"&gt;http://127.0.0.1:8000/api/posts&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;method: POST&lt;/p&gt;

&lt;p&gt;data: {title: “Post Title”, body: “Post Body”}&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pE1P_trY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kruzflkxxgh54uyra65d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pE1P_trY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kruzflkxxgh54uyra65d.png" alt="Create Post Api Preview" width="880" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Post&lt;/strong&gt;&lt;br&gt;
url: &lt;a href="http://127.0.0.1:8000/api/posts/%7Bpost-id%7D"&gt;http://127.0.0.1:8000/api/posts/{post-id}&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;method: PUT/PATCH&lt;/p&gt;

&lt;p&gt;data: {title: “Update Post Title”, body: “Update Post Body”}&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DIEN5vL0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/levxniwu39y8rgiimw7m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DIEN5vL0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/levxniwu39y8rgiimw7m.png" alt="Update Post Api Preview" width="880" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get All Posts&lt;/strong&gt;&lt;br&gt;
url: &lt;a href="http://127.0.0.1:8000/api/posts"&gt;http://127.0.0.1:8000/api/posts&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;method: GET&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YRYhNdPY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4m556e9l03dff6tsem13.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YRYhNdPY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4m556e9l03dff6tsem13.png" alt="Get All Post Api Preview" width="880" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Get Single Post&lt;/strong&gt;&lt;br&gt;
url: &lt;a href="http://127.0.0.1:8000/api/posts/%7Bpost-id%7D"&gt;http://127.0.0.1:8000/api/posts/{post-id}&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;method: GET&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x4TAx9u3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v4pktzg48up1kld3zof.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x4TAx9u3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v4pktzg48up1kld3zof.png" alt="Get Single Post Api Preview" width="880" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delete Post&lt;/strong&gt;&lt;br&gt;
url: &lt;a href="http://127.0.0.1:8000/api/posts/%7Bpost-id%7D"&gt;http://127.0.0.1:8000/api/posts/{post-id}&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;method: DELETE&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eiLTv3nj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oy8em660f1x9ttozcig6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eiLTv3nj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oy8em660f1x9ttozcig6.png" alt="Delete Post Api Preview" width="880" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Concolusion
&lt;/h2&gt;

&lt;p&gt;This way, you can create laravel rest apis for your mobile application. In this tutorial we have created a crud apis for our post crud operation. As you can see, we have not added any authentication to access these restful apis, but you can add user authentication to access these apis with laravel. Read this article to get detailed guidence on “How to authenticate rest apis with Laravel Passport?”&lt;/p&gt;

&lt;p&gt;I hope it will be helpful, If you foud this tutorial helpful, share it will your fellows.&lt;/p&gt;

&lt;p&gt;Happy Coding :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to change Laravel public folder name?</title>
      <dc:creator>Mahzaib Mirza</dc:creator>
      <pubDate>Mon, 26 Dec 2022 18:39:59 +0000</pubDate>
      <link>https://dev.to/mahzaib_mirza/how-to-change-laravel-public-folder-name-5bkl</link>
      <guid>https://dev.to/mahzaib_mirza/how-to-change-laravel-public-folder-name-5bkl</guid>
      <description>&lt;p&gt;Hello Artisans!&lt;/p&gt;

&lt;p&gt;This article goes into detail on How to change the public folder name of your Laravel application. I’m going to show you How we can change the laravel public to public_html. In this article, we will change the laravel public folder path to public_html in just a few following steps.&lt;/p&gt;

&lt;p&gt;As you know, in the local environment, your public path will be /public but on the live server, the public path is almost under the /public_html.&lt;/p&gt;

&lt;p&gt;Let's start&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-1: change laravel public folder name to public_html
&lt;/h2&gt;

&lt;p&gt;First of all, you need to change your public folder name to public_html, then your directory structure will look like from this&lt;/p&gt;

&lt;p&gt;-- app&lt;br&gt;
-- bootstrap&lt;br&gt;
-- config&lt;br&gt;
-- database&lt;br&gt;
-- public&lt;br&gt;
-- resources&lt;br&gt;
...&lt;/p&gt;

&lt;p&gt;To this   &lt;/p&gt;

&lt;p&gt;-- app&lt;br&gt;
-- bootstrap&lt;br&gt;
-- config&lt;br&gt;
-- database&lt;br&gt;
-- public_html&lt;br&gt;
-- resources&lt;br&gt;
...&lt;/p&gt;

&lt;p&gt;let's configure it now.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step-2: server.php
&lt;/h2&gt;

&lt;p&gt;We will change the public name to public_html in the same way as shown below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell &amp;lt;taylor@laravel.com&amp;gt;
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' &amp;amp;&amp;amp; file_exists(__DIR__.'/public_html'.$uri)) {
    return false;
}

require_once __DIR__.'/public_html/index.php';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step-3: App\Providers\AppServiceProvider.php
&lt;/h2&gt;

&lt;p&gt;In the AppServiceProvider.php file, Register a new public path. Replace the register function with the following code. Our public path has changed to public_html. So, it's mandatory to replace the register function with the below then you can run the serve command &lt;code&gt;php artisan serve&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    //Public folder name changed with public_html
    $this-&amp;gt;app-&amp;gt;bind('path.public', function(){
        return base_path().'/public_html';
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step-4: config\filesystems.php
&lt;/h2&gt;

&lt;p&gt;Just replace the following code. The following code of line will help you to create a storage link in the public_html folder by running this command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;php artisan storage:link&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you do not customize this line, you can't run the storage command on your live server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'links' =&amp;gt; [
    base_path('public_html/storage') =&amp;gt; storage_path('app/public'),
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step-5: webpack.mix.js
&lt;/h2&gt;

&lt;p&gt;Here we will config a new public path and replace the public name with public_html in this file, follow this below code just replace your code with the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */
mix.config.publicPath = 'public_html';
mix.js('resources/js/app.js', 'public_html/js')
    .postCss('resources/css/app.css', 'public_html/css', [
        //
]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After making these changes, &lt;a href="https://dev.to/mahzaib_mirza/how-to-deploy-laravel-on-shared-hosting-2lg7"&gt;we can upload Laravel project on any hosting&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;In conclusion, we don't need any custom coding to change the Laravel public folder path just follow the sequence and make changes carefully as well.&lt;/p&gt;

&lt;p&gt;I hope, it will be helpful to you.&lt;/p&gt;

&lt;p&gt;Happy Coding :)&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>laravel</category>
    </item>
    <item>
      <title>How to deploy laravel on shared hosting?</title>
      <dc:creator>Mahzaib Mirza</dc:creator>
      <pubDate>Mon, 26 Dec 2022 18:30:28 +0000</pubDate>
      <link>https://dev.to/mahzaib_mirza/how-to-deploy-laravel-on-shared-hosting-2lg7</link>
      <guid>https://dev.to/mahzaib_mirza/how-to-deploy-laravel-on-shared-hosting-2lg7</guid>
      <description>&lt;p&gt;Hello Artisans.&lt;/p&gt;

&lt;p&gt;This article details how to deploy the Laravel application on hostinger shared hosting. I’m going to show you How to deploy Laravel on shared hosting. In this article, I will show you how to upload the laravel project to hostinger.&lt;/p&gt;

&lt;p&gt;In this article, we will use Hostinger shared hosting to deploy our Laravel application with easy steps. So let's get started.&lt;/p&gt;

&lt;p&gt;First, we need to make some changes in our Laravel application, we need to change the public folder name to public_html because many shared hosting provider's domain directory structure is public_html and we can't change it, so we need to make changes to our application to run our application on a live server without writing public keyword next to the domain name and run artisan commands as well.&lt;/p&gt;

&lt;p&gt;Don't know how to change the public folder into public_html don't worry let's look at this &lt;a href="https://dev.to/mahzaib_mirza/how-to-change-laravel-public-folder-name-5bkl"&gt;article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I assumed you have changed your public folder name into public_html, So, let's forward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-1: Make zip file and upload on domain root directory
&lt;/h2&gt;

&lt;p&gt;Make a zip file of your Laravel project and upload it to your domain's root directory then your root directory will look like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---bG8Tlk2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7krv8c4dy6vhuafew7d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---bG8Tlk2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z7krv8c4dy6vhuafew7d.png" alt="Make Zip file of your project" width="880" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-2: Extract your zip file
&lt;/h2&gt;

&lt;p&gt;Extract your zip file in the root directory then your directory will look like this after extracting your zip file.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5dn5uuKV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea6pyixq9lu2mwycbfyp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5dn5uuKV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ea6pyixq9lu2mwycbfyp.png" alt="Extract your zip file" width="880" height="516"&gt;&lt;/a&gt;&lt;br&gt;
cut all files into your application public folder and paste them into the public_html folder then you can remove your public folder as well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-3: Create Database
&lt;/h2&gt;

&lt;p&gt;Create a database for your uploaded Laravel project if you have any models in your applications.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bosOunxe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9vqiu2j58i065esq2dk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bosOunxe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i9vqiu2j58i065esq2dk.png" alt="Create Database" width="880" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-4: Configure Database in .env file
&lt;/h2&gt;

&lt;p&gt;Add credentials of a newly created database in your .env file in your project located in the root directory.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oMrCeM2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqrm1uc5z0hnk4sl09wl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oMrCeM2H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eqrm1uc5z0hnk4sl09wl.png" alt="Configure database in .env file" width="880" height="545"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-5: Run command php artisan migrate
&lt;/h2&gt;

&lt;p&gt;Now it's time to run the essentials command to run the application properly.&lt;/p&gt;

&lt;p&gt;Open your SSH terminal to run composer commands on the live server, if you don't know how to connect a live server with SSH, don't worry look at this article there it several ways to connect a live server with SSH access.&lt;/p&gt;

&lt;p&gt;I hope, now you are connected with SSH, let's run this command to migrate your database&lt;/p&gt;

&lt;p&gt;&lt;code&gt;php artisan migrate&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;run this command if you have any seeders file&lt;/p&gt;

&lt;p&gt;&lt;code&gt;php artisan migrate --seed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Hooray, now you can run your application with your domain name your-domain-name.com.&lt;/p&gt;

&lt;p&gt;I hope it can help you.&lt;/p&gt;

&lt;p&gt;Happy Coding :)&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>deploylaravel</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
