public function index() { /* @var Faculty $faculty */ $projects = Project::whereHas('status', function ($q) { $q->where('key', '=', 'university'); })->orderBy('updated_at', 'desc')->get(); return view("backends.university.project-index")->with('projects', $projects); }
public function index() { $projects = Project::whereHas('status', function ($q) { $q->where('key', '=', 'published'); })->limit(6)->orderBy('updated_at', 'desc')->get(); $posts = Post::whereHas('status', function ($q) { $q->where('key', '=', 'published'); })->limit(6)->orderBy('updated_at', 'desc')->get(); return view('frontends.index')->with('projects', $projects)->with('posts', $posts); }
public function index() { /* @var Faculty $faculty */ $user = Auth::user(); $faculty = $user->faculty; $projects = Project::whereHas('status', function ($q) { $q->where('key', '=', 'faculty'); })->whereHas('faculty', function ($q) use($faculty) { $q->where('id', '=', $faculty->id); })->orderBy('updated_at', 'desc')->get(); return view("backends.faculty.project-index")->with('projects', $projects); }
Route::group(['prefix' => 'post'], function () { Route::group(['middleware' => ['cors']], function () { Route::get('/', "Backends\\PostController@listPost"); Route::get('/{id}', "Backends\\PostController@getPost"); Route::post('/{id}/doUploadPhoto', "Backends\\PostController@doUploadPhoto"); Route::post('/{id}/photo/{photoId}/delete', "Backends\\PostController@doDeletePhoto"); Route::post('/{id}/photo/{photoId}/doEditPhoto', "Backends\\PostController@doEditPhoto"); }); Route::get('/{id}/cover/{filename?}', 'Backends\\PostController@getCover'); Route::get('/{id}/photos/{file}', "Backends\\PostController@getPhoto"); }); }); Route::group(['prefix' => 'api', 'middleware' => ['api']], function () { Route::get('project', function () { $projects = Project::whereHas('status', function ($q) { $q->where('key', '=', 'published'); })->get(); return $projects; }); Route::get('project/{id}', function ($id) { $project = Project::with(['photos', 'youtubes', 'users'])->find($id); return $project; }); Route::get('/researcher/dropdown/{keyword?}', "Backends\\UserController@apiGetResearcherForDropdown"); Route::get("/province", function () { return \App\Models\Thailand\Province::all(); }); Route::get("/province/{provinceId}/amphur", function ($provinceId) { return \App\Models\Thailand\Amphur::where("PROVINCE_ID", "=", $provinceId)->get(); }); Route::get("/province/{provinceId}/amphur/{amphurId}/district", function ($provinceId, $amphurId) {