本文整理汇总了PHP中Files::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::where方法的具体用法?PHP Files::where怎么用?PHP Files::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Files
的用法示例。
在下文中一共展示了Files::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: startup
protected function startup()
{
parent::startup();
$this->pagerFiles = new \Pager($this, 'pagingFiles');
$this->files = $this->context->createServiceFiles();
if (!$this->user->isInRole('administrator')) {
$this->files->where('file.user_id = ' . $this->user->id);
}
}
示例2: getfile
public static function getfile($module_name, $module_id)
{
$file_key = sha1($module_name . $module_id . 'o');
if (isset(static::$cache[$file_key])) {
return static::$cache[$file_key];
} else {
return static::$cache[$file_key] = Files::where('module_name', $module_name)->where('module_id', intval($module_id))->remember(SettingsModel::one('cachelife'))->first();
}
}
示例3: get_index
public function get_index()
{
$records = Files::where('parent_id', '=', (int) $_GET['node'])->get();
$result = '[';
foreach ($records as $record) {
$result .= '{
text: \'' . $record->text . '\',
leaf: ' . ($record->leaf ? 'true' : 'false') . ',
id: ' . $record->id . '
},';
}
$result .= ']';
return $result;
}
示例4: more
public function more()
{
$user = User::with('Course', 'Gender', 'userType')->where('StudentID', Auth::user()->StudentID)->first();
$adminGroupPages = GroupPage::where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
$groupPages = GroupPageMember::with('groupPages')->where('StudentID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
if (Auth::user()->UserTypeID == 2) {
$files = Files::where('delFlag', 0)->where('folderID', 0)->where('OwnerID', Auth::user()->StudentID)->get();
$fileFolders = FilesFolder::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
$activities = GroupPageActivity::where('OwnerID', Auth::user()->StudentID)->where('delFlag', 0)->get();
$quizzes = Quiz::where('delFlag', 0)->orderBy('created_at', 'DESC')->get();
} else {
$activities = GroupPageActivityGroup::with('groupPage', 'groupPageActivityFiles')->where('deadline', '>', date('Y-m-d H:i:s'))->whereExists(function ($q) {
$q->select(DB::raw(0))->from('grouppagemember')->whereRaw('grouppagemember.grouppageID = grouppageactivitygroup.grouppageID')->where('StudentID', Auth::user()->StudentID)->whereRaw('grouppagemember.delFlag = 0');
})->orderBy('deadline', 'ASC')->get();
$quizzes = QuizGroupPage::with('groupPageMember', 'groupPage', 'quiz')->where('delFlag', 0)->whereNotExists(function ($q) {
$q->select(DB::raw(0))->from('quiztaken', 'grouppagemember')->where('quiztaken.OwnerID', Auth::user()->StudentID)->whereRaw('quiztaken.quizID = quizgrouppage.quizID')->where('delFlag', 0);
})->get();
}
return View::make('validated.more', compact('user', 'adminGroupPages', 'groupPages', 'files', 'fileFolders', 'activities', 'quizzes'));
}
示例5: listedFiles
public function listedFiles()
{
$files = Files::where('id_inscription', '=', $this->id)->orderBy('created_at', 'asc')->get();
// dd($files);
/*$files = $this->hasMany('Files', 'id_inscription', 'id')->orderBy('created_at','ASC');*/
$archivitos = array();
// dd(substr($files[0]->title, -1));
// dd(count($files));
for ($i = 0, $counter = 1; $i < count($files);) {
$band = false;
$position = null;
for ($j = 0; $j < count($files); $j++) {
if (substr($files[$j]->title, -1) == $counter) {
// var_dump(substr($files[$j]->title, -1));
$band = true;
$position = $j;
}
}
if ($band) {
$archivitos[] = $files[$position];
$i++;
} else {
// var_dump(null."Aqui");
$archivitos[] = null;
}
/*if(substr($files[$i]->title, -1) == $counter+1):
var_dump(substr($files[$i]->title, -1));
$archivitos[] = $files[$i];
$i++;
else:
var_dump('No');
$archivitos[] = null;
endif;*/
$counter++;
}
// dd(new Illuminate\Database\Eloquent\Collection($archivitos));
return new Illuminate\Database\Eloquent\Collection($archivitos);
}
示例6: postPostsaveord
public function postPostsaveord()
{
$order = Input::get('order');
$id = Input::get('id');
$kappa = Files::where('id', $id)->first();
$kappa->ord = $order;
$kappa->save();
return [];
}
示例7: add
/**
* Upload file
* @return array
*/
public function add()
{
$data = array('module_id' => Input::get('module_id'), 'module_name' => Input::get('module_name'), 'num' => Input::get('num'), 'filepath' => Input::get('path'));
$filename = ltrim($data['filepath'], '/');
$name = basename($filename);
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$dbfile = Files::where('path', 'like', "%{$name}")->first();
if ($dbfile) {
$filename = $dbfile->path;
$name = $dbfile->name;
$extension = $dbfile->extension;
}
$fid = Files::register($name, $filename, $extension, $data['module_name'], $data['module_id']);
$data['error'] = '0';
$data['succes'] = 'Uploaded!';
Log::info("File added #{$fid} - '{$filename}'");
return $data;
}
示例8: getDownloadFile
/**
* Download a File
*/
public function getDownloadFile($md5)
{
//Get the file
$file = \Files::where('key', '=', $md5)->first();
//Check if file exists
if (file_exists($file['file_sys_ref'] . $file['file_md5'])) {
return Response::download($file['file_sys_ref'] . $file['file_md5'], $file['file_name']);
} else {
Log::error("File " . $file['file_name'] . " does not exists.");
throw new \FileNotFoundException();
}
}
示例9: deleteFileFolder
public function deleteFileFolder($id)
{
$folder = FilesFolder::find($id);
if (Auth::user()->StudentID == $folder->OwnerID) {
FilesFolder::find($id)->update(array('delFlag' => 1)) ? Files::where('folderID', $id)->update(array('delFlag' => 1)) : '';
}
}
示例10: getThumbsDown
public function getThumbsDown($id)
{
try {
$file = Files::where('id', $id)->firstOrFail();
$this->googleAnalytics('/files/thumbs-down/' . $id);
$file->thumbs_down++;
$file->save();
$thumbs = array();
if (Cookie::get('ps_thumbs')) {
$cookie = Cookie::get('ps_thumbs');
$thumbs = unserialize($cookie);
if (isset($thumbs['files'][$file->id])) {
return Response::json(array('status' => 'fail', 'message' => __("Већ сте оценили овај материјал")));
}
}
$thumbs['files'][$file->id] = 'down';
Cookie::queue('ps_thumbs', serialize($thumbs), '86400');
$response = array('status' => 'success', 'message' => __("Хвала на труду. Ваш глас је забележен"), 'thumbsUp' => $file->thumbs_up, 'thumbsDown' => $file->thumbs_down);
return Response::json($response);
} catch (Exception $e) {
return Response::json(array('status' => 'fail'));
}
}
示例11:
<?php
$records = Files::where('parent_id', '=', (int) $_GET['node'])->get();
?>
[
<?php
foreach ($records as $record) {
?>
{
text: '<?php
echo $record->text;
?>
',
leaf: <?php
if ($record->leaf) {
echo 'true';
} else {
echo 'false';
}
?>
,
id: <?php
echo $record->id;
?>
},
<?php
}
?>
示例12: coverImage
public static function coverImage($id)
{
return Files::where(array('module_name' => 'post_cover', 'module_id' => $id))->remember(SettingsModel::one('cachelife'))->first();
}
示例13: route
public function route($query = '')
{
$parts = explode('/', $query);
if ($parts) {
$uri = end($parts);
$this->data['page'] = Post::findURI($uri, 1);
if ($this->data['page']) {
PostResources::init();
// Verify if page is redirectable
if ($this->data['page']->redirect_to) {
$redirect_url = Post::getFullURI($this->data['page']->redirect_to);
if ($redirect_url) {
return Redirect::to($redirect_url);
}
}
// Verify if page is redirectable
if ($this->data['page']->redirect_to) {
$redirect_url = Post::getFullURI($this->data['page']->redirect_to);
if ($redirect_url) {
return Redirect::to($redirect_url);
}
}
Template::clearBreadCrumbs();
Template::addBreadCrumb("/", varlang('acasa'));
// Get pages resources
$this->data['parents'] = Post::getParents($this->data['page']['parent'], 1);
$this->data['parent'] = Post::findID($this->data['page']['parent'], 1);
$this->data['colevels'] = Post::findWithParent($this->data['page']['parent']);
$this->data['super_parent'] = array_first($this->data['parents'], function ($key, $item) {
return $item['parent'] == 0;
});
// get real page URI
$segments = array();
$parrents_ids = array($this->data['page']->id);
foreach (array_reverse($this->data['parents']) as $parrent) {
$segments[] = $parrent['uri'];
$parrents_ids[] = $parrent['id'];
Template::addBreadCrumb(Post::getURL(implode('/', $segments)), $parrent['title']);
}
$segments[] = $this->data['page']['uri'];
Template::addBreadCrumb(Post::getURL($query), $this->data['page']['title']);
$realURI = implode('/', $segments);
// Verify if real uri is correct
if ($realURI === $query) {
// get global data
View::share(array('active_page_id' => $this->data['page']->id, 'parrents_ids' => $parrents_ids, 'super_parent' => $this->data['super_parent']));
// Verify if this page is clone
if ($this->data['page']->clone_id) {
$clone = Post::findID($this->data['page']->clone_id, 1);
if ($clone) {
$this->data['page'] = $clone;
}
}
// Set page title
$this->data['top_title'] = $this->data['page']['title'];
WebAPL\Template::setPageTitle($this->data['page']['title']);
$this->data['page_url'] = WebAPL\Language::url("page/" . $realURI);
// Get page files
if ($this->data['page']->show_files) {
$this->data['page']['files'] = Files::where(array('module_name' => 'page', 'module_id' => $this->data['page']->id, 'type' => 'document'))->remember(SettingsModel::one('cachelife'))->get();
} else {
$this->data['page']['files'] = array();
}
// register one view
Post::oneView($this->data['page']['id']);
Template::setMetaMultiple(array('og:title' => $this->data['page']->title, 'description' => $this->data['page']->text, 'og:description' => $this->data['page']->text), true);
// load page
PageController::loadGeneralResources();
View::share('page', $this->data['page']);
if ($this->data['page']->general_node) {
return $this->loadHome();
} else {
return $this->loadPage();
}
} else {
throw new Exception("Query '{$query}' is not valid", 404);
}
} else {
throw new Exception("Page with uri '{$uri}' not found", 404);
}
} else {
throw new Exception("No valid page URI", 404);
}
}
示例14: fileListPrepare
public static function fileListPrepare($field, $post)
{
return Files::where(array('module_name' => 'doc_post_lang', 'module_id' => $post->post_lang_id, 'type' => 'document'))->get();
}
示例15: dropFile
public static function dropFile($path, $id = 0)
{
$used = Files::where('path', 'like', "%{$path}")->where('id', '<>', $id)->count();
if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/' . $path) && $used == 0) {
unlink($_SERVER['DOCUMENT_ROOT'] . '/' . $path);
}
}