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
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty error loading after clicking best reply

Sat Aug 08, 2020 11:11 pm
error loading after clicking best reply  Whatsa15
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Sun Aug 09, 2020 4:21 am
show me your AuthServiceProvider file.
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Sun Aug 09, 2020 11:34 am
Sudipta Das wrote:show me your AuthServiceProvider file.
error loading after clicking best reply  Img-2011
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty 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;
        });
    }
}
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Sun Aug 09, 2020 6:56 pm
Sudipta Das wrote:show me your AuthServiceProvider file.

getting same problem

error loading after clicking best reply  Whatsa16
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty 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;
        });
    }
}
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty 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 .
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Sun Aug 09, 2020 11:20 pm
Show me the exact error message that you are getting.
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 12:16 am
Sudipta Das wrote:Show me the exact error message that you are getting.
error loading after clicking best reply  Screen11
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 12:57 am
Sudipta Das wrote:Show me the exact error message that you are getting.
error loading after clicking best reply  Screen11
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 2:49 am
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.
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 3:15 am
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->is($user);
        });
    }
}

if this doesn't work then check your ConversationPolicy.php file.
I tried these 2 code you gave but none of them worked what about conversation policy .php file
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 5:03 am
Then check your BestReplyController file.
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty 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 !
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty 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();
    }
}
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 3:20 pm
Sudipta Das wrote:Then check your BestReplyController file.
scratch
error loading after clicking best reply  Whatsa17
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty 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();
    }
}
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty 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();
    }
}
avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty 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 .
avatar
Sudipta Das
Posts : 14
Join date : 2020-07-25

error loading after clicking best reply  Empty 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

avatar
pinakibhowmick
Posts : 31
Join date : 2020-07-26
Age : 25

error loading after clicking best reply  Empty Re: error loading after clicking best reply

Mon Aug 10, 2020 6:07 pm
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.
Ok .🙂
Sponsored content

error loading after clicking best reply  Empty Re: error loading after clicking best reply

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