dimanche 7 juillet 2019

I can't seem to access my Auth inside a vendor package

I had a Laravel app that I created, then I added another Laravel package for Oauth2 for a CRM.

This created a vendor and migration for DB. I tested it and it worked, I authenticated my CRM.

Now I would like to have that record be tied to the user_id in the Auth scaffold that I created with composer make:auth

However when I try get the current user from inside of those vendor files, it is not pulling in that information and is giving me errors.

I think this may be a namespace issue, but maybe it could be a guard or middleware. I am not sure. I am pretty laravel

I have tried a handful of other solutions, but I wasn't sure if those were tied to my specific issue

<?php

namespace Djaxho\LaravelInfusionsoftOauth2\Http\Controllers;
//namespace App\Http\Controllers\Auth;

use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
use Djaxho\LaravelInfusionsoftOauth2\Infusionsoft;

use Illuminate\Support\ServiceProvider;
//use Illuminate\Support\Facades\Auth;

class AuthorizeInfusionsoftApiController extends BaseController
'''

print Auth::user()->id;

I see that it is in its own namespace, is this what is the issue, laravel is not looking outside? I get this error

Class 'Djaxho\LaravelInfusionsoftOauth2\Http\Controllers\Auth' not found



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire