public function getDataTable() { $moo = LotDef::where('map_id', 2)->pluck('id')->toArray(); $lotinfos = collect(LotInfo::whereIn('lot_id', $moo)->get(array('lot_num', 'lot_name', 'status_id', 'critical_issue_flag', 'build_type_id', 'notes', 'builder_date', 'adjust_date_to', 'created_at', 'verify_no_update', 'user_id'))); $lotinfos = $lotinfos->sortByDesc('created_at'); $lotinfos = $lotinfos->unique('lot_num'); $lotinfos = $lotinfos->values(); return Datatable::collection($lotinfos)->showColumns('lot_num', 'lot_name')->addColumn('status_id', function ($model) { return $model->statusdef->label; })->showColumns('critical_issue_flag')->addColumn('build_type_id', function ($model) { return $model->buildtype->label; })->showColumns('notes', 'builder_date', 'adjust_date_to', 'created_at', 'verify_no_update')->addColumn('user_id', function ($model) { return $model->user->name; })->searchColumns('lot_num')->orderColumns('lot_num')->make(); }
public function alpha() { $lotmap = LotMap::latest()->get(); $lotdefs = LotDef::where('map_id', '=', 2)->get(); $lds = $lotdefs->select('id')->distinct()->pluck('id'); $lotinfos = LotInfo::whereIn('id', $lds); // $lotinfos = LotInfo::all(); $statusdefs = StatusDef::where('build_type_id', '=', 3)->orderBy('order', 'DESC')->get(); //dd(compact('lotmap', 'lotdefs', 'lotinfos')); return view('lot_master_alpha', compact('lotmap', 'lotdefs', 'lotinfos', 'statusdefs')); }
|-------------------------------------------------------------------------- | Routes File |-------------------------------------------------------------------------- | | Here is where you will register all of the routes in an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ use App\Http\Requests; //use Illuminate\Http\Request; use App\LotDef; Route::get('k', function () { $goods = []; $goods['lotmap'] = App\LotMap::findOrFail(2); $goods['lotdefs'] = App\LotDef::all(); return $goods; }); //Route::get('/', function() { // return view('welcome'); //}); Route::get('map', 'LotInfosController@map'); Route::get('defs', function () { $defs = LotDef::all(); return $defs; }); //Route::get('mapa', 'LotInfosController@alpha'); //Route::get('api/lotinfo/{lotid}', 'LotInfosController@getLotInfo'); //Route::post('api/lotinfo/{lotid}', 'LotInfosController@store'); Route::resource('lotinfos', 'LotInfosController'); /*