- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
error loading after clicking best reply
Sat Aug 08, 2020 11:11 pm
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Sun Aug 09, 2020 4:21 am
show me your AuthServiceProvider file.
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Sun Aug 09, 2020 11:34 am
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Sun Aug 09, 2020 11:49 am
Sudipta Das wrote:show me your AuthServiceProvider file.
- Code:
<?php
namespace App\Providers;
use App\User;
use App\Conversation;
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;
return $conversation->user==$user;
});
}
}
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Sun Aug 09, 2020 6:56 pm
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Sun Aug 09, 2020 8:44 pm
Try this-
- Code:
<?php
namespace App\Providers;
use App\User;
use App\Conversation;
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, $conversation) {
// return true;
return $conversation->user==$user;
});
}
}
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Sun Aug 09, 2020 11:13 pm
Sudipta Das wrote:Try this-
- Code:
<?php
namespace App\Providers;
use App\User;
use App\Conversation;
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, $conversation) {
// return true;
return $conversation->user==$user;
});
}
}
I did this but nothing happened now I am getting that I am unauthorised .
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Sun Aug 09, 2020 11:20 pm
Show me the exact error message that you are getting.
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 12:16 am
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 12:57 am
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Mon Aug 10, 2020 2:49 am
Try this-
if this doesn't work then check your ConversationPolicy.php file.
- Code:
<?php
namespace App\Providers;
use App\User;
use App\Conversation;
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, $conversation) {
// return true;
return $conversation->user->is($user);
});
}
}
if this doesn't work then check your ConversationPolicy.php file.
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 3:15 am
I tried these 2 code you gave but none of them worked what about conversation policy .php fileSudipta Das wrote:Try this-
- Code:
<?php
namespace App\Providers;
use App\User;
use App\Conversation;
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, $conversation) {
// return true;
return $conversation->user->is($user);
});
}
}
if this doesn't work then check your ConversationPolicy.php file.
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Mon Aug 10, 2020 5:03 am
Then check your BestReplyController file.
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 9:54 am
Sudipta Das wrote:Then check your BestReplyController file.
Can you provide your code so I can compare !
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Mon Aug 10, 2020 2:39 pm
- Code:
<?php
namespace App\Http\Controllers;
use App\Reply;
use Illuminate\Http\Request;
class ConversationBestReplyController extends Controller
{
public function store(Reply $reply)
{
$this->authorize('update-conversation', $reply->conversation);
$reply->conversation->best_reply_id = $reply->id;
$reply->conversation->save();
//$reply->conversation->setBestReply($reply);
//return back();
}
}
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 3:20 pm
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 3:22 pm
Sudipta Das wrote:Then check your BestReplyController file.
- Code:
<?php
namespace App\Http\Controllers;
use App\Reply;
use Illuminate\Http\Request;
class ConversationBestReplyController extends Controller
{
public function store(Reply $reply)
{
/*if (Gate::denies('update-conversation', $reply->conversation)) {
}*/
$this->authorize('update', $reply->conversation);
$reply->conversation->setBestReply($reply);
return back();
}
}
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Mon Aug 10, 2020 3:48 pm
- Code:
<?php
namespace App\Http\Controllers;
use App\Reply;
use Illuminate\Http\Request;
class ConversationBestReplyController extends Controller
{
public function store(Reply $reply)
{
/*if (Gate::denies('update-conversation', $reply->conversation)) {
}*/
$this->authorize('update-conversation', $reply->conversation);
$reply->conversation->setBestReply($reply);
return back();
}
}
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 5:10 pm
Sudipta Das wrote:
- Code:
<?php
namespace App\Http\Controllers;
use App\Reply;
use Illuminate\Http\Request;
class ConversationBestReplyController extends Controller
{
public function store(Reply $reply)
{
/*if (Gate::denies('update-conversation', $reply->conversation)) {
}*/
$this->authorize('update-conversation', $reply->conversation);
$reply->conversation->setBestReply($reply);
return back();
}
}
I tried this , I tried almost all the codes they showing in the course but same problem .
- Sudipta Das
- Posts : 14
Join date : 2020-07-25
Re: error loading after clicking best reply
Mon Aug 10, 2020 5:53 pm
Then try to do all the steps from first again. And take some help from the video's comment section which you are watching.
pinakibhowmick likes this post
- pinakibhowmick
- Posts : 31
Join date : 2020-07-26
Age : 25
Re: error loading after clicking best reply
Mon Aug 10, 2020 6:07 pm
Ok .Sudipta Das wrote:Then try to do all the steps from first again. And take some help from the video's comment section which you are watching.
- Error while loading landing page
- Server not loading after creating the ServerName but loading from local host
- cURL error 77: error setting certificate verify locations: CAfile: cacert.pem CApath: none
- Problem while loading conversations ( authentication video tutorial part )
- Archived thread ... Don't post here. For New Problem Start New Thread
Permissions in this forum:
You cannot reply to topics in this forum