Support the ongoing development of Laravel.io →
posted 7 years ago
Views
Last updated 2 years ago.
0


namespace App\Addons;

use Auth;
use View;
use App\User;
use App\Addons\UserNotFound;
use App\Addons\nonAuthUser;
use App\Http\Controllers;

 abstract class Visitor {
	
	protected $user;
	
        public function __construct($user){
		$this->user=$user;
	}
	
	static function getType($username){
	
		$user=User::where('username',$username)->first();
		if(!$user)
			return new UserNotFound($user);
		
		if( $username != \Auth::user()->username) 
			return new nonAuthUser($user);
		return new AuthUser($user);
	}
	abstract public function showProfile();
} 
Last updated 7 years ago.
0
namespace App\Addons;

class AuthUser extends Visitor {

	public function showProfile(){
		
		return view('profile.profile');
	}

} 
Last updated 7 years ago.
0

return from controller

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.