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();
}
namespace App\Addons;
class AuthUser extends Visitor {
public function showProfile(){
return view('profile.profile');
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community