app/Http/Controllers/HomeController.php
/**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
Show the application dashboard.
@return \Illuminate\Http\Response
Show the application dashboard . @return \ Illuminate \ Http \ Response
public function index()
    {
        $users = User::all();
        $user_id = auth()->user()->id;
        $user = User::find($user_id);
        if($user->role == 'admin')
        {
            return view('profile.home')->with('articles', $user->article)->with('users',$users);
        }
        return redirect('/articles')->with('error','Samo admin može u panel');
    }
public function index ( ) { $ users = User :: all ( ) ; $ user_id = auth ( ) -> user ( ) -> id ; $ user = User :: find ( $ user_id ) ; if ( $ user -> role == 'admin' ) { return view ( 'profile.home' ) -> with ( 'articles' , $ user -> article ) -> with ( 'users' , $ users ) ; } return redirect ( '/articles' ) -> with ( 'error' , 'Samo admin može u panel') ; }
Show the application dashboard.
Show the application dashboard .
//dohvacamo sve korisnike