- Jeetbasak54@gmail.com
- Posts : 18
Join date : 2020-07-25
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;
Add the following in the provider class:
use App\conversation;
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
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;
});
}
}
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
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
Permissions in this forum:
You cannot reply to topics in this forum