Skip to content

Instantly share code, notes, and snippets.

@milosdakic
Created November 29, 2017 02:26
Show Gist options
  • Save milosdakic/d8f0400af0bee123842955c5fda0ea68 to your computer and use it in GitHub Desktop.
Save milosdakic/d8f0400af0bee123842955c5fda0ea68 to your computer and use it in GitHub Desktop.
<?php
class AdvancedUser extends User
{
public function type()
{
return 'advanced';
}
}
<?php
class Product extends Model {
public function user()
{
return $this->belongsTo(app('App\User'));
}
}
<?php
class User extends Model
{
public function type()
{
return 'basic';
}
}
<?php
class UserServiceProvider
{
public function register()
{
$this->app->bind('App\User', AdvancedUser::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment