Last active
August 29, 2015 14:23
-
-
Save bkintanar/208f7cfb86391b7f8e9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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