app/Http/Controllers/TareaController.php
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
Display a listing of the resource.
Display a listing of the resource .
public function index()
{
    $output = collect();
    $tareas = Tarea::with(['ot'=> function ($query) {
        $query->where('estado', 1);
    },'ot.cliente' ,'estado'])->get();
    foreach ($tareas as $key => $value) {
        if (!is_null($value->ot)) {
            array_push($output, $value);
        }
    }
    return Datatables::of($output)->make(true);
}
public function index ( ) { $ output = collect ( ) ; $ tareas = Tarea :: with ( [ 'ot' => function ( $ query ) { $ query -> where ( 'estado' , 1 ) ; } , 'ot.cliente' , 'estado' ] ) -> get ( ) ; foreach ( $ tareas as $ key => $ value ) { if ( ! is_null ( $ value -> ot ) ) { array_push ( $ output , $ value ) ; } } return Datatables :: of ( $ output ) -> make ( true ) ; }
Display a listing of the resource.
Display a listing of the resource .