Skip to content

Instantly share code, notes, and snippets.

@kamaulynder
Created September 14, 2016 05:32
Show Gist options
  • Select an option

  • Save kamaulynder/d8876a2515d37a7cfa6d59d992d3db25 to your computer and use it in GitHub Desktop.

Select an option

Save kamaulynder/d8876a2515d37a7cfa6d59d992d3db25 to your computer and use it in GitHub Desktop.
@@ -8,31 +8,39 @@ class EloquentUserRepository implements UserRepository
{
public function all()
{
- return User::all();
+ $users = User::all();
+
+ return $users->toArray();
}
public function update(array $input, $id)
{
$user = User::findorFail($id);
$user->update($input);
- return $user;
+
+ return $user->toArray();
}
public function create(array $input)
{
- return User::create($input);
+ $user = User::create($input);
+
+ return $user->toArray();
}
public function find($id)
{
- return User::find($id);
+ $user = User::find($id);
+
+ return $user->toArray();
}
public function delete($id)
{
$user = User::findorFail($id);
$user->delete();
- return $user;
+
+ return $user->toArray();
}
public function getRoles($id)
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment