本文整理汇总了PHP中file::where方法的典型用法代码示例。如果您正苦于以下问题:PHP file::where方法的具体用法?PHP file::where怎么用?PHP file::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::where方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::where('id', '!=', Auth::id())->where('priviledge', '!=', 'superuser')->get();
if (Auth::user()->priviledge != 'superuser') {
$weights = Vote::where('user_id', '=', Auth::id())->sum('performance');
$sum = $weights;
}
//echo "<pre>";
//var_dump($users);die;
foreach ($users as $key => $value) {
$path[$key] = file::where('user_id', '=', $value['id'])->pluck('path');
//echo "<pre>";
//var_dump($path);die;
}
return View::make('votes.home', compact(Auth::user()->user_name, 'users', 'sum', 'path'));
}
示例2: picture_update
public function picture_update()
{
$validator = Validator::make(Input::all(), file::$rules);
if ($validator->fails()) {
Session::flash('error', 'uploaded file is not valid');
return Redirect::back()->withInput()->withErrors($validator->messages());
}
$data = file::where('user_id', '=', Auth::user()->id)->pluck('path');
$file = Input::file('image');
$extension = $file->getClientOriginalExtension();
$filename = Auth::user()->id . '.' . $extension;
$file->move('uploads', $filename);
$path = '../uploads/' . $filename;
$picture = new file();
$picture->user_id = Auth::user()->id;
$picture->path = $path;
if ($data == null) {
$picture->save();
} else {
$picture->update();
}
return Redirect::back();
}