本文整理汇总了PHP中app\Task::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::orderBy方法的具体用法?PHP Task::orderBy怎么用?PHP Task::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Task
的用法示例。
在下文中一共展示了Task::orderBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: home
public function home()
{
$page_title = "لوحة التحكم";
$section_title = "لوحة التحكم";
Date::setLocale('ar');
$date = Date::now()->format('j F Y');
$day = Date::now()->format('l');
$month = Date::now()->format('F');
$year = Date::now()->format('Y');
//**************Tasks***************
$tasksToday = Task::orderBy('task_date', 'desc')->today()->take(5);
$tasksWeek = Task::orderBy('task_date', 'desc')->thisweek()->take(5);
$tasksMonth = Task::orderBy('task_date', 'desc')->thisMonth()->take(5);
$tasks_count = count($tasksToday->toArray());
//**************Fails***************
$failsToday = Failure::orderBy('fail_time', 'desc')->today()->take(5);
$failsWeek = Failure::orderBy('fail_time', 'desc')->thisweek()->take(5);
$failsMonth = Failure::orderBy('fail_time', 'desc')->thisMonth()->take(5);
$fails_count = count($failsToday->toArray());
//**************Repairs***************
$repairsToday = Repair::today();
$repairsWeek = Repair::thisweek();
$repairsMonth = Repair::thisMonth();
$repairs_count = count($repairsToday->toArray());
return view('dashboard.dashboard', compact('page_title', 'section_title', 'date', 'day', 'month', 'year', 'tasksToday', 'tasksMonth', 'tasksWeek', 'tasks_count', 'failsToday', 'failsMonth', 'failsWeek', 'fails_count', 'repairsToday', 'repairsMonth', 'repairsWeek', 'repairs_count'));
}
示例2: index
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$tasks = Task::orderBy('created_at', 'asc')->get();
//echo "hallo in todoconstructor";
//print_r($tasks);
return view('tasks', ['tasks' => $tasks]);
}
示例3: index
/**
* Show the application dashboard.
*
* @return Response
*/
public function index()
{
$status = statu::orderBy('status', 'asc')->get();
$owners = owner::orderBy('owner_name', 'asc')->get();
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('home', compact('tasks'), compact('owners'));
}
示例4: getTasks
public function getTasks()
{
if (Auth::check()) {
return view('tasks', ['tasks' => Task::orderBy('created_at', 'asc')->get()]);
} else {
return redirect('/login');
}
}
示例5: index
public function index()
{
/*$data = DB::table('tasks')->orderBy('priority', 'DESC')->get();*/
$priority = DB::table('issues')->join('companies', 'companies.id', '=', 'issues.company_id')->select(DB::raw('sum(companies.score * issues.level) AS total_priority'))->where('order_lines.product_id', $product->id)->where('orders.order_status_id', 4)->first();
Task::create(['issue_id' => '9', 'person_id' => '9', 'priority' => '9']);
$data = Task::orderBy('priority', 'DESC')->get();
return view('welcome', compact('data'));
}
示例6: getGroupedDateAndLineId
public static function getGroupedDateAndLineId()
{
$tasks = Task::orderBy('date')->get(['date', 'line_id', 'type', 'content']);
$tasksGrouped = [];
foreach ($tasks as $task) {
$tasksGrouped[$task->date][$task->line_id][$task->type] = $task->content;
}
return $tasksGrouped;
}
示例7: show
public function show()
{
$users = DB::table('user')->count();
$tasks = DB::table('task')->count();
$count = DB::table('UserTask')->join('task', 'UserTask.id_task', '=', 'task.id')->where('UserTask.status', 'done')->select(DB::raw('sum(point) as point'))->get();
if (count($count) > 0) {
$sum = $count[0]->point;
} else {
$sum = 0;
}
$querydone = DB::table('UserTask')->select(DB::raw('count(id_task) as done'))->where('status', 'done')->get();
if (count($querydone) > 0) {
$countDone = (int) $querydone[0]->done;
} else {
$countDone = 0;
}
$users_list = \App\Users::orderBy('created_at', 'desc')->take(5)->get();
$rowsUsers = "";
foreach ($users_list as $user) {
$rowsUsers .= '<tr class="gradeC userRow" id="' . $user->id . '">
<td class="userEmail">
' . $user->email . '
</td>
<td class="userLastName">
' . $user->last_name . '
</td>
<td class="center userFirstName">
' . $user->first_name . '
</td>
<td class="center userCity">
' . $user->city . '
</td>';
}
$tasks_list = \App\Task::orderBy('created_at', 'desc')->take(5)->get();
$rowsTask = "";
foreach ($tasks_list as $task) {
$rowsTask .= '<tr class="gradeC taskRow" id="' . $task->id . '">
<td class="taskName">
' . $task->name . '
</td>
<td class="center userFirstName">
' . $task->point . '
</td>
<td class="center userStreet">
' . $task->timer . '
</td></tr>';
}
return View::make($this->_view, ['taskCount' => $tasks, 'userCount' => $users, 'usersScoreCount' => $count[0]->point, 'usersDoneCount' => $countDone, 'rowsUsers' => $rowsUsers, 'rowsTask' => $rowsTask, 'classMain' => 'active', 'classUsers' => '', 'classTasks' => '']);
}
示例8: index
public function index()
{
if ($this->user->auth()->active == 1) {
if ($this->user->auth()->hasRole('Admin')) {
$userCount = $this->user->getUserCount();
$query = Input::get('q');
$tasks = Task::orderBy('completed', 'asc')->simplePaginate(10);
$users = $query ? User::where('name', 'LIKE', "%{$query}%")->orderBy('active')->get() : User::orderBy('active')->simplePaginate(10);
return view('sezgicraft.admin.home', compact('userCount', 'users', 'tasks'));
} else {
session()->flash('flash_message_important', 'You are not permitted to do that!');
return redirect('/sezgicraft');
}
}
}
示例9: read
function read()
{
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', ['tasks' => $tasks]);
}
示例10: index
public function index()
{
// echo "Hello from index controller";
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', ['tasks' => $tasks]);
}
示例11: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$tasks = Task::orderBy('created_at', 'DESC')->paginate(10);
return view('tasks.index')->with('tasks', $tasks);
}
示例12: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$task = Task::orderBy('updated_at', 'desc')->paginate(50);
return view('admin.task.index', compact('task'));
}
示例13: function
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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 Illuminate\Http\Request;
use App\Task;
use Illuminate\Support\Facades\Validator;
Route::get('/', function () {
$tasks = Task::orderBy('created_at', 'asc')->get();
return view('tasks', ['tasks' => $tasks]);
});
Route::get('/tasks', function () {
$tasks = Task::orderBy('name', 'asc')->get();
return view('alltasks', ['tasks' => $tasks]);
});
/*
* Add a new Task
**/
Route::post('/task', function (Request $request) {
$validator = Validator::make($request->all(), ['name' => 'required|max:255']);
if ($validator->fails()) {
return redirect('/')->withInput()->withErrors($validator);
}
$task = new Task();
$task->name = $request->name;
$task->save();
return redirect('/');
});
示例14: all
/**
* Return all tasks
*
* @return \App\Task
*/
public function all()
{
return $this->task->orderBy('priority', 'asc')->get();
}
示例15: function
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
use App\Task;
use Illuminate\Http\Request;
Route::group(['middleware' => ['web']], function () {
/*SHOW TASK DASHBOARD*/
Route::get("/", function () {
$tasks = Task::orderBy("created_at", "asc")->get();
return view("tasks", ["tasks" => $tasks]);
});
/*ADD NEW TASK*/
Route::post("/task", function (Request $request) {
$validator = Validator::make($request->all(), ['name' => 'required|max:255']);
if ($validator->fails()) {
return redirect('/')->withInput()->withErrors($validator);
}
$task = new Task();
$task->name = $request->name;
$task->save();
return redirect('/');
});
/*DELETE TASK*/
Route::delete("/task/{task}", function (Task $task) {