当前位置: 首页>>代码示例>>PHP>>正文


PHP Issue::all方法代码示例

本文整理汇总了PHP中Issue::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::all方法的具体用法?PHP Issue::all怎么用?PHP Issue::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Issue的用法示例。


在下文中一共展示了Issue::all方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: normalizeIssue

 public function normalizeIssue()
 {
     $issues = Issue::all();
     foreach ($issues as $issue) {
         // Normalize Educations
         $educations = Education::where('student_id', '=', $issue->student_id)->get();
         foreach ($educations as $education) {
             $education->student_id = $issue->id;
             $education->save();
         }
         // Normalize Placements
         $placements = Placement::where('student_id', '=', $issue->student_id)->get();
         foreach ($placements as $placement) {
             $placement->student_id = $issue->id;
             $placement->save();
         }
         // Normalize Receivables
         $receivables = Receivable::where('student_id', '=', $issue->student_id)->get();
         foreach ($receivables as $receivable) {
             $receivable->student_id = $issue->id;
             $receivable->save();
         }
     }
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:24,代码来源:SetupsController.php

示例2: index

 /**
  * GET /issues
  * Display a list of cultivated issues.
  *
  * @return Response
  */
 public function index()
 {
     $issues = $this->issue->all();
     return View::make('issues.index', compact('issues'))->withTitle('All issues');
 }
开发者ID:riehlemt,项目名称:neontsunami,代码行数:11,代码来源:IssuesController.php

示例3: postCreate

 public function postCreate()
 {
     $validator = Validator::make(Input::all(), array('email' => 'required|max:50|email|unique:users', 'username' => 'required|max:20|min:3|unique:users', 'password' => 'required|min:6', 'password_again' => 'required|same:password'));
     if ($validator->fails()) {
         return Redirect::route('create') > withErrors($validator)->withInput();
     } else {
         //create user account
         $user = User::create(array('email' => Input::get('email'), 'username' => Input::get('username'), 'password' => Hash::make(Input::get('password')), 'code' => str_random(60), 'active' => 1));
         //normally active = 0 but until we can get email validation working it will stay 1);
         $user->save();
         $user->sex = Input::get('sex');
         $user->birth_month = Input::get('birth_month');
         $user->birth_day = Input::get('birth_day');
         $user->birth_year = Input::get('birth_year');
         $user->party = Input::get('party');
         $user->bio = Input::get('bio');
         //Upload Image
         $file = Input::file('photo');
         if (isset($file)) {
             if ($file->isValid()) {
                 $destinationPath = public_path() . '/assets/images/avatars/';
                 // The destination were you store the image.
                 $filename = $file->getClientOriginalName();
                 $file->move($destinationPath, $filename);
                 $user->pic_url = '/assets/images/avatars/' . $filename;
             }
         }
         $user->save();
         /* $filename           = $file->getClientOriginalName(); // Original file name that the end user used for it.
          			 $mime_type          = $file->getMimeType(); // Gets this example image/png
         			 $extension          = $file->getClientOriginalExtension(); // The original extension that the user used example .jpg or .png.
          			try{ $upload_success     = $file->move($destinationPath, $filename); // Now we move the file to its new home.
         			} catch (Exception $e) {return 'Caught exception image upload: '.$e->getMessage();}
                                */
         // This is were you would store the image path in a table
         $issues = Issue::all();
         foreach ($issues as $issue) {
             $issue_checkbox = Input::get($issue->id);
             if (isset($issue_checkbox)) {
                 $issues_follows = IssueFollow::create(array('issue_id' => $issue_checkbox, 'user_id' => $user->id));
                 $issues_follows->save();
             }
         }
         //Redirect to login page - added to redirect to home upon successful account
         $auth = Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password'), 'active' => 1));
         return Redirect::route('myprofile');
     }
     // else
     /*
     	if ($user){
             
     	//send email here
     		Mail::send(/*'emails.activate',*/
     /*'activate',
     		array('link' =>URL::route('activate',$code), 'username'=>$username),function($message) use ($user){
     	       return $message->to($user->email,$user->username)->subject('Activate your account');
     		});
     			
     				return Redirect::route('home')
     				->with('global','Your account has been created! We have sent you an email to activate your account');
     			
     		  
                }*/
     //if ($user)
 }
开发者ID:netintelpro,项目名称:laravel-app,代码行数:65,代码来源:AccountController.php

示例4: getEdit

 public function getEdit()
 {
     $issues_followed = Auth::user()->issues;
     $issues_followed_array[] = array();
     $i = 0;
     foreach ($issues_followed as $issue) {
         $issues_followed_array[$i++] = $issue->id;
     }
     return View::make('edit')->with('comments', Auth::user()->comments)->with('issues', Issue::all())->with('issues_followed', $issues_followed_array)->with('politicians', Auth::user()->politicians);
 }
开发者ID:netintelpro,项目名称:laravel-app,代码行数:10,代码来源:ProfileController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $issues = Issue::all();
     return View::make('issue.index')->with('issues', $issues);
 }
开发者ID:BaobabHealthTrust,项目名称:iBLIS,代码行数:11,代码来源:IssueController.php

示例6: profilePolitician

 public function profilePolitician($fullname)
 {
     //gets politician record by fullname
     $politician = Politician::where('full_name', '=', $fullname);
     if ($politician->count()) {
         //shows only issues logged in user follows
         if (Auth::check()) {
             $issues = User::find(Auth::user()->id)->issues;
         } else {
             $issues = null;
         }
         //gets specific politician entity/record
         $politician = $politician->first();
         //make list of all ids
         $democrat_ratings = array();
         $republican_ratings = array();
         //Hate to throw tacky direct php mysql queries instead of ORM. But having trouble with
         //ORM query logic for inner joins of derived tables. Need beta now and will ORM later.
         $con = mysqli_connect("127.0.0.1", "root", "pepper", "iratepolitics");
         //Democrat Ratings: Get value and timestamp of all democrat users' ratings for this politician
         $query = "select value,r.created_at from (select * from ratings where politician_id='" . $politician->id . "') as r inner join (select * from users where party='Democrat') as u on r.user_id = u.id";
         $result = mysqli_query($con, $query);
         $i = 0;
         while ($row = mysqli_fetch_array($result)) {
             $democrat_ratings[$i++] = array('value' => $row['value'], 'created_at' => $row['created_at']);
         }
         //close while
         //Republican Ratings: Get value and timestamp of all republican users' ratings for this politician
         $query = "select value,r.created_at from (select * from ratings where politician_id='" . $politician->id . "') as r inner join (select * from users where party='Republican') as u on r.user_id = u.id";
         $result = mysqli_query($con, $query);
         $i = 0;
         while ($row = mysqli_fetch_array($result)) {
             $republican_ratings[$i++] = array('value' => $row['value'], 'created_at' => $row['created_at']);
         }
         //close while
         mysqli_close($con);
         //we have raw data. now we need to turn data into format for highchart with appropriate time interval resolution
         //For now we are going to use 7 day intervals. So we are going back 7 days from today.
         //0 on x-axis is 7 days ago.
         //creating array where each index represents a day (whatever time unit in future)
         //For now, 0 is 7 days ago. So we loop through each day and sum up all raw data values that took place during
         //that time unit
         $todays_date = new DateTime("now");
         $democrat_chart_data = array("0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0);
         foreach ($democrat_ratings as $rating) {
             $rate = array();
             $rating_date = new DateTime($rating['created_at']);
             //echo ' Rating Date: '.$rating_date->format("Y-m-d H:i:s");
             $date_interval = $todays_date->diff($rating_date);
             //echo ' $date_interval: '.$date_interval->format("%a")."days\n";
             $date_interval = intval($date_interval->format("%a"));
             if ($date_interval <= 6) {
                 $democrat_chart_data[6 - $date_interval] += $rating['value'];
             }
         }
         $republican_chart_data = array("0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0);
         foreach ($republican_ratings as $rating) {
             $rate = array();
             $rating_date = new DateTime($rating['created_at']);
             //echo ' Rating Date: '.$rating_date->format("Y-m-d H:i:s");
             $date_interval = $todays_date->diff($rating_date);
             //echo ' $date_interval: '.$date_interval->format("%a")."days\n";
             $date_interval = intval($date_interval->format("%a"));
             if ($date_interval <= 6) {
                 $republican_chart_data[6 - $date_interval] += $rating['value'];
             }
         }
         //Issue Tag Cloud
         $con = mysqli_connect("127.0.0.1", "root", "pepper", "iratepolitics");
         //create list of issues for which politician has received votes by selecting
         //rows on first occurance of each unique value
         $query = "select id,issue_id from ratings where politician_id=" . $politician->id . " group by issue_id;";
         $result = mysqli_query($con, $query);
         $issue_tag_cloud = "";
         $i = 0;
         //for each id in list of issues, count all the rows in ratings where a vote was made for that politician & that issue
         //this is a count of 'activity' for each issue per politican. (ex. votes on Pelosi's stance on Obamacare)
         while ($row = mysqli_fetch_array($result)) {
             $query = "select id from ratings where issue_id=" . $row['issue_id'] . " and politician_id=" . $politician->id;
             //echo 'query: '.$query;
             $result2 = mysqli_query($con, $query);
             $issue_name = Issue::find($row['issue_id'])->issue_name;
             $issue_tag_cloud .= '{text: "' . ucwords($issue_name) . '", weight: ' . mysqli_num_rows($result2) . ' , link: "' . URL::route('news', $issue_name) . '"},' . "\n";
         }
         //close while
         //remove trailing new line and trailing comma so tag cloud js will work
         $issue_tag_cloud = substr_replace($issue_tag_cloud, "", -1);
         $issue_tag_cloud = substr_replace($issue_tag_cloud, "", -1);
         //Display Comments...only comments with no parents
         $comments = $politician->comments()->where('parent_id', '=', '0')->orderBy('rank', 'desc')->orderBy('created_at', 'desc')->get();
         //$comments = Comment::where('politician_id','=',$politician->id)->where('parent_id', '=', '0')->get();
         if (Auth::check()) {
             $issues_not_followed = $this->issuesNotFollowed(Auth::user()->id);
         } else {
             $issues_not_followed = Issue::all();
         }
         $fb_og = array('url' => Request::url(), 'title' => $politician->full_name, 'image' => $_SERVER['SERVER_NAME'] . $politician->pic_url, 'description' => $politician->bio);
         return View::make('politician')->with('politician', $politician)->with('issues', $issues)->with('comments', $comments)->with('democrat_chart_data', $democrat_chart_data)->with('republican_chart_data', $republican_chart_data)->with('issue_tag_cloud', $issue_tag_cloud)->with('issues_not_followed', $issues_not_followed)->with('fb_og', $fb_og)->with('title', $politician->full_name . "'s Profile");
     } else {
         return App::abort(404);
//.........这里部分代码省略.........
开发者ID:netintelpro,项目名称:laravel-app,代码行数:101,代码来源:PoliticianController.php

示例7: must_allow

<?php

require_once __DIR__ . "/includes/root.php";
must_allow("list issues");
$renderer->variable("title", "Manage Issues");
$renderer->variable("pending_issues", Issue::all(Issue::LOCTYPE_PENDING, 5));
$renderer->variable("issues_awaiting_review", Issue::all(Issue::LOCTYPE_AWAITING_REVIEW, 5));
$renderer->add_function("can_review", function ($issue) {
    return count($issue->errors()) == 0;
});
$renderer->render("issues-list");
开发者ID:uoregon-libraries,项目名称:pdf-to-chronam-admin,代码行数:11,代码来源:issues-list.php


注:本文中的Issue::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。