本文整理汇总了PHP中Entry::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Entry::where方法的具体用法?PHP Entry::where怎么用?PHP Entry::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entry
的用法示例。
在下文中一共展示了Entry::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
public function show($groupName)
{
$group = Group::name($groupName)->with('creator')->firstOrFail();
$group->checkAccess();
$stats = ['contents' => intval(Content::where('group_id', $group->getKey())->count()), 'comments' => intval(Content::where('group_id', $group->getKey())->sum('comments')), 'entries' => intval(Entry::where('group_id', $group->getKey())->count()), 'banned' => intval(GroupBanned::where('group_id', $group->getKey())->count()), 'subscribers' => $group->subscribers, 'moderators' => intval(GroupModerator::where('group_id', $group->getKey())->count())];
return array_merge($group->toArray(), ['stats' => $stats]);
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$x = 1;
foreach (Group::all() as $group) {
$contents = Content::where('group_id', $group->getKey())->count();
$entries = Entry::where('group_id', $group->getKey())->count();
$total = $contents + $entries;
// Default activity is medium = 2
$group->activity = 2;
// Low activity, when nothing was added last week
if ($total == 0) {
$group->activity = 1;
}
if ($total > 15) {
$group->activity = 3;
}
if ($total > 50) {
$group->activity = 4;
}
$group->save();
if (!($x % 100)) {
$this->info($x . ' groups processed');
}
$x++;
}
$this->info('All groups processed');
}
示例3: isValidSlug
protected function isValidSlug()
{
$slugs = Entry::where('slug', '=', $this->data['slug'])->first();
if ($slugs > 0) {
return;
} else {
$this->data['slug'] = $this->data['slug'] . $slugs;
}
}
示例4: updateEntry
/**
* Updates the admin entry.
*/
public function updateEntry()
{
$input = Input::all();
$entry = Entry::where('email', 'admin')->first();
if ($entry) {
$entry->update($input);
$entry->save();
}
return Redirect::route('admin.index')->withInfo('Admin entry saved.');
}
示例5: show
/**
* Display the specified resource.
*
* @param int $logbook_id
* @return Response
*/
public function show($logbook_id)
{
try {
$logbook = Logbook::findOrFail($logbook_id);
$entries = Entry::where('logbook_id', $logbook_id)->orderBy('finished_at', 'desc')->orderBy('started_at', 'desc')->paginate(10);
return View::make('logbooks.show', array('logbook' => $logbook, 'entries' => $entries));
} catch (ModelNotFoundException $e) {
return Redirect::to(route('logbooks.index'))->with('message', ['content' => 'Logboek niet gevonden!', 'class' => 'danger']);
}
}
示例6: showAsAuthor
public function showAsAuthor($token)
{
$entry = Entry::where('token', '=', $token)->first();
if ($entry) {
$positiveVotes = $entry->upVotes();
$negativeVotes = $entry->downVotes();
return View::make('entries.show')->with('entry', $entry)->with('votes_count', $entry->votes()->count())->with('positiveVotes', $positiveVotes)->with('negativeVotes', $negativeVotes)->with('is_author', true);
} else {
App::abort(404);
}
}
示例7: create
public static function create($entry_id, $entry_type, $privacy)
{
$entry = Entry::where('entry_id', $entry_id)->where('type', $entry_type)->get()->first();
if ($entry->count() > 0) {
$entry->entry_id = $entry_id;
$entry->type = $entry_type;
$entry->privacy = $privacy;
return $entry->save();
} else {
return false;
}
}
示例8: getViewProfileDatas
private function getViewProfileDatas($user_id)
{
$privacy = Privacy::where('name', "Công khai")->get()->first();
$datas = array();
if (FEUsersHelper::isCurrentUser($user_id)) {
$entries = Entry::where('user_id', $user_id)->orderBy('updated_at', 'DESC')->paginate($this->entries_per_page);
$left_albums = Album::where('user_id', $user_id)->orderBy('updated_at', 'DESC')->get();
} else {
$entries = Entry::where('user_id', $user_id)->where('privacy', $privacy->id)->orderBy('updated_at', 'DESC')->paginate($this->entries_per_page);
$left_albums = Album::where('user_id', $user_id)->where('privacy', 1)->orderBy('updated_at', 'DESC')->get();
}
return array("entries" => $entries, "left_albums" => $left_albums);
}
示例9: calculateScore
/**
* Calculates the score for this entry.
*/
public function calculateScore()
{
// Start with the group matches
$score = $this->calculateMatchPredictionsScore();
$admin_entry = Entry::where('email', 'admin')->first();
if ($admin_entry) {
$score = $score + $this->calculateGroupPredictionsScore($admin_entry);
$score = $score + $this->calculateFinalEightScore($admin_entry);
$score = $score + $this->calculateFinalFourScore($admin_entry);
$score = $score + $this->calculateFinalTwoScore($admin_entry);
$score = $score + $this->calculateWinnerScore($admin_entry);
}
$this->score = $score;
$this->save();
}
示例10: requeue_deadbeats
public function requeue_deadbeats()
{
dd("Don't run me yet, I'm not ready.");
foreach (Entry::where('file_sha', null)->where('is_dir', 0)->get() as $entry) {
$data = ['action' => 'create', 'entry' => $entry->toArray()];
if (!$stored_entry->is_dir) {
Queue::push('FileHandlerController@create', $data, $this->file_queue_id);
}
}
}
示例11: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$entry = Entry::where('entid', '=', $id)->with('section')->get();
//dd($entry[0]);
// does user have access?
if ($entry[0]->uid != $this->user->uid) {
return Response::json(array('status' => false, 'errors' => array('total' => 'You are not authorized to delete this entry.')), 400);
}
//dd($entry[0]);
if (Entry::delete_entry($id)) {
if ($entry[0]->type == 100) {
// SPECIAL CASE; deleting a monthly reset.
$tmp = [];
foreach ($entry[0]->section as $es) {
$tmp['balance'] = $es->amount;
DB::table('user_categories')->where('ucid', $es->ucid)->update($tmp);
}
return Response::json(array('success' => true), 200);
}
// first do reverse math on entry
// fun stuff; if its a cc entry we're reversing, gotta be funky because I am a moron and did the
// stupid ucid = 0 for everyones bank instead of just having an extra row for each user.
$is_add = 0;
if ($entry[0]->type == 50 || $entry[0]->type == 10 && $entry[0]->paid_to == 0) {
$is_add = 1;
}
$this->do_the_math($id, $entry[0]->paid_to, $entry[0]->total_amount, $entry[0]->purchase_date, $is_add, 0, 1);
// Then for each entry section
foreach ($entry[0]->section as $es) {
$this->do_the_math($id, $es->ucid, $es->amount, $entry[0]->purchase_date, 1, 0, 1, $es->paid_from, $entry[0]->type);
}
return Response::json(array('success' => true), 200);
} else {
return Response::json(array('status' => false, 'errors' => array('total' => 'There was a problem deleting this entry.')), 400);
}
}
示例12: archive
public function archive($date)
{
$entries = Entry::where('created_at', '>=', $date)->where('created_at', '<=', $date . ' 23:59:59')->where('user_id', '=', Auth::user()->id)->get();
$totalCalories = 0;
$totalFats = 0;
$totalCarbs = 0;
$totalProteins = 0;
foreach ($entries as $entry) {
$totalCalories += $entry->calories;
$totalFats += $entry->fats;
$totalCarbs += $entry->carbohydrates;
$totalProteins += $entry->proteins;
}
return View::make('entries.index')->with(compact('entries'))->with(compact('totalCalories'))->with(compact('totalFats'))->with(compact('totalCarbs'))->with(compact('totalProteins'));
}
示例13: search
public function search($value)
{
return Response::json(Entry::where('name', 'LIKE', "%{$value}%")->get());
}
示例14: confirm
/**
* Confirms an entry to make it visible on the scoreboard.
*/
public function confirm($confirmation)
{
$entry = Entry::where('confirmation', $confirmation)->first();
if ($entry) {
$entry->confirmation = null;
$entry->save();
return View::make('entry.confirm');
}
return Redirect::route('entry.index')->withMessage("Sorry, the entry could not be confirmed.");
}
示例15: results
public function results()
{
$matches = Match::all();
$admin_entry = Entry::where('email', 'admin')->first();
return View::make('results')->with('matches', $matches)->with('entry', $admin_entry);
}