本文整理汇总了PHP中Task::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::orderBy方法的具体用法?PHP Task::orderBy怎么用?PHP Task::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::orderBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
public function fire()
{
$options = $this->option();
$users = User::all();
$this->repository = new AwardsRepository();
$this->repository->setListener($this);
$this->comment("// -------------------------------------");
$this->comment(" Individual Awards ");
$this->comment("// -------------------------------------");
// user based awards
foreach ($users as $user) {
$this->info("Checking awards for: " . $user->getName());
$this->info($this->repository->checkAwardForUser($user));
}
$this->comment("// -------------------------------------");
$this->comment(" Site Wide Awards ");
$this->comment("// -------------------------------------");
// site wide awards - time based
if (is_true($options['full'])) {
$start = Task::orderBy('created_at')->first()->created_at;
$end = Carbon::now();
$date = clone $start;
for ($i = $start->weekOfYear; $i <= $end->weekOfYear; $i++) {
$this->info("Checking for week of " . $date->toDateString());
$this->info($this->repository->checkForAwards($date));
$date->addWeek();
}
} else {
$this->info($this->repository->checkForAwards());
}
}
示例2: showTasks
function showTasks()
{
if (Auth::check()) {
return View::make('tasks', ['tasks' => Task::orderBy('created_at', 'asc')->get()]);
} else {
// validation not successful, send back to form
return Redirect::to('login');
}
}
示例3: order
public function order()
{
$orders = Task::orderBy('created_at', 'desc')->get();
$unpaid_orders_num = count(Task::where('state', 4)->get());
return View::make('admin.taskOrder')->with('orders', $orders)->with('unpaid_orders_num', $unpaid_orders_num);
}
示例4: getGroupPostByID
public function getGroupPostByID()
{
$input = Input::all();
$groupid = $input['groupid'];
$postid = $input['postid'];
$authuser = Auth::user();
if (Input::has('limitfrom')) {
$skip = Input::get('limitfrom');
} else {
$skip = 0;
}
$group = Group::find($groupid);
if (is_null($group)) {
return Response::json(array('success' => false, 'errors' => 'Group not found'), 400);
// 400 being the HTTP code for an invalid request.
}
//Now fetch all the posts belong to that group
$posts = Post::orderBy('id', 'DESC')->where('id', $postid)->take(1)->skip($skip)->get();
foreach ($posts as $post) {
$task = Task::orderBy('id', 'DESC')->where('id', $post->task_id)->take(1)->get();
$post->task_title = $task[0]->name;
$post->task_content = $task[0]->description;
$post->display_mission = $post->display_mission;
$post->status = $post->status;
$post->status_text = $post->filterStatus();
$post->image = ($post->statustype = 'image') ? $post->displayMediaApi() : '';
$post->screenhandle = User::find($post->user_id)->screenhandle;
$post->firstname = User::find($post->user_id)->firstname;
$post->lastname = User::find($post->user_id)->lastname;
$post->comments = $post->getAPIComments();
$user = User::find($post->user_id);
$post->userImage = $user->APIGetPictureSrc();
$post->likeCount = count(Like::orderBy('id', 'DESC')->where('post_id', $post->id)->get());
if ($authuser->hasLike($post->id)) {
$post->like = true;
} else {
$post->like = false;
}
}
return $posts->toJson();
}
示例5: index
public function index()
{
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', ['tasks' => $tasks]);
}
示例6: edittask_forothers
public function edittask_forothers($id)
{
$pagetitle = 'Edit Task for Others';
$get_task = Task::orderBy('task', 'asc')->lists('task', 'id');
$get_taskforothers = DB::table('mytask_forothers')->where('id', $id)->first();
$getattached = DB::table('attached_forothers')->where('forothers_id', $id)->get();
$my_task = Task::where('id', $get_taskforothers->task_id)->first();
return View::make('task.edit_taskforothers', compact('pagetitle', 'get_task', 'get_taskforothers', 'my_task', 'getattached'));
}
示例7: function
| 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.
|
*/
//Route::get('/', function () {
// return view('welcome');
//});
/**
* * 全タスク表示
* */
Route::get('/', function () {
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', ['tasks' => $tasks]);
});
/**
* 新タスク追加
*/
Route::post('/task', function (Request $request) {
//
});
/**
* 既存タスク削除
*/
Route::delete('/task/{id}', function ($id) {
//
});
Route::post('/task', function (Request $request) {