Binaryfolks 2020 Dev Assignment
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

Error while using Gate class Empty Error while using Gate class

Thu Aug 06, 2020 10:32 pm
Error while using Gate class Screen12
Getting this error when I am trying to use
Code:
   Gate::define('update-conversation', function (User $user, Conversation $conversation) {
            return true;
        });
this in my "AuthServiceProvider.php" file.
avatar
Jeetbasak54@gmail.com
Posts : 18
Join date : 2020-07-25

Error while using Gate class Empty Re: Error while using Gate class

Thu Aug 06, 2020 11:20 pm
May be You are missing a use statement for the conversation class,

Add the following in the provider class:

use App\conversation;
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

Error while using Gate class Empty Re: Error while using Gate class

Fri Aug 07, 2020 4:12 am
Here's my AuthServiceProvider file:-
Code:
<?php

namespace App\Providers;

use App\User;
use App\Coversation;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;


class AuthServiceProvider extends ServiceProvider
{
    /**
    * The policy mappings for the application.
    *
    * @var array
    */
    protected $policies = [
        // 'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
    * Register any authentication / authorization services.
    *
    * @return void
    */
    public function boot()
    {
        $this->registerPolicies();

        Gate::define('update-conversation', function (User $user, Conversation $conversation) {
            return true;
        });
    }
}
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

Error while using Gate class Empty Can you just check on my problem too ? It's same type of problem. Maybe you can help me .

Sun Aug 09, 2020 3:39 am
Sudipta Das wrote:Here's my AuthServiceProvider file:-
Code:
<?php

namespace App\Providers;

use App\User;
use App\Coversation;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;


class AuthServiceProvider extends ServiceProvider
{
    /**
    * The policy mappings for the application.
    *
    * @var array
    */
    protected $policies = [
        // 'App\Model' => 'App\Policies\ModelPolicy',
    ];

    /**
    * Register any authentication / authorization services.
    *
    * @return void
    */
    public function boot()
    {
        $this->registerPolicies();

        Gate::define('update-conversation', function (User $user, Conversation $conversation) {
            return true;
        });
    }
}

pinakibhowmick likes this post

Sponsored content

Error while using Gate class Empty Re: Error while using Gate class

Back to top
Permissions in this forum:
You cannot reply to topics in this forum