Kaustubh

Devloper at MInSysT Consulting Pvt. Ltd.

Experience

8,330

3 Best Reply Awards

  • Member Since 1 Year Ago
  • 30 Lessons Completed
  • 0 Favorites

28th August, 2018

Kaustubh started a new conversation Dropdown Model-list-select :list Not Working In Popup Modal • 1 month ago

Hi

i used dropdown input in popup model and assigned array value in :list="conopt" when i select the option i get the country name, but i was expecting for array which has id, name, sortname.

When i put that dropdown outside popup model i got my expected result. But problem is that i want that result in popup model.

// USING Dropdown List in Popup Modal (Not Working as Expected)

<div>
<b-modal title="Add Supplier" hide-footer size="lg" v-model="largeModal" @ok="largeModal = false" style="width: 140%; margin: auto;">
    <model-list-select :list="conopt" class="form-control"
        option-value="country_name"
        option-text="country_name"
        v-model="con"
        @input="state">
    </model-list-select >
</b-modal>
</div>

<script type="text/javascript">
    state(conopt){
      console.log(conopt) // Result India
    }
</script>

// USING Dropdown List without Popup Modal (Working as Expected) <model-list-select :list="conopt" class="form-control" option-value="country_name" option-text="country_name" v-model="con" @input="state"> </model-list-select >

<script type="text/javascript">
    state(conopt){
      console.log(conopt)
        /*
        GETTING EXPECTED RESULT
        {__ob__: Observer}
            country_name:"India"
            id:"45"
            phonecode:"91"
            sortname:"IN"
        */
    }
</script>

6th August, 2018

Kaustubh started a new conversation Laravel SSL Not Working Properly • 2 months ago

I have windows server and have domain of godaddy. I took SSL from godaddy and apply on my server. My domain gets secure by SSL but problem come when, i redirect from https://www.example.com and logged in it shows dashboard but when i change url to https://example.com it redirect me to login page.

Here is my VHOST file

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/mcpluat/xampp/htdocs/project/public"
    ServerName www.example.com
    ServerAlias example.com
    
    RewriteEngine on
    
    RewriteCond %{SERVER_PORT} 80  
    RewriteRule ^(.*)$ https://www.example.com/ [R,L]

    <Directory "C:/mcpluat/xampp/htdocs/project/public">
      Options Indexes FollowSymLinks Includes ExecCGI
       AllowOverride All
       Require all granted
    </Directory>
</VirtualHost>

.HTACCESS file

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Everything is working perfectly but why it is treating www.example.com and example.com a different domain

Thanks in advance

12th July, 2018

Kaustubh started a new conversation Undefined Index Driver • 3 months ago

Hi, I have two different database and i connect to another database to get the data. It works fine but when i continuously press refresh it throws Undefined Index Driver. below is my code

CONNECTION TO ANOTHER DATABASE

  // Disconnect old connection and connect to other database
  $dm = app("Illuminate\Database\DatabaseManager");
  $dm->disconnect();
  $model = Config::set("database.connections.pgsql", [
      'driver'    => 'pgsql',
      'host'      => '127.0.0.1',
      'port'      => '5432',
      'database'  => 'mwayhire_jobseeker',
      'username'  => 'postgres',
      'password'  => 'root',
      'charset'   => 'utf8',
  ]);
  DB::setDefaultConnection('pgsql');
  DB::reconnect($model);
  //End

RE CONNECTION TO CURRENT DATABASE

    // Disconnect old connection and connect to original database
    $model = Config::set("database.connections.".env('DB_CONNECTION'), [
        'driver'    => env('DB_CONNECTION'),
        'host'      => env('DB_HOST'),
        'port'      => env('DB_PORT'),
        'database'  => env('DB_DATABASE'),
        'username'  => env('DB_USERNAME'),
        'password'  => env('DB_PASSWORD'),
        'charset'   => 'utf8',
    ]);
    DB::setDefaultConnection(env('DB_CONNECTION'));
    DB::reconnect($model);
    //End

The reason behind the error is, i called credential from env file and on refresh it sometime dosent get value from env. I dont want to use hardcore values to reconnect to current database. Is there any solution for this

21st May, 2018

Kaustubh left a reply on Copy Files From URL To Server Public Folder • 4 months ago

thanks @lostdreamer_nl

i got the solution file_put_contents(public_path('datafiles\APPL').'/'.$resume,fopen(REQUEST('cand_resume_url'), 'r'));

Kaustubh started a new conversation Copy Files From URL To Server Public Folder • 4 months ago

Hi I have two project in which one project contains files and another one dont have file. I want to copy the file from one server to another server.

Server 1 URL = http://localhost/jobseeker/public/datafiles/APPL/JOBSEEKER_trOoH.pdf

Server 2 URL = http://localhost/recruiter/public/

I want to copy server1 file in server2 public folder

    $file1 = REQUEST('cand_resume_url');
    $file2 = public_path('datafiles\APPL');
    File::move($file1, $file2);

I used Copy, Move but it throwing error

The file "http://localhost/mwayhire_jobseeker/public/datafiles/APPL/JOBSEEKER_trOoH.pdf" does not exist

11th May, 2018

Kaustubh left a reply on Queue Sending All Mails To Last Recipient • 5 months ago

sa

10th May, 2018

Kaustubh started a new conversation Queue Sending All Mails To Last Recipient • 5 months ago

Hi There, I am currently facing an issue in queue mails. I made a queue table and it works perfectly when i send email to one person, but the issue comes when i fetch all records from table and foreach each of them and send mail to each recipient, It sends all the emails to the last recipient of the record. When i send email without queue it works perfectly.

for eg. i have two records in table 1st has [email protected] and another one has [email protected], when i use queue it send both emails to [email protected] and not to [email protected]

            // Daily Reports to BUSINESS HEAD
            $business = Business::where('b_daily',1)->select('business_name','b_email_id')->get();
            foreach ($business as $bus){
                dispatch(new SendEmailReports($bus->b_email_id));
            }

Please let me know if i am missing something.

20th March, 2018

Kaustubh left a reply on Fetch Auth::user()->name From Database • 6 months ago

actuall i am appending the response on ajax success

$("#chat-section ul").append('<li><div class="left-chat"><img src="https://images.g2crowd.com/uploads/product/image/large_detail/large_detail_1508920769/chatbotsbuilder.png"><p>'+data+'</p></div></li>');

The 'data' contain this output 'your name is {!! auth::user()->name !!}'

19th March, 2018

Kaustubh started a new conversation Fetch Auth::user()->name From Database • 6 months ago

Hi I have query table

id query output 1 What is my name your name is {!! auth::user()->name !!}

when i fetch data in blade i get this output your name is {!! auth::user()->name !!}

but i want your name is "USER NAME"

16th February, 2018

Kaustubh left a reply on Eloquent Relationship Not Working • 8 months ago

Quantity presents in ShopInventory Table

15th February, 2018

Kaustubh left a reply on Eloquent Relationship Not Working • 8 months ago

@arthurvillar i followed your method but Still not working

Kaustubh left a reply on Eloquent Relationship Not Working • 8 months ago

@Dexterr I think that will not affect. I dont know why its not Joining

Kaustubh left a reply on Eloquent Relationship Not Working • 8 months ago

I just updated

Kaustubh started a new conversation Eloquent Relationship Not Working • 8 months ago

Hi There I just stucked on Eloquent Relationship. The Two table are not joining. I am getting this error SQLSTATE[42703]: Undefined column: 7 ERROR: column "quantity" does not exist LINE 1: select "quantity" from "mi_cmp_product" where "mi_cmp_produc... ^ (SQL: select "quantity" from "mi_cmp_product" where "mi_cmp_product"."id" is null and "product_id" = ABC3408804)

There are Two Table 1) Company Product & 2) Shop Inventory

  1. Company Product ========================================================== id product_id(PK) product_name product_desc ========================================================== 1 | PRO1 | ABC | ABC 2 | PRO2 | ABC | ABC 3 | PRO3 | ABC | ABC
  1. Shop Inventory

========================================================== id shopid(PK) product_id(FK) Quantity ========================================================== 1 | SHP1 | PRO1 | 8 2 | SHP1 | PRO2 | 5 3 | SHP2 | PRO1 | 2

Company Product Model

12th January, 2018

Kaustubh left a reply on Is My Laravel Project Has Been Hacked Or Bug • 9 months ago

Just now i found that Every files in xampp has been affected

Kaustubh started a new conversation Is My Laravel Project Has Been Hacked Or Bug • 9 months ago

I had deployed my laravel project on Amazon Server and i recently found some extra php line of code auto generated in every files of laravel framework. I don't know is it virus or bug or it has been hacked. I have attach a sample screenshot below of config/view.php file

https://i.stack.imgur.com/jlG8h.jpg

3rd January, 2018

Kaustubh left a reply on How Sync Database From Remote To Server Database • 9 months ago

anyone?

2nd January, 2018

Kaustubh left a reply on How Sync Database From Remote To Server Database • 9 months ago

anyone?

Kaustubh left a reply on How Sync Database From Remote To Server Database • 9 months ago

any help?

Kaustubh started a new conversation How Sync Database From Remote To Server Database • 9 months ago

Hi I am creating an application in which every user has application install at their remote system. When the user gets connected to database his local system database will be sync to main server database.

I dont know how to sync database from local to server.

15th November, 2017

Kaustubh started a new conversation Select Table And Count Rows From Another Table Whose Seen Is 0 • 11 months ago

Here i want to fetch post table and i want to count records on postConversation table where post.id = postConversation.PostId where seen = 0. but in below query i get the record of all whose seen is 0 & 1, but in my case i want to fetch those row whose seen is 0

Post Table (post) id | title | text | hasImage | img_path | mentorid | menteeid | status 1 Title1 ABC 0 1113.png 12 11 1

Post Conversation Table (postConversation) id | PostId | conv | sender | receiver | seen | sen_del | rec_del 1 1 ABC 11 12 1 0 0 2 1 XYZ 12 11 1 0 0 3 1 ZCX 11 12 0 0 0 4 1 PAQ 11 12 0 0 0

$discussPosts = DB::table('post')->leftJoin('postConversation', 'post.id', '=', 'postConversation.Did') ->select('post.*', DB::raw('count(postConversation.Did) as postConversationCount')) ->groupBy('post.id') ->where('mentorid',Auth::user()->id) ->where('menteeid',$userid) ->get(); dd($discussion) //Result

Collection {#478 ▼ #items: array:4 [▼ 0 => {#476 ▼ +"id": 1 +"title": "Title1" +"text": "ABC" +"hasImage": "1" +"img_path": "1113.png" +"mentorid": "12" +"menteeid": "11" +"status": "1" +"created_at": "2017-11-16 11:16:13" +"updated_at": "2017-11-16 11:16:13" +"postConversationCount": 4

13th November, 2017

Kaustubh left a reply on Dynamic Routes • 11 months ago

route can be anything like register, home etc.

Kaustubh left a reply on Dynamic Routes • 11 months ago

@RamjithAp i want to redirect to any other defined route if not found in table. such as if i write http://localhost/community/public/login it first check in community controller and if not found the default login route will be called

Kaustubh started a new conversation Generate-routes-dynamically • 11 months ago

Route

Route::get('{communityName}', '[email protected]')->name('test');

Controller

public function test($CommunityName)
{
    $community = Community::where('communityName',$CommunityName)->get();
    if(!$community)
    {
        return redirect()->route($community);
    }

    return view('layouts.Community',compact('community'));
}

Here i want to redirect to community page if it is present in table and if that name not present in table then it should redirect to specific route

for eg. // Should redirect to community page http://localhost/community/public/DUMMYCOMMUNITY

// Should redirect to login page http://localhost/community/public/login

But this process is going in an infinite loop. is there any best way to achive this

2nd November, 2017

Kaustubh left a reply on CSRF Token Mismatch • 11 months ago

AAA

Kaustubh left a reply on CSRF Token Mismatch • 11 months ago

.mn

1st November, 2017

Kaustubh left a reply on CSRF Token Mismatch • 11 months ago

HTML FORM

                <form role="form" method="POST" action="{{ route('CommunityRegister') }}" id="form1">
                <input type="hidden" value="register" name="tab" />
                <input type="hidden" name="communityName" id="communityName" value="{{ $name }}">
                <input type="hidden" name="communityToken" id="communityToken" value="{{ $token }}">
                {{ csrf_field() }}

                    <div class="form-group">
                        <label for="email">Community Name:</label>
                        <input id="communityName1" type="text" class="form-control" name="communityName1" value="{{ $name }}" autocomplete="off" required disabled="">
                    </div>

                    <div class="form-group">
                        <label for="email">Community Token:</label>
                        <input id="communityToken1" type="text" class="form-control" name="communityToken1" value="{{ $token }}" autocomplete="off" required disabled="">
                    </div>

                    <div class="form-group">
                        <label for="email">First Name:</label>
                        <input id="fname" type="text" class="form-control" name="fname" value="{{ old('fname') }}" autocomplete="off" required>
                        @if ($errors->has('fname'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('name') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="email">Last Name:</label>
                        <input type="text" name="lname" id="lname" class="form-control" value="{{ old('lname') }}" autocomplete="off" required>
                        @if ($errors->has('lname'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('lname') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="email"> Mobile or Email <small style="color: #e05d6e;">(Email compulsory if not from community link)</small>:</label></br>
                        <input id="mobile" type="text" class="form-control" name="mobile" value="{{ old('mobile') }}" autocomplete="off" style="width: 100% !important">
                        @if ($errors->has('mobile'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('mobile') }}</small>
                            </span>
                        @endif
                    </div>

                    <div class="form-group">
                        <label for="password">Password: </label>
                        <input id="pass" type="password" name="pass" class="form-control" autocomplete="off" required>
                        @if ($errors->has('pass'))
                            <span>
                              <small style="color: #e05d6e;">{{ $errors->first('pass') }}</small>
                            </span>
                        @endif
                    </div>
                    
                    <input type="submit" name="signup" value="Sign Up & Login" class="btn btn-primary btn-block active" aria-pressed="true">

                </form>

CONTROLLER

public function CommunityRegister(Request $req)
{
    $input = $req->all();
    $mobile = REQUEST('mobile');
    if(is_numeric($mobile)){
        $has_mobile = 1;
        $validator = Validator::make($input, [
            'fname' => 'required|string|max:20',
            'lname' => 'required|string|max:20',
            'mobile' => 'required|numeric|unique:users',
            'pass' => 'required|string|min:6',
        ]);
    }else{
        $has_mobile = 0;
        $validator = Validator::make($input, [
            'fname' => 'required|string|max:20',
            'lname' => 'required|string|max:20',
            'mobile' => 'required|string|email|max:50|unique:users',
            'pass' => 'required|string|min:6',
        ]);
    }

    if($validator->passes())
    {
        $fname = REQUEST('fname');
        $lname = REQUEST('lname');
        $mobile = REQUEST('mobile');
        $password = bcrypt(REQUEST('pass'));
        $emailtoken = str_random(25);

        $ids = DB::table('users')->orderBy('id','desc')->pluck('id')->first();
        $count = $ids + 1;
        $username = strtolower($fname.$count);
        $name = $fname.' '.$lname;

        $data = array(
            'name' => $name,
            'fname' => $fname,
            'lname' => $lname,
            'username' => $username,
            'mobile' => $mobile,
            'password' => $password,
            'emailtoken' => $emailtoken,
            'has_mobile'   => $has_mobile,
            'phone_verified' => TRUE,
        );
        DB::table('users')->insert($data);
        $userid = DB::table('users')->where('mobile',$mobile)->pluck('id')->first();
        $cid = DB::table('community')->where('name',REQUEST('communityName'))->where('token',REQUEST('communityToken'))->pluck('id')->first();

        $endDate = DB::table('community')->where('id',$cid)->pluck('endDate')->first();
        if(date('Y-m-d') <= $endDate)
        {
            $status = 1;
        }
        else{
            $status = 0;                
        }

        $communitydata = array(
            'Cid'       =>  $cid,
            'Uid'       =>  $userid,
            'admin'     =>  0,
            'status'    =>  $status,
        );

        DB::table('community_user')->insert($communitydata);

        $credentials = array(
            'mobile' => REQUEST('mobile'),
            'password' => REQUEST('pass'),
        );

        if (Auth::attempt($credentials)) {
            return redirect()->route('start');
        }
        else{
            return redirect()->back()->with('status','Something Went Wrong');
        }
    }

    return redirect()->back()->withErrors($validator)->withInput();
}

Kaustubh left a reply on CSRF Token Mismatch • 11 months ago

Within 10 min. It throws error even when i am not logged in.

Kaustubh started a new conversation CSRF Token Mismatch • 11 months ago

I am facing problem on a form submission. When i open a form and submit it after some time it throws token mismatch exception.

5th September, 2017

Kaustubh left a reply on How To Read Barcode Data From Barcode Scanner • 1 year ago

Thnx @hajrovica i will look at it

4th September, 2017

Kaustubh left a reply on How To Read Barcode From Device • 1 year ago

@ModestasV i didnt get it, I actually want to know how does it happen that when I scan the barcode using barcode scanner, how it will automatically put in my html textbox

Kaustubh started a new conversation How To Read Barcode From Device • 1 year ago

Hi Guys

I generated barcode successfully, but now i want to read barcode from the barcode reader device (i dont have right now) but i want to know that is there any package which, fetch the data from that barcode device.

From reading barcode i will be able to display full details on user system.

Thanks in advance

29th August, 2017

Kaustubh left a reply on How To Get Table And Text Value Of Phpword • 1 year ago

@bashy is there any package which convert doc, docx or any other file to PDF

Kaustubh left a reply on How To Get Table And Text Value Of Phpword • 1 year ago

yes s

21st August, 2017

Kaustubh left a reply on How To Use Pg_unescape_bytea • 1 year ago

as

Kaustubh left a reply on How To Use Pg_unescape_bytea • 1 year ago

as

Kaustubh started a new conversation How To Use Pg_unescape_bytea • 1 year ago

I successfully stored file in database (bytea datatype), but when i try to retrive my file it throws error

Method Illuminate\Support\Collection::__toString() must return a string value

My controller

public function index()
{
    $img = DB::table('images')->pluck('file');
    $decode = pg_unescape_bytea($img);
    dd($decode);
    return view('home',compact('decode'));
}

// To store file in database

public function save(Request $req)
{
    $resume = Input::file('file');
    $extenstion = file_get_contents($resume);
    $file = pg_escape_bytea($extenstion);
    $data = array('file' => $file); 
    DB::table('images')->insert($data);
    return redirect()->back();
}

16th August, 2017

Kaustubh started a new conversation How To Pass Variable In Validation Rule • 1 year ago

Hi guys,

I want to validate text field if Commission amount is less than 4.5% on Salary

<input type="text" id="salary" name="salary">
<input type="text" id="commission" name="commission" placeholder="Amt should be >= 4.5% on salary">

public function hrCJPsave(Request $req)
{  
     $salary => REQUEST('salary');
     $commission = $salary*4.5/100;

    $input = $req->all();
    $validator = Validator::make($input, [
        'salary'            =>  'required|max:2',
        'commission'        =>  'required|min:$commission'            
    ]);
}

How can i pass variable in validator

15th August, 2017

Kaustubh started a new conversation Old Value In Select Option • 1 year ago

Hi,

I have a form in which there is a select option for Gender, what i want to achive is if my validator fails then its get redirect back with old inputs. but i dont know how to populate my select option with old value.

<select id="gender" name="gender">
    <option value="male">Male</option>
    <option value="female">Female</option>
</select>

I have another question. I have user table in which user has role. When admin update user record his role dropdown should contain all roles but the selected role should be his role which is in his record

Role Dropdown -  HR Manager   ----> selected ..as stored in database
                              Admin
                              Superadmin

9th August, 2017

Kaustubh left a reply on Cant Foreach Array In Blade • 1 year ago

asdasd

Kaustubh left a reply on Cant Foreach Array In Blade • 1 year ago

ssd

Kaustubh left a reply on Route Not Define In Laravel • 1 year ago

chu

Kaustubh started a new conversation Cant Foreach Array In Blade • 1 year ago

I am facing problem in updateform when user gets redirect to update page in controller it firsts check if the row exists or not . If that table dosent contains user data then it pass null value in array and pass to the blade

In below code the if condition works perfectly but else condition shows error ( Trying to get property of non-object )

Controller

public function recruiterDet()
{
    $auth = Auth::User()->id;
    $miRec = Recruiters::where('userid',$auth)->first();

    if(!empty($miRec))
    {
        return view('RcDetailMainpage',compact('$miRec'));
    }
    else{
        $miRec = collect([['cmpname'=>NULL,'Address'=>NULL],]);
        return view('RcDetailMainpage',compact('$miRec'));
    }
}

Blade View

@foreach($miRec as $a)
<input type="text" class="form-control" id="cmpname" name="cmpname" value="{{ $a->cmpname }}">
<input type="text" class="form-control" id="Address" name="Address" value="{{ $a->Address }}">
@endforeach

1st August, 2017

Kaustubh left a reply on Redirect Different Views Base On Roles • 1 year ago

..\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php

protected function authenticated(Request $request, $user)
{
    if($user->id_role === 1) {
        return redirect()->intended(route('superuser.index'));
    }
    elseif($user->id_role === 2) {
        return redirect()->intended(route('admin.index'));
    }
    return redirect()->intended(route('user.index'));
}

31st July, 2017

Kaustubh left a reply on How To Handel BadMethodCallException • 1 year ago

Thanks @DanielBanciulea for giving your precious time

Kaustubh started a new conversation Sql Injection • 1 year ago

Url

http://localhost/test/public/userlogin/3

Route

Route::get('/userlogin/{id}',['uses' => '[email protected]', 'as' => 'login.get']);

Controller

public function userlogin($id)
{
    $id = Auth::user()->id;
    $Task = App\Task::where('userid',$id)->first();
    return view('task', ['task'=>$task]);
}

is there any way to prevent sql injection from url

Kaustubh left a reply on How To Handel BadMethodCallException • 1 year ago

@DanielBanciulea nothing happens

Kaustubh left a reply on How To Handel BadMethodCallException • 1 year ago

<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

class Handler extends ExceptionHandler
{
    /**
     * A list of the exception types that should not be reported.
     *
     * @var array
     */
    protected $dontReport = [
        \Illuminate\Auth\AuthenticationException::class,
        \Illuminate\Auth\Access\AuthorizationException::class,
        \Symfony\Component\HttpKernel\Exception\HttpException::class,
        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
        \Illuminate\Session\TokenMismatchException::class,
        \Illuminate\Validation\ValidationException::class,
    ];

    /**
     * Report or log an exception.
     *
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
     *
     * @param  \Exception  $exception
     * @return void
     */
    public function report(Exception $exception)
    {
        parent::report($exception);
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Exception  $exception
     * @return \Illuminate\Http\Response
     */
    public function render($request, Exception $exception)
    {
        if ($exception instanceof BadMethodCallException) {
            return response()->view('errors/RouteNotFound');
        }
        return parent::render($request, $exception);
    }

    /**
     * Convert an authentication exception into an unauthenticated response.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Illuminate\Auth\AuthenticationException  $exception
     * @return \Illuminate\Http\Response
     */
    protected function unauthenticated($request, AuthenticationException $exception)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }

        return redirect()->guest(route('login'));
    }
}

Kaustubh left a reply on How To Handel BadMethodCallException • 1 year ago

I want to handel BadMethodCallException and want to redired to Controller not found page.

Here is dd($exception)

BadMethodCallException {#215 ▼
  #message: "Method [login] does not exist."
  #code: 0
  #file: "C:\xampp\htdocs\lv54\vendor\laravel\framework\src\Illuminate\Routing\Controller.php"
  #line: 82
  trace: {▶}
}

and i am using 5.4 version

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.