Skip to content

Instantly share code, notes, and snippets.

@bkintanar
Last active August 29, 2015 14:23
Show Gist options
  • Save bkintanar/208f7cfb86391b7f8e9f to your computer and use it in GitHub Desktop.
Save bkintanar/208f7cfb86391b7f8e9f to your computer and use it in GitHub Desktop.
<?php
// Controller:
$employee = $this->employee->getEmployeeById($employee_id);
// Model:
public function getEmployeeById($employee_id)
{
if ($employee_id)
{
$employee = self::whereEmployeeId($employee_id)->first();
}
else
{
$employee = self::whereUserId($this->loggedUser->id)->first();
}
if ( ! $employee)
{
return Response::make(View::make('errors.404'), 404);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment