Need an Eye-caching Website - Contact Me Today !

Multi-Purpose Laravel Application | Livewire Application | Laravel Admin Dashboard


Laravel Starter Admin Dashboard

  • 29
  • 0
  • 25-Jan-2023

What is Laravel?

Laravel is a PHP web framework offering a comprehensive set of tools and resources useful for developing high-quality web applications. It follows the Model-View-Controller (MVC) architectural design pattern.

It is packed with built-in features and a wide variety of compatible packages and extensions, making it one of the most popular PHP web frameworks.

Advantages of Laravel

Here are some key advantages of using the Laravel framework.

  • The Laravel framework is easy to use, simple, and quick. As it is one of the most widely used PHP frameworks, many experienced developers are familiar with it and might have developed interactive web applications.
  • It offers advanced security features, enabling developers to protect their websites from cyber attacks. It uses a Bcrypt hashing algorithm, meaning that it does not save any password in the database.
  • Laravel supports out-of-the-box caching, which significantly enhances a website’s performance. Also, developers can effortlessly perform other speed optimization techniques, like database indexing and memory use reduction.
  • This framework has a built-in website that can efficiently handle the volume of traffic coming to a website. Therefore, it is also beneficial for traffic handling.
  • Using Laravel, developers can build fully-fledged and responsive eCommerce websites or B2B sites.
  • Laravel has clean APIs, making it easier to integrate your website with third-party applications.

Laravel Installation

You will have to follow the steps given below for installing Laravel onto your system −

Step 1

Visit the following URL and download composer to install it on your system.

Step 2 

After the Composer is installed, check the installation by typing the Composer command in the command prompt


composer global require laravel/installer


Create a new laravel project

laravel new example-app


After the project has been created, start Laravel's local development server using the Laravel's Artisan CLI serve command:

php artisan serve

Laravel Cheatsheet

Key concepts in Livewire

Activating Livewire on a page

To get Livewire working on a page, you need to include the Livewire styles and scripts on each page that need them. Usually, these would go into your base template. You’d do that using @livewireStyles and @livewireScripts:


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

Creating a Laravel Blade component

You’d create a Laravel Blade component by running the following command:

php artisan make:component Alert

This will create a new Alert.php class file and place it in the App\Views\Components folder. Then, a corresponding view template is created and placed in resources/views/components. To display the component, you can then use this Blade syntax: <x-alert/>.

Creating a Livewire component

To create a Livewire component, run the following command:

php artisan make:livewire Alert

The command will also create two new files: app\Http\Livewire\Alert.php and a view template resources/views/livewire/alert.php.

As you can see, the commands look quite similar. The only major difference is that with Livewire components, there’s a real-time sync (no page refresh required) between the component class and its view template. 

Livewire properties

Public properties on your component classes are made available to the component template view. It doesn’t stop there — the value of the property is synchronized in real time to the view, such that when you update the value of the property in the view, it is automatically updated in the component class.



class Alert extends Component{

  public $message = "Our alert message";


// livewire/alert.blade.php


  <input wire:model="message">


  {{ $message }}


Data validation

Livewire makes data validation seamless. To validate data coming from a form template view, you’d write a $rules property that contains your validation rules, just as you would in Laravel. Thereafter, you call the $this→validate() in the method doing the validation.

Let’s look at a form for creating a blog post:

class CreatePost extends Component
    public $title, $body;
    public $success;
    protected $rules = [
        'title' => 'required|string|max:220',
        'body' => 'required'

    public function render()
        return view('livewire.create-post')
    public function create(){
            'title' => $this->title,
            'slug' => Str::slug($this->title),
            'body' => $this->body,
            'author_id' => auth()->id()

        $this->success = true;


// livewire/create-post
<div class="container">
    @if ($success)
        <div class="alert alert-success">
            Post has been created successfully
    <form wire:submit.prevent="create">
        <div class="form-group">
            <label for="Post title">Post title</label>
            <input wire:model="title" type="text" name="title" id="title" class="form-control" placeholder="Title of the post">
            @error('title') <span class="error">{{ $message }}</span> @enderror
        <div class="form-group">
            <label for="Post body">Post Body</label>
            <textarea name="body" id="body" placeholder="Body of post here..." wire:model="body" class="form-control"></textarea>
            @error('body') <span class="error">{{ $message }}</span> @enderror
            <button class="btn btn-primary" type="submit">Publish</button>

In the form code above, when the user submits the post, and it doesn’t pass the validation, the validation errors are displayed, all without a page refresh.


Template Directives

These are directives added to elements within Livewire component templates.

<button wire:click="save">...</button>





Acts as a reference point for Livewire's DOM diffing system. Useful for adding/removing elements, and keeping track of lists.


Listens for a "click" event, and fires the "foo" method in the component.


Listens for a "mouseenter" event, and "prefetches" the result of the "foo" method in the component. Then, if it is clicked, will swap in the "prefetched" result (without an extra request), if it's not clicked, will throw away the cached result.


Listens for a keydown event on the enter key, which fires the "foo" method in the component.


Listens for a browser event called "foo". (You can listen for any browser DOM event - not just those fired by Livewire).


Assuming $foo is a public property on the component class, every time an input element with this directive is updated, the property synchronizes with its value.


Debounces the input events emitted by the element every 100 milliseconds.


Lazily syncs the input with its corresponding component property at rest.


Defers syncing the input with the Livewire property until an "action" is performed. This saves drastically on server roundtrips.


Runs the "foo" method on the component class every 500 milliseconds.


Runs the "foo" method on the component immediately after it renders on the page.


Hides the element by default, and makes it visible while network requests are in transit.


Adds the foo class to the element while network requests are in transit.


Removes the foo class while network requests are in transit.


Adds the disabled="true" attribute while network requests are in transit.


Hides the element by default, and makes it visible while the element's state is "dirty" (different from what exists on the backend).


Adds the foo class to the element while it's dirty.


Removes the foo class while the element is dirty.


Adds the disabled="true" attribute while the element's dirty.


Scopes wire:loading and wire:dirty functionality to a specific action.


Instructs Livewire to not update the element or its children when updating the DOM from a server request. Useful when using third-party JavaScript libraries within Livewire components.


The "self" modifier restricts updates to the element itself, but allows modifications to its children.


Artisan Commands

These are the artisan commands Livewire makes available to make frequent tasks like creating a component easier.



artisan make:livewire

Create a new component

artisan livewire:make

Create a new component

artisan livewire:copy

Copy a component

artisan livewire:move

Move a component

artisan livewire:delete

Delete a component

artisan livewire:touch

Alias for livewire:make

artisan livewire:cp

Alias for livewire:copy

artisan livewire:mv

Alias for livewire:move

artisan livewire:rm

Alias for livewire:delete

artisan livewire:stubs

Publish Livewire stubs (used in the above commands) for local modification

artisan livewire:publish

Publish Livewire's config file to your project (config/livewire.php)

artisan livewire:publish --assets

Publish Livewire's config file AND its frontend assets to your project

artisan livewire:configure-s3-upload-cleanup

Configure your cloud disk driver's S3 bucket to clear temporary uploads after 24 hours


Livewire bridges the gap between backend and frontend. You get the benefit of real-time interactivity without having to write a lot of JavaScript by yourself.

Github Link :

There are 0 Comments on this post
Please login to comment

Sagar Kumar
Typically replies within an hour

Hi there 👋

How can I help you?