本文整理汇总了PHP中app\Project::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::orderBy方法的具体用法?PHP Project::orderBy怎么用?PHP Project::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Project
的用法示例。
在下文中一共展示了Project::orderBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moduleAndPageCreate
public function moduleAndPageCreate($request)
{
$projectID = Project::orderBy('id', 'desc')->first();
$modules = $request->projected_total_modules;
$m = 1;
$pages = $request->projected_total_pages / $request->projected_total_modules;
$p = 1;
$pageNumber = 1;
while ($m <= $modules) {
$newModule = new Module();
$newModule->project_id = $projectID->id;
$newModule->name = 'Modulo' . $m;
$newModule->projected_total_pages = $pages;
$newModule->save();
$p = 1;
while ($p <= $pages) {
$moduleID = Module::orderBy('id', 'desc')->first();
$newPage = new Page();
$newPage->module_id = $moduleID->id;
$newPage->name = $pageNumber;
$newPage->save();
$p++;
$pageNumber++;
}
$m++;
}
}
示例2: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$projects = Project::orderBy('priority')->get();
if ($request->ajax()) {
return $projects->toArray();
}
return view('admin.projects.index', ['projects' => $projects]);
}
示例3: pdf
public function pdf()
{
/// listado en pdf, de los projectos mas recientes con los datos mas importantes.
$projects = Project::orderBy('name', 'desc')->get();
$pdf = PDF::loadView('projects/pdf', compact('projects'));
//ciclo para recorrer el array
return $pdf->stream();
}
示例4: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$type = $request->type;
$items = Project::orderBy('updated_at', 'created_at');
if (empty($type) || $type == 'invalid') {
return view('showroom', ['items' => $items->paginate(4), 'profiles' => User::all()]);
} else {
return view('showroom', ['items' => $items->where('type', $request->type)->paginate(4), 'profiles' => User::all()]);
}
}
示例5: adminProjects
public function adminProjects(Request $request, $category = null)
{
$this->layout = 'project.table';
$this->metas['title'] = "Бүх Төслүүд";
// General list
$projects = Project::orderBy('id', 'DESC')->paginate(10);
$this->view = $this->BuildLayout();
$this->view->withUser($this->user)->withProjects($projects);
return $this->view;
}
示例6: index
/**
* Display a listing of the resource.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$orderBy = $request->has('orderBy') ? $request->input('orderBy') : 'nama_project';
$order = $request->has('order') ? $request->input('order') : 'asc';
if ($request->has('query')) {
$data_project = Project::orderBy($orderBy, $order)->where($request->input('searchBy'), 'like', '%' . $request->input('query') . '%')->paginate(15);
} else {
$data_project = Project::orderBy($orderBy, $order)->paginate(15);
}
return view('project.index', compact('data_project', 'request'));
}
示例7: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$expensesss = Expense::where('project_id', '=', 0)->first();
$expensess = Expense::where('project_id', '=', 0)->orderBy('paid_on', 'desc')->get();
$clients = Client::orderBy('created_at', 'desc')->get();
$projects = Project::orderBy('created_at', 'desc')->get();
$expenses = Expense::where('project_id', '>', 0)->orderBy('paid_on', 'desc')->get();
$payments = Payment::orderBy('created_at', 'desc')->get();
$hours = Hour::where('amount_paid', '<', 0)->orderBy('day_worked', 'desc')->get();
return view('home', compact('projects', 'expenses', 'payments', 'hours', 'clients', 'expensess', 'expensesss'));
}
示例8: index
public function index()
{
$data['projects'] = Project::orderBy('created_at', 'desc')->get();
$data['kdenlive_profiles'] = Conf::getKdenliveProfiles();
$confs = array();
$dbconfs = Conf::get();
foreach ($dbconfs as $c) {
$confs[$c->name] = $c->value;
}
$data['confs'] = $confs;
return view('homepage', $data);
}
示例9: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
view()->composer('master', function ($view) {
$view->with('projects2', Project::orderBy('completion_date', 'DESC')->take(5)->get());
});
view()->composer('pages.frontpage', function ($view) {
$view->with('projects2', Project::orderBy('completion_date', 'DESC')->take(5)->get());
});
view()->composer('errors.404', function ($view) {
$view->with('projects2', Project::orderBy('completion_date', 'DESC')->take(5)->get());
});
}
示例10: index
/**
* Display a listing of project
*
* @return Response
*/
public function index()
{
if (\Request::ajax()) {
$projectsnew = array();
$projects = Project::orderBy('id', 'DESC')->get();
foreach ($projects as &$value) {
$value->users;
}
return json_encode($projects);
}
return view('projects.team');
}
示例11: index
public function index()
{
//Slideshow
$slideshow = [['title' => 'Туршилтын нээлт явагдаж байна', 'desc' => 'Төслийн туршилын хугацаа эхлэж байна.', 'slide' => asset('images/homeslides/staging.jpg'), 'cta' => 'Алдааны мэдээлэл илгээх', 'url' => 'https://docs.google.com/forms/d/e/1FAIpQLSd_DYqUn2EPkDblQpqr93mcJT5bvD40wgmaPKyHRXmvq1GrxQ/viewform?c=0&w=1'], ['title' => 'BOOTUP.mn гэж юу вэ?', 'desc' => 'BootUP.mn бол мэдээллийн технологийн шинэлэг санаатай залууст эхний ээлжийн хөрөнгө оруулалтыг сайтаараа дамжуулан олон нийтээс босгох веб сайт юм. Бид зөвхөн эхний хөрөнгө оруулалт босгоод зогсохгүй зөвлөгөө өгч төслийг үр дүнтэй болгох талаас нь дэмжин ажиллах бөгөөд хөрөнгө оруулалтын хугацаа дуусмагц дараагийн хөрөнгө оруулагчтай холбох суваг нь болно. Танилцуулга материалыг <a href="https://dl.dropboxusercontent.com/u/46338286/bootup.pdf" target="_blank">эндээс татаарай</a>.', 'slide' => asset('images/homeslides/main.jpg'), 'cta' => 'Яг одоо өөрийнхөө төслийг оруулах', 'url' => url('project/add')]];
// Set metas for SEO
$this->metas = ['title' => 'Бүүтап төслүүд', 'keywords' => 'bootup', 'description' => 'Бүүтап төсөл, Хамтдаа хөгжицгөөе', 'author' => 'Бүүтап'];
$projects = [];
$projects['featured'] = Project::where('featured', '1')->orderBy('created_at')->get()->take(4);
$projects['updated'] = Project::orderBy('updated_at')->get()->take(4);
$projects['new'] = Project::orderBy('created_at')->get()->take(4);
$this->layout = 'main.homepage';
$this->view = $this->BuildLayout();
$this->view->withProjects($projects)->withSlideshow($slideshow);
return $this->view;
}
示例12: listProjects
/**
* Index method that returns all projects in database
*
* This function has uses an Eloquent query to return a list of ID and name
* for all projects stored in the database.
*
* @since 1.1.0
*
* @return Response A HTTP Response object formatted as JSON
*/
public function listProjects()
{
try {
$statusCode = 200;
$projects = Project::orderBy('pname', 'asc')->get();
$response = [];
foreach ($projects as $project) {
$this_row = array('id' => $project->id, 'name' => $project->pname);
$response[] = $this_row;
}
} catch (Exception $e) {
$statusCode = 400;
} finally {
return Response::json($response, $statusCode);
}
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$project = new Project();
if (Project::first()) {
$project_id = Project::orderBy('id', 'desc')->first()->id;
$project_id++;
} else {
$project_id = 1;
}
$project->project_name = $request->project_name;
$project->project_desc = $request->project_desc;
$project->project_catagory = $request->project_catagory;
$project->project_info = $request->project_info;
$project->project_slug = rtrim(preg_replace('/[^a-z0-9]+/i', '-', strtolower(strip_tags($request->project_name))), "-");
if ($request->light_img == "on") {
$project->is_light_img = true;
}
if ($request->hasFile('cover_img')) {
$cover_img = $request->file('cover_img');
$file_ext = $cover_img->guessExtension();
$fileName = $project_id . "-cover." . $file_ext;
$cover_img->move('upload', $fileName);
}
if ($request->hasFile('all_img')) {
$files = $request->file('all_img');
$file_count = 0;
foreach ($files as $ind_file) {
$file_count++;
$file_ext = $ind_file->guessExtension();
$fileName = $project_id . "-" . $file_count . "." . $file_ext;
$ind_file->move('upload', $fileName);
}
}
$project->photo_count = $file_count;
$project->save();
return redirect('/portfolio/' . $project->project_slug);
}
示例14: getProjectList
public function getProjectList()
{
$items = Project::orderBy('created_at', 'asc')->get();
return view('projects.main', ['items' => $items]);
}
示例15: actividadBeneficiario
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function actividadBeneficiario()
{
$proyectos = Project::orderBy('name', 'asc')->lists('name', 'id');
return view("admin.informes.actividad", compact('proyectos'));
}