ravipw1801

ravipw1801

Member Since 1 Year Ago

Experience Points 2,630
Experience Level 1

2,370 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 7
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 Feb
3 months ago

ravipw1801 started a new conversation Laravel Relation One To Many (Polymorphic)

Am making a laravel project, Admins & Executives an assign jobs to designers.

Below is the Admin model: Admin.php

public function jobs()
    {
        return $this->hasMany('App\Job');
    }

    public function assignable()
    {
        return $this->morphTo();
    }

Job.php

public function assignor()
    {
        return $this->belongsTo('App\Assignor','assignable');
    }

    public function designer()
    {
        return $this->belongsTo('App\Designer');
    }

    public function jobStatus()
    {
        return $this->hasOne('App\JobStatus');
    }

    public function client()
    {
        return $this->belongsTo('App\Client');
    }

Client.php

public function Jobs()
    {
        return $this->hasMany('App\Jobs');
    }

    public function Executive()
    {
        return $this->morphOne('App\Executive','executable');
    }

Jobs Table

Schema::create('jobs', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('client_id');
            $table->unsignedInteger('designer_id');
            $table->unsignedInteger('jobstatus_id');
            $table->string('title',100);
            $table->text('brief');
            $table->string('references');
            $table->dateTime('deadline');
            $table->string('dimensions')->nullable();
            $table->morphs('assignable');
            $table->timestamps();

            $table->foreign('client_id')->references('id')->on('clients');
            $table->foreign('designer_id')->references('id')->on('designers');
            $table->foreign('jobstatus_id')->references('id')->on('jobstatus');
        });

When i tinker the query $admin->jobs

It shows me this error Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jobs.admin_id' in 'where clause' (SQL: select * fromjobswherejobs.admin_id= 1 andjo bs.admin_idis not null)'

20 Dec
5 months ago
15 Dec
5 months ago

ravipw1801 started a new conversation Vue Js 2 / Cue-CLI 3 / When Hosted Shows Empty Blank Page

Vue Js app forking fine in dev mode, but as I upload it on the server, it simply displays a blank page. All the resources are showing up in the developer console. I am using vue-router package.

VueJs 2 / Vue-CLI-3

Below is my App.vue

<template>
  <div>
    <m-nav/>
    <router-view></router-view>  
  </div>
</template>

<script>

import Navbar from './components/Navbar.vue'

export default {
  name: 'app',
  components: {   
    'm-nav':Navbar  
  }
}


</script>



<style>

*,
*:after,
*::before {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  transition: all 0.3s;
}
html, body {
  height: 100%;
  -webkit-transition: all 0.3s;
  transition: all 0.3s;
   position: relative; 
   scroll-behavior: smooth;
}
body {
    font-family: 'Scada', sans-serif;
}

</style>

This is my main.js file

import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
import HomePage from './components/HomePage.vue'
import Register from './components/Register.vue'

Vue.use(VueRouter);

const routes = [
    {
        path:'/',
        component: HomePage
    },
    {
        path:'/register',
        component: Register
    }
];

const router = new VueRouter({
    routes,
    mode: 'history'
});

new Vue({
    router,
    render: h => h(App),
}).$mount('#app');

I am not getting, where I have made a mistake! The project is complete, but stuck on this part! :(

10 Dec
5 months ago

ravipw1801 left a reply on Bootstrap Navbar-changing Logo On Scroll

@hignomo but i don't want to move it left, right or any direction. I just want some animation while the src is changing.

04 Dec
5 months ago

ravipw1801 started a new conversation Bootstrap Navbar-changing Logo On Scroll

I have somehow managed to change the logo (img src) on scroll with JS ofcourse. Now I am stuck, how can i add transition while the logos are changing ('src').

Here is the code: Html:

<a class="navbar-brand mx-auto" href="/">
    <div class="navbar-brand-img">
        <img src="img/logo/full.png" class="animate" alt="">        
    </div>
</a>

Javascript:

<script>
        $(function () { 
            $(window).scroll(function () {
                if ($(this).scrollTop() > 1000) { 
                    $('.navbar-brand-img img').attr('src','img/logo/half.png');
                }
                if ($(this).scrollTop() < 1000) { 
                    $('.navbar-brand-img img').attr('src','img/logo/full.png');
                }
            })
        });
    </script>

Css:

.navbar-brand-img img {
    -webkit-transition: all 3s;
    transition: all 3s;
}
28 Nov
5 months ago

ravipw1801 left a reply on CSS Positioning

@sergiu17 It was the height giving the problem! Thanks mate!

ravipw1801 left a reply on Owl Carousel With Same Heights (Bootstrap)

No this doesn't solved the problem :(

ravipw1801 started a new conversation Owl Carousel With Same Heights (Bootstrap)

How to achieve owl carousel slides with same heights? http://prntscr.com/lnzad2

ravipw1801 started a new conversation CSS Positioning

I have a question regarding CSS positioning. Please click on the link below: http://prntscr.com/lnyne1

So, as you can see in the first box (Modestus Communications), the button is going outside the box, How can I fix this?

22 Nov
6 months ago

ravipw1801 left a reply on Restricting Direct URL Access To Storage (symlink) Directory

After lots of workarounds, I found this solution:

  1. Created a route in web.php file which allowed to view 403 file www.mydomain.com/forbidden.php

  2. Added in htaccess file Options -Indexes ErrorDocument 403 https://www.mydomain.com/forbidden.php

ravipw1801 left a reply on Restricting Direct URL Access To Storage (symlink) Directory

Yes, their is an authentication system in the app, but not on thing I am asking! I simply don't want anyone to see all the images in the storage (symlink) directory which is actually a public route!

ravipw1801 started a new conversation Restricting Direct URL Access To Storage (symlink) Directory

My laravel app is live now, however as mentioned in the subject, I want to restrict the direct URL access to storage directory. For eg.: One of my jpeg file is in the path https://mydomain.com/sector/IMG_1.jpeg so, if someone tries to access https://mydomain.com/sector/ it simply shows the list of all the Jpegs present in the sector folder in the server.

19 Nov
6 months ago

ravipw1801 left a reply on Getting Error 500 If Duplicate Values Given In Patch Request

@munazzil @snapey The problem was in validation rule for phone. I just added unique:users in phone validation field & now it works fine.

Thanks!

ravipw1801 started a new conversation Getting Error 500 If Duplicate Values Given In Patch Request

My laravel app was working fine, but suddenly showing error 500 internal server error, if the user updates the info with duplicate values.

This is update function in UserController

public function update(Request $request, $id)
    {
        $user = User::find($id);
        $this->validate($request,[
            "name" => "required",
            'email' => [
                'required',
                Rule::unique('users')->ignore($user->id),
            ],
            "phone" => "required"
        ]);
        $user->name = $request->name;
        $user->email = $request->email;
        $user->phone = $request->phone;

        $user->save();

        return redirect()->route('user.edit',$user->id)->with('success','You have successfully changed your details');
    }

This is the form

<form class="regform" method="post" id="user-update" action="{{ route('user.update',$user->id) }}">
                        @csrf
                        @method('patch')
my update fields here...
</form>

This is in web.php

Route::resource('user','UserController');
03 Oct
7 months ago

ravipw1801 left a reply on Deleting/Updating A File Already Present On The Database

Hey @Tomi I have already tried doing so, but am not getting expected results.

This is what I have tried so far:

Ajax:

<script>
    function delete_image()
    {
        var status = confirm("Are you sure you want to delete ?");  
        if(status==true)
        {
            $.ajax({
                headers: {
                'X-CSRF-TOKEN': $("input[name='_token']").val()
                },
                type:"POST",
                url:"{{route('business.dellogo',$business->id)}}",
                success: function(data){    

                }
            });
        }
    }
</script>

BusinessController:

public function destroyPhoto($id)
    {
        $business = Business::find($id);     
        $business->logoimg == 'no-logo.jpg';

     return true;
     
    }

Am not recieving any error, but it is also not saving as default image 'no-logo.jpg'

02 Oct
7 months ago

ravipw1801 started a new conversation Deleting/Updating A File Already Present On The Database

Building a laravel app, User can create multiple post & can upload only 1 image. In case he wishes to update later, he can do it easily, but if in case he completely wants to remove it, how this will take place?

http://prntscr.com/l18h2w

As you can see in the screenshot, It has a remove icon, but how to ACTUALLY remove the image? and replace it with default image like 'no-image.jpg'?

ravipw1801 left a reply on Laravel App Working Fine On Live Server, But Not On Localhost

It was g-captcha blocking the post request.!!! Thanks!!

ravipw1801 started a new conversation Laravel App Working Fine On Live Server, But Not On Localhost

The app was working fine on localhost, then I made it live, working fine. Now I want to make some changes, but it is not working on localhost, it does not even show any error. For eg: If am registering a new user, it does not even proceed to post the request, It shows nothing. I have done composer dump-autoload, pa config:cache & pa cache:clear

17 Aug
9 months ago

ravipw1801 left a reply on File Validation Before Upload

@Cronix Your solution works great, but only if both the images are present. Which means if the user only uploads logoimg more than 2mb & he doesn't uploads coverimg, it does passes the validation, without alerting 'Logo Image Size is exceeding 2 Mb'.

But, when the user uploads both things & in case any 1 of it exceeds, it alerts 'Logoimg/Coverimg Size is exceeding 2 Mb'

15 Aug
9 months ago

ravipw1801 left a reply on File Validation Before Upload

@Cronix I now have two file inputs logoimg & coverimg How can I validate both fields (size & extensions) fo these two file inputs(logoimg & coverimg)?

ravipw1801 left a reply on File Validation Before Upload

@pardeepkumar & the file size exceeding error message?

13 Aug
9 months ago

ravipw1801 left a reply on File Validation Before Upload

Yes @Cronix You're right again.. Thanks alot!!!!!!!

ravipw1801 left a reply on File Validation Before Upload

@Cronix Thanks alot!!

Here is the final working code as suggested by you

<script>
    $("#sub-btn").click(function(e) {
      var logoimg = document.getElementById("logoimg");
            let size = logoimg.files[0].size; 
            if (size > 2000000) {
                alert("Logo Image Size is exceeding 2 Mb");
                event.preventDefault(); 
            }
    });
</script>
11 Aug
9 months ago

ravipw1801 left a reply on File Validation Before Upload

@Thyrosis @Cronix I have found the solution for 2nd issue (spinner) but am still stuck on 1st issue, it does warn that the file size is greater, but if the smae bigger file is uploaded on second attempt, it just passes to get uploaded and then laravel validation throws an error.

10 Aug
9 months ago

ravipw1801 left a reply on File Validation Before Upload

@Cronix

  1. Thanks a ton, your solution just works fine, but if the user goes for second attempt, it just passes it.
  2. As u can see above my reply to @Thyrosis , it takes about 2-3 seconds to login & 4-5 seconds for registering & creating a new post . So I would like to show up the spinner or something like that, representing the work in process.

ravipw1801 left a reply on File Validation Before Upload

@Thyrosis

  1. When doing this at server level, it throws a very ugly error page.
  2. Sorry, I think I over exaggerated it, it takes about 2-3 seconds to login & 4-5 seconds for registering & creating a new post .
09 Aug
9 months ago

ravipw1801 started a new conversation File Validation Before Upload

Just ended building a laravel app.

But after making it live on the server, I found some-things which required immediate action.

  1. File upload max size is 2mb But if someone tries to upload a file say for eg.: 2Gb or any big file, it first gets uploaded, it takes approx 15-20 mins and then shows the error, The image cannot exceed 2mb. So just wanted to know if there's some solution for this, if the file size exceeds 2mb, it should show the error without getting uploaded.

  2. There are few tasks which takes about 30 seconds to load like logging-in, registering, creating a new post etc.. So, how can I show something like spinner icon along with text "Please be patient, while we log you in" or something like that.

03 Aug
9 months ago

ravipw1801 started a new conversation Image File Name With Space Shows Error In URL

User can upload images for their post & the image name may contain spaces. So while seeing this in front end, the spaces are replaced by %20 which shows invalid propery value.

So my question is, how can I save the image in database without spaces or the spaces replaced with any character (for eg.: hyphen or underscore) .

Below is my controller, saving images

if ($request->hasFile('logoimg')) {
            $logoimgwithExt = $request->file('logoimg')->getClientOriginalName();
            $logoimgFileName = pathinfo($logoimgwithExt, PATHINFO_FILENAME);
            $extension = $request->file('logoimg')->getClientOriginalExtension();
            $logoFileNameToStore = $logoimgFileName.'_'.time().'.'.$extension;
            $path = $request->file('logoimg')->storeAs('public/logo_images',$logoFileNameToStore);            
        } else {
          $logoFileNameToStore = 'no-logo.jpg';   
        }
27 Jul
9 months ago

ravipw1801 started a new conversation Laravel 5.6 Notification Queuing

Notification (Mail) working fine as needed, but if I do it with 'Queue', it is not actually queueing! The jobs table is always empty.

Web.php

Route::post('notifyAdminCallArrangeRequest', function () {

    $franchisee = Franchisee::find(request()->franchisee); 
    $user = User::find(request()->user);
    // Admin::find(1)->notify(new CallArrangeRequest($franchisee, $user));    *This is working fine*
    Admin::find(1)->notify(new CallArrangeRequest($franchisee, $user))->delay(now()->addMinutes(10));
    return back()->with('success','Success! Call Arrange Request sent!');



});

Notifications/CallArrangeRequest.php

<?php
namespace App\Notifications;


use App\Franchisee;
use Auth;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;


class CallArrangeRequest extends Notification implements ShouldQueue
{
    use Queueable;

    public $franchisee; 
    public $user;

/**
     * undocumented class variable
     *
     * @var string
     **/
/**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct($franchisee, $user)
    {
        $this->franchisee = $franchisee;
        $this->user = $user;       
    }
/**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }
/**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {   
        return (new MailMessage)
            ->from('[email protected]', 'Admin')
            ->subject('Call Arrange Request from'.' - '.Auth::user()->name)
            ->markdown('emails.franchiseeCallArrangeRequest', [
                'franchisee' => $this->franchisee,
                'user' => $this->user
            ]);
    }
/**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}
26 Jul
10 months ago

ravipw1801 left a reply on Laravel Notifications

Never seen such kind of help as you (@m7vm7v) did!! Thanks a lot!!!

25 Jul
10 months ago

ravipw1801 left a reply on Laravel Notifications

@m7vm7v am still stuck here! :(

18 Jul
10 months ago

ravipw1801 left a reply on Cascade Deleting With Polymorphic Relationship

Hi @Tray2 I know cascade deleting with one to one or one to many, but how this will work in polymorphic relationship?

17 Jul
10 months ago

ravipw1801 started a new conversation Cascade Deleting With Polymorphic Relationship

3 types of posts Business, Social & Nature. All these have some attributes in common Country, City & Range. These common attributes have polymorphic relation with all three types of postscountriable, citiable & rangeable.

BusinessPosts table structure:

public function up()
    {
        Schema::create('businesses', function (Blueprint $table) {
            $table->increments('id');
            $table->string('brand');
            $table->integer('user_id')->unsigned();
            $table->integer('phone');
            $table->string('email');
            $table->string('url');
            $table->text('description')->nullable();
            $table->tinyInteger('status')->default(0);
            $table->timestamps();
        });
    }

BusinesPost Model:

class BusinessPost extends Model
{

    public function ranges()
    {
        return $this->morphToMany('App\Range','rangeable');
    }

    public function countries()
    {
        return $this->morphToMany('App\Country','countriable');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }

}

Country Model:

class Country extends Model
{
    protected $fillable = ['name'];

    public function businesses()
    {
        return $this->morphedByMany('App\Business', 'countriable');
    }

    public function socials()
    {
        return $this->morphedByMany('App\Social', 'countriable');
    }

    public function natures()
    {
        return $this->morphedByMany('App\Nature', 'countriable');
    }
}

country table structure:

public function up()
    {
        Schema::create('countries', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->timestamps();
        });
    }

countriable table structure:

public function up()
    {
        Schema::create('countriables', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('country_id');
            $table->integer('countriable_id');
            $table->string('countriable_type');
            $table->timestamps();
        });
    }

So, my question is, if the user deletes a post, all of its relationships should get detached, or in case the user deletes its account, all his posts, along with relationships should get deleted?

16 Jul
10 months ago

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

@martinbean Sorry! Won't tag you from now onwards!

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

Thanks everyone for the help. I just managed the pagination part manually like this:

 $search = $social->merge($business);
    $search = $this->paginate($search);
    $search->setPath('');
    // $search;
    return view('front.search.general',compact('search','query','sector'));
    }



    public function paginate($search, $perPage = 10, $page = null, $options = [])
    {
        $page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
        $search = $search instanceof Collection ? $search : Collection::make($search);
        return new LengthAwarePaginator($search->forPage($page, $perPage), $search->count(), $perPage, $page, $options)
        ;
    }
14 Jul
10 months ago

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

Hey @Tray2 Thanks alot!!!!! I am getting the results now, but how to paginate it?

SearchController:

public function search(Request $request, $query = null)
    {
     if($query == null)
         return redirect()->route('home');

     $business = Business::where([['brand','like','%'.$query.'%'],['status','=',1]])
                         ->orWhere([['description','like','%'.$query.'%'],['status','=',1]])
                         ->orWhere([['url','like','%'.$query.'%'],['status','=',1]])                         
                         ->orWhere([['search_tags','like','%'.$query.'%'],['status','=',1]])
                         ->paginate(10);

    $social= Social::where([['brand','like','%'.$query.'%'],['status','=',1]])
                         ->orWhere([['description','like','%'.$query.'%'],['status','=',1]])
                         ->orWhere([['url','like','%'.$query.'%'],['status','=',1]])                         
                         ->orWhere([['search_tags','like','%'.$query.'%'],['status','=',1]])
                         ->paginate(10);


    $search = $business->merge($social);


     return view('front.search',[
         'results' => $search,
         'query' => $query
     ]);
    }

view blade:

...
 {{$results->links()}}
...

Error:

ErrorException (E_ERROR)
Method Illuminate\Database\Eloquent\Collection::links does not exist.

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

@Snapey I know merging two results But how to run the query twice?

Merging:

$table1 = Model1::where....
$table2 = Model2::where....

$result = $table2->merge($table1)

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

@jimmck I don't know joining tables in database :( I have just started web development. Below is the businesses table structure, likewise is table of socials

public function up()
    {
        Schema::create('businesses', function (Blueprint $table) {
            $table->increments('id');
            $table->string('brand');
            $table->integer('user_id')->unsigned();
            $table->integer('phone');
            $table->string('email')->unique();
            $table->string('url')->nullable();           
            $table->string('description');
            $table->tinyInteger('status')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('businesses');
    }
}

13 Jul
10 months ago

ravipw1801 left a reply on Union/Join/Merge Table To Get The Result

Hey @jimmck ! Thanks for replying, but as am a newbie, little more explaination will be highly appreciated!

ravipw1801 started a new conversation Union/Join/Merge Table To Get The Result

Building a Laravel app. Want to implement the search functionality. There are 2 types of posts; business & social.

Till now I am able to get the result from a single table; i.e; either from business or from social.

So just wanted to know how can I get the result from both the tables?

PS:

  1. No connection between these tables
  2. Both the tables have some common attributes (user_id, country, city etc..)

Search controller:

<?php

namespace App\Http\Controllers;

use App\Business;
use Illuminate\Http\Request;

class SearchController extends Controller
{
    public function search(Request $request, $query = null)
    {
     if($query == null)
         return redirect()->route('home');

      $search = Business::where([['brand','like','%'.$query.'%'],['status','=',1]])
                      ->orWhere([['description','like','%'.$query.'%'],['status','=',1]])
                      ->orWhere([['url','like','%'.$query.'%'],['status','=',1]])                         
                      ->orWhere([['search_tags','like','%'.$query.'%'],['status','=',1]])                         
                      ->paginate(10);


return view('front.search',[
         'results' => $search,
         'query' => $query
     ]);
    }
}

12 Jul
10 months ago

ravipw1801 left a reply on Unique Email Validation On Update (Laravel 5.6)

@Sergiu17

public function rules()
{
    $business= Business::find($this->id);

    return [
    ...
    'email' => ['required','email',Rule::unique('businesses','email')->ignore($business->id)],
    ...
    ],
}
ErrorException (E_NOTICE)
Trying to get property 'id' of non-object
  

ravipw1801 started a new conversation Unique Email Validation On Update (Laravel 5.6)

A user has many posts, & there are many types of posts. All types of posts are getting validated by form requests php artisan make:request validateBusinessPost

But while updating the post, the email id is not passing the validation The email ID already exists

Please help,

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class validateBusinessPost extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
    return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
    return [
        "brand" => "required",
        "phone" => "required|unique:businesses,phone,
        "email" => "required|email|unique: businesses, email,
        "countries" => "required|array|min:1",
        "cities" => "required|array|min:1",      
        "description" => "required",       
        "terms_&_conditions" => "accepted"
    ];
}


public function messages()
{
    return [
      
        'brand.required' => 'The name of your business is required',
        'phone.required' => 'The mobile number is required',
        'phone.unique' => 'The mobile number is already registered',
        'email.required' => 'The email address is required',
        'email.email' => 'Please enter a valid email address',
        'email.unique' => 'The email ID you entered already exist',    
        'description.required' => 'A short description of your business is required',  
        'countries.required' => 'Please select the country',
        'cities.required' => 'Please select the city',
       
    ];
}
}