mushti

Experience

1,290

2 Best Reply Awards

  • Member Since 6 Months Ago
  • 1 Lesson Completed
  • 0 Favorites

28th September, 2017

mushti left a reply on Consuming Your API With JavaScript (Passport + VUE) • 2 weeks ago

Adding \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class to web middlewares array, which you have already applied, will work for POST /login.

mushti left a reply on Consuming Your API With JavaScript (Passport + VUE) • 2 weeks ago

Which method are you using to authenticate the user? POST /login or POST /oauth/token?

mushti left a reply on Consuming Your API With JavaScript (Passport + VUE) • 2 weeks ago

In your App\Http\Kernel file, add \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class to the web middlewares array.

'web' => [
    \App\Http\Middleware\EncryptCookies::class,
    \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
    \Illuminate\Session\Middleware\StartSession::class,
    \Illuminate\View\Middleware\ShareErrorsFromSession::class,
    \App\Http\Middleware\VerifyCsrfToken::class,
    \Illuminate\Routing\Middleware\SubstituteBindings::class,
    
    // Add it here...
    \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,

],

26th September, 2017

mushti left a reply on Auth With MD5 • 3 weeks ago

Have a look at manual authentication documentation and see if that can help you now to start the user's session.

mushti left a reply on Auth With MD5 • 3 weeks ago

Make sure the hashing algorithm used in the database is md5 by running this query:

SELECT * FROM `users` WHERE `email` = '[email protected]' AND `password` = MD5('helloworld');

Also add dd($user); after:

    $user = \App\Models\User::where([
        'email' => $request->email,
        'password' => md5($request->password)
    ])->first();

    dd($user);

...to see whether it fetches any user.

mushti left a reply on Auth With MD5 • 3 weeks ago

If you are using the default authentication controllers which come with Laravel, just override the attemptLogin() method in App\Http\Controllers\Auth\LoginController class like this:

/**
 * Attempt to log the user into the application.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return bool
 */
protected function attemptLogin(Request $request)
{
    $user = \App\Models\User::where([
        'email' => $request->email,
        'password' => md5($request->password)
    ])->first();
    
    if ($user) {
        $this->guard()->login($user, $request->has('remember'));

        return true;
    }

    return false;
}

mushti left a reply on Consulting Needed For Finishing Stages Of Laravel Project • 3 weeks ago

Interested

22nd September, 2017

mushti left a reply on Eloquent Casts Array Returns Null Instead Of Empty Array • 3 weeks ago

You can set a default value to your archive table column params so that the value is never null. Here is an example:

Schema::create('archives', function (Blueprint $table) {
            $table->increments('id');
            $table->string('params')->default('[]');
            $table->timestamps();
});

5th September, 2017

mushti left a reply on Change The Login/register URL In Laravel 5.5 • 1 month ago

In your routes\web.php file, remove the Auth::routes(); with the following:

        // Authentication Routes...
        $this->get('admin/login', 'Auth\[email protected]')->name('login');
        $this->post('admin/login', 'Auth\[email protected]');
        $this->post('admin/logout', 'Auth\[email protected]')->name('logout');

        // Registration Routes...
        $this->get('admin/register', 'Auth\[email protected]')->name('register');
        $this->post('admin/register', 'Auth\[email protected]');

        // Password Reset Routes...
        $this->get('admin/password/reset', 'Auth\[email protected]')->name('password.request');
        $this->post('admin/password/email', 'Auth\[email protected]')->name('password.email');
        $this->get('admin/password/reset/{token}', 'Auth\[email protected]')->name('password.reset');
        $this->post('admin/password/reset', 'Auth\[email protected]');

20th April, 2017

mushti left a reply on Laravel Relation For Different User Types • 5 months ago

The solution given by @ohffs won't break anything. Just replace $this->is_shop with the property you use to differentiate between a shop and a supplier.

19th April, 2017

mushti left a reply on Auth::id() Showing Null • 5 months ago

Please define the auth middleware on the route before using Auth::id() otherwise it will always return null.

Route::middleare('auth')->prefix('seller')->group(function(){
     Route::get('/sms', 'seller\way2sms\[email protected]');
});

mushti left a reply on How To Pass $id From Controller To Route And Route To Controller • 5 months ago

You can do something like this:

        if(Auth::user()->phoneconfirmed==0)
        {
            return redirect('/seller/sms/'.$id);
        }

mushti left a reply on Logout In Laravel • 6 months ago

What I've seen so far, its the default behavior of the web browsers. They sort of handle the back functionality by fetching the web page from the cache until you refresh it.

mushti left a reply on Laravel & Passport = Frustration And 401 • 6 months ago

Have you set the authentication guard driver for api to passport in config\auth.php?

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
],
Edit Your Profile
Update

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