本文整理汇总了PHP中Activity::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::where方法的具体用法?PHP Activity::where怎么用?PHP Activity::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$points = Point::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('pointable_type', '=', 'Activity')->groupBy('pointable_type')->groupBy('pointable_id')->get();
$activities = Activity::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'academic';
return View::make('points.index', compact('points', 'activities', 'menu'));
}
示例2: it_associates_special_user_key_if_isset
/** @test */
function it_associates_special_user_key_if_isset()
{
$this->assertCount(0, chronicle()->getAllRecords());
$quote = $this->getQuote(42);
$this->assertCount(1, chronicle()->getAllRecords());
$this->assertEquals(Activity::where('subject_id', $quote->id)->first()->user_id, 42);
}
示例3: testIndex
public function testIndex()
{
$Activity1 = new \App\activity();
$Activity1->description = 'Test';
$Activity1->date = '2015-10-05';
$Activity1->time = '00:00:00';
$Activity1->plant_id = \App\Plant::where("name", "=", "TestActivityPlant")->first()->id;
$Activity1->weather = 'few cloud';
$Activity2 = new \App\activity();
$Activity2->description = 'Test2';
$Activity2->date = '2015-10-05';
$Activity2->time = '00:00:00';
$Activity2->plant_id = \App\Plant::where("name", "=", "TestActivityPlant")->first()->id;
$Activity2->weather = 'rain';
if (Activity::where("plant_id", "=", \App\Plant::where("name", "=", "TestActivityPlant")->first()->id)->count() <= 2) {
$Activity1->save();
$Activity2->save();
}
$Activity1->toArray();
$ActivityController = new \App\Http\Controllers\activityController();
$farmID = array('farmID' => \App\Farm::where("name", "=", "TestActivityFarm")->first()->id);
$request = new \Illuminate\Http\Request();
$request->replace($farmID);
$test = $ActivityController->index($request);
print_r($test[0] == $Activity2);
$this->assertEquals($test[0], $Activity2->toArray());
$this->assertEquals($test[1], $Activity1->toArray());
$request->replace(null);
$test2 = $ActivityController->index($request);
$this->assertEquals(null, $test2);
}
示例4: index
public function index()
{
// total_income, billed_clients, invoice_sent and active_clients
$select = DB::raw('COUNT(DISTINCT CASE WHEN invoices.id IS NOT NULL THEN clients.id ELSE null END) billed_clients,
SUM(CASE WHEN invoices.invoice_status_id >= ' . INVOICE_STATUS_SENT . ' THEN 1 ELSE 0 END) invoices_sent,
COUNT(DISTINCT clients.id) active_clients,
AVG(invoices.amount) as invoice_avg');
$metrics = DB::table('accounts')->select($select)->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')->leftJoin('invoices', 'clients.id', '=', 'invoices.client_id')->where('accounts.id', '=', Auth::user()->account_id)->where('clients.is_deleted', '=', false)->groupBy('accounts.id')->first();
$select = DB::raw('SUM(clients.paid_to_date) as value');
$totalIncome = DB::table('accounts')->select($select)->leftJoin('clients', 'accounts.id', '=', 'clients.account_id')->where('accounts.id', '=', Auth::user()->account_id)->where('clients.is_deleted', '=', false)->groupBy('accounts.id')->first();
$activities = Activity::where('activities.account_id', '=', Auth::user()->account_id)->orderBy('created_at', 'desc')->take(6)->get();
$pastDue = Invoice::scope()->where('due_date', '<', date('Y-m-d'))->where('balance', '>', 0)->where('is_recurring', '=', false)->where('is_quote', '=', false)->where('is_deleted', '=', false)->orderBy('due_date', 'asc')->take(6)->get();
$upcoming = Invoice::scope()->where('due_date', '>=', date('Y-m-d'))->where('balance', '>', 0)->where('is_recurring', '=', false)->where('is_quote', '=', false)->where('is_deleted', '=', false)->orderBy('due_date', 'asc')->take(6)->get();
$data = ['totalIncome' => Utils::formatMoney($totalIncome ? $totalIncome->value : 0, Session::get(SESSION_CURRENCY)), 'billedClients' => $metrics ? $metrics->billed_clients : 0, 'invoicesSent' => $metrics ? $metrics->invoices_sent : 0, 'activeClients' => $metrics ? $metrics->active_clients : 0, 'invoiceAvg' => Utils::formatMoney($metrics ? $metrics->invoice_avg : 0, Session::get(SESSION_CURRENCY)), 'activities' => $activities, 'pastDue' => $pastDue, 'upcoming' => $upcoming];
return View::make('dashboard', $data);
}
示例5: postParticipate
/**
* 参加活动
*/
public function postParticipate()
{
$shopID = base64_decode(Input::get('shop_id'));
$headerShop = AuthController::checkShop($shopID);
$retCode = SUCCESS;
$retMsg = "";
$activityID = Input::get('activity_id');
$activity = Activity::where('wy_activity_id', $activityID)->first();
//活动对应表中需要增加时间控制
$shopActivitity = ShopActivity::where('wy_shop_id', $shopID)->where('wy_activity_id', $activityID)->first();
if (empty($shopActivitity)) {
$shopActivitity = new ShopActivity();
$shopActivitity->wy_shop_id = $shopID;
$shopActivitity->wy_activity_id = $activityID;
$shopActivitity->wy_enable = ACTIVITY_ENABLE_1;
if (!empty($activity)) {
$shopActivitity->wy_money = $activity->wy_activity_cutmoney;
}
$result = $shopActivitity->save();
if ($result) {
$retMsg = Lang::get('messages.10018');
} else {
$retCode = -15004;
$retMsg = Lang::get('errormessages.-15004');
$context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "activityID" => $activityID);
Log::error($retMsg, $context);
}
} else {
if (!empty($activity)) {
$result = ShopActivity::where('wy_shop_id', $shopID)->where('wy_activity_id', $activityID)->update(array('wy_enable' => ACTIVITY_ENABLE_1, 'wy_money' => $activity->wy_activity_cutmoney));
} else {
$result = ShopActivity::where('wy_shop_id', $shopID)->where('wy_activity_id', $activityID)->update(array('wy_enable' => ACTIVITY_ENABLE_1));
}
if ($result) {
$retMsg = Lang::get('messages.10018');
} else {
$retCode = -15005;
$retMsg = Lang::get('errormessages.-15005');
$context = array("errorCode" => $retCode, "userID" => Auth::id(), "shopID" => $shopID, "activityID" => $activityID);
Log::error($retMsg, $context);
}
}
$sendMsgArray = array("ret_code" => $retCode, "msg" => $retMsg);
return Response::json($sendMsgArray);
}
示例6: getActivity
public function getActivity($activity_id)
{
return \Activity::where('_id', $activity_id)->first();
}
示例7: foreach
<?php
include 'config.php';
$activity = Activity::where('date_end', '=', '0000-00-00 00:00:00')->get();
$message = [];
if (isset($_GET['delete'])) {
$del_activities = Activity::where('date_end', '!=', '0000-00-00 00:00:00')->get();
foreach ($del_activities as $del_activity) {
$del_activity->delete();
}
$message['type'] = "success";
$message['message'] = "Old activities deleted";
}
echo $template->view()->make('activities')->with('activities', $activity)->with('message', $message)->render();
示例8: foreach
<?php
include 'config.php';
$message = [];
if (isset($_GET['delete_all'])) {
$del_activities = Activity::all();
foreach ($del_activities as $del_activity) {
$del_activity->delete();
}
$message['type'] = "success";
$message['message'] = "Old activities deleted";
}
if (isset($_GET['delete'])) {
$de_activity = Activity::find($_GET['delete']);
$de_activity->delete();
$mssage['type'] = "success";
$message['message'] = "Activity deleted";
}
$activity = Activity::where('date_end', '=', '0000-00-00 00:00:00')->get();
echo $template->view()->make('activities')->with('activities', $activity)->with('message', $message)->render();
示例9: activityDelete
public function activityDelete()
{
$activity = Input::get('activity');
$deleteRow = Activity::where('activity_id', '=', $activity);
$deleted = $deleteRow->delete();
if ($deleted) {
return Redirect::route('dashboard');
}
}