Created
August 9, 2018 11:49
-
-
Save raank/f5726fd99af1933f3c6b08f013628848 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 | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Colaborador; | |
class HomeController extends Controller | |
{ | |
/** | |
* Create a new controller instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
$this->middleware('auth'); | |
} | |
/** | |
* Show the application dashboard. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index(Request $request) | |
{ | |
$hasInternacao = $request->internacao ?? true; // true or false; | |
// faz a listagem dos itens de colabores com internação. | |
$items = Colaborador::whereHas('cargo', function() use ($hasInternacao) { | |
return $query->where('internacao', $hasInternacao); | |
})->get(); | |
return view('home'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment