mardi 27 mars 2018

Laravel: GlobalController with Auth

i will call a Controller all times. It is my GlobalController. I will use the Auth, and DB Function.

I doing this:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Auth;
use DB;


class GlobalController extends Controller
{

      function user_in_party() {
        // Get the logged user
        $user = Auth::user();
        print_R($user);
        exit;
      }

}

Now i call this from my Web.php (Routes) like this but i don't become the Authed user back why?

app('App\Http\Controllers\GlobalController')->user_in_party();

Can u help me? Or say me a better Solution?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2GuPOwK
via IFTTT

Aucun commentaire:

Enregistrer un commentaire