In addition to another answers,
I'm still new to OOP concepets, what am I doing wrong?
Basically everything. You has both global state and static methods, which is bad. Just using static classes in order to wrap things doesn't mean you use OOP paradigm.
class User extends Eloquent
{
public static $user = new Fb();
public function mySnippets(){
return Snippet::all()->where('author','=',self::$user->getUser());
}
}
This is wrong.
In terms of OOP, this should be similar to this one:
class User extends Eloquent
{
private $fb;
public function __construct(FB $fb)
{
$this->fb = $fb;
}
public function mySnippets()
{
return Snippet::all()->where('author', '=', $this->user->getUser());
}
}
//Usage:
$fb = new FB();
$user = new User($fb);
var_dump($user->mySnippets());