本文整理汇总了PHP中Module::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Module::where方法的具体用法?PHP Module::where怎么用?PHP Module::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Module
的用法示例。
在下文中一共展示了Module::where方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _delete
public function _delete($field, $value, $priv = '', $roleid = 0)
{
$where = '';
if ($roleid) {
$where .= "AND `roleid`='{$roleid}' ";
}
if ($field) {
$where .= "AND `field`='{$field}' ";
}
if ($value) {
$where .= "AND `value`='{$value}' ";
}
if ($priv) {
$where .= "AND `priv`='{$priv}' ";
}
if ($where) {
$where = substr($where, 3);
return $this->_m->where($where)->delete();
}
return false;
}
示例2: postModule
public function postModule()
{
$json_request = array('status' => TRUE, 'responseText' => 'Сохранено');
if ($module = Module::where('name', Input::get('name'))->first()) {
$module->update(array('on' => Input::get('value')));
$module->touch();
} else {
Module::create(array('name' => Input::get('name'), 'on' => Input::get('value')));
}
if (Input::get('value') == 1) {
$json_request['responseText'] = "Модуль «" . SystemModules::getModules(Input::get('name'), 'title') . "» включен";
} else {
$json_request['responseText'] = "Модуль «" . SystemModules::getModules(Input::get('name'), 'title') . "» выключен";
}
#$json_request['responseText'] = print_r(SystemModules::getModules(Input::get('name')), 1);
return Response::json($json_request, 200);
}
示例3: save
public function save($id)
{
if ($_POST) {
$variable = new Permission();
$variable->where("user_type_id", $id)->get()->delete_all();
// permission เว็บไซต์หลัก
$module = new Module();
$module->where("main", 1)->order_by("extra", "DESC")->order_by("id", "ASC")->get();
foreach ($module as $key => $value) {
if (!empty($_POST[$value->module . "_view"]) || !empty($_POST[$value->module . "_create"]) || !empty($_POST[$value->module . "_delete"]) || !empty($_POST[$value->module . "_extra"])) {
$foo = new Permission();
$foo->user_type_id = $id;
$foo->module = $value->module;
$foo->views = @$_POST[$value->module . "_view"] ? 1 : 0;
$foo->create = @$_POST[$value->module . "_create"] ? 1 : 0;
$foo->delete = @$_POST[$value->module . "_delete"] ? 1 : 0;
$foo->extra = @$_POST[$value->module . "_extra"] ? 1 : 0;
$foo->save();
}
}
// permission ประเภทข่าวของเว็บไซต์หลัก
$content = new Content_Group();
$content->order_by("title", "ASC")->get();
foreach ($content as $key => $value) {
if (!empty($_POST["content_" . $value->id . "_view"]) || !empty($_POST["content_" . $value->id . "_create"]) || !empty($_POST["content_" . $value->id . "_delete"])) {
$foo = new Permission();
$foo->user_type_id = $id;
$foo->module = "content_" . $value->id;
$foo->views = @$_POST["content_" . $value->id . "_view"] ? 1 : 0;
$foo->create = @$_POST["content_" . $value->id . "_create"] ? 1 : 0;
$foo->delete = @$_POST["content_" . $value->id . "_delete"] ? 1 : 0;
$foo->save();
}
}
// check ถ้ามีการเลือกของ intranet
if (@$_POST["intranet"]) {
$module = new Module();
$module->where("intranet", 1)->order_by("extra", "DESC")->order_by("id", "ASC")->get();
foreach ($module as $num => $row) {
if (!empty($_POST["int_" . $row->module . "_view"]) || !empty($_POST["int_" . $row->module . "_create"]) || !empty($_POST["int_" . $row->module . "_delete"]) || !empty($_POST["int_" . $row->module . "_extra"])) {
$intranet = new Permission();
$intranet->user_type_id = $id;
$intranet->module = "int_" . $row->module;
$intranet->views = @$_POST["int_" . $row->module . "_view"] ? 1 : 0;
$intranet->create = @$_POST["int_" . $row->module . "_create"] ? 1 : 0;
$intranet->delete = @$_POST["int_" . $row->module . "_delete"] ? 1 : 0;
$intranet->extra = @$_POST["int_" . $row->module . "_extra"] ? 1 : 0;
$intranet->save();
}
}
}
// check ถ้ามีการเลือกของเว็บหน่วยงาน
if (@$_POST["department"]) {
$module = new Module();
$module->where("department", 1)->order_by("extra", "DESC")->order_by("id", "ASC")->get();
foreach ($_POST["department"] as $key => $value) {
foreach ($module as $num => $row) {
if (!empty($_POST["d" . $value . "_" . $row->module . "_view"]) || !empty($_POST["d" . $value . "_" . $row->module . "_create"]) || !empty($_POST["d" . $value . "_" . $row->module . "_delete"]) || !empty($_POST["d" . $value . "_" . $row->module . "_extra"])) {
$department = new Permission();
$department->user_type_id = $id;
$department->module = "d" . $value . "_" . $row->module;
$department->views = @$_POST["d" . $value . "_" . $row->module . "_view"] ? 1 : 0;
$department->create = @$_POST["d" . $value . "_" . $row->module . "_create"] ? 1 : 0;
$department->delete = @$_POST["d" . $value . "_" . $row->module . "_delete"] ? 1 : 0;
$department->extra = @$_POST["d" . $value . "_" . $row->module . "_extra"] ? 1 : 0;
$department->save();
}
}
}
}
if (!empty($_POST['requests_view'])) {
$module = new Module();
$module->where('request', 1)->order_by('extra', 'desc')->order_by('id', 'asc')->get();
foreach ($module as $num => $row) {
$request = new Permission();
$request->user_type_id = $id;
$request->module = $row->module;
$request->views = @$_POST[$row->module . "_view"] ? 1 : 0;
$request->create = @$_POST[$row->module . "_create"] ? 1 : 0;
$request->delete = @$_POST[$row->module . "_delete"] ? 1 : 0;
$request->extra = @$_POST[$row->module . "_extra"] ? 1 : 0;
$request->save();
}
}
}
redirect("admin/settings/permissions");
}
示例4: index
function index()
{
$modules = new Module();
$data['modules'] = $modules->where("listperpage <> ''")->get();
$this->template->build('admin/listperpage_index', $data);
}
示例5: Exception
if (!ClassLoader::load($Extension)) {
throw new Exception("'{$Extension}' load failed!");
}
}
});
Event::listen('APL.core.prepare', function () use($APLExtensions) {
foreach ($APLExtensions as $Extension) {
$full_class = "WebAPL\\" . $Extension;
$full_class::__init();
class_alias($full_class, $Extension);
}
});
Event::listen('APL.modules.load', function () {
Event::fire('APL.core.load');
Event::fire('APL.core.prepare');
Module::where('enabled', '1')->get()->each(function ($module) {
ClassLoader::addDirectories(app_path() . '/modules/' . $module->extension . '/');
ClassLoader::load($module->extension);
Modules::addInstance($module->extension);
});
});
$clear_cache = FALSE;
Event::listen(['eloquent.sav*', 'eloquent.upd*', 'eloquent.del*', 'eloquent.creat*'], function () use(&$clear_cache) {
$clear_cache = TRUE;
});
App::shutdown(function () use(&$clear_cache) {
if ($clear_cache) {
File::deleteDirectory($_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/storage/cache/');
@unlink($_SERVER['DOCUMENT_ROOT'] . '/apps/frontend/storage/meta/services.json');
Cache::flush();
}
示例6: courses_dropdown
public function courses_dropdown()
{
$course_id = Input::get('option');
return Module::where('course_id', '=', $course_id)->lists('name', 'id');
// return DB::table('application_intakes')->select('name','id')->where('year','=',$year)->get();
}
示例7: getModulesByLsStudentNumber
public function getModulesByLsStudentNumber()
{
$ls_student_number = Input::get('option');
$san = Student::where('ls_student_number', '=', $ls_student_number)->first()->san;
$course_id = StudentCourseEnrolment::where('san', '=', $san)->first()->course_name;
if ($course_id > 0) {
$course_name = ApplicationCourse::where('id', '=', $course_id)->first()->name;
return array(Module::where('course_id', '=', $course_id)->lists('name', 'id'), $course_name);
} else {
return array([], []);
}
}
示例8: function
| return 'Hello World!';
| }));
|
*/
Route::filter('before', function () {
// Do stuff before every request to your application...
});
Route::filter('after', function ($response) {
// Do stuff after every request to your application...
});
Route::filter('csrf', function () {
if (Request::forged()) {
return Response::error('500');
}
});
Route::filter('auth', function () {
if (Auth::guest()) {
return Redirect::to('login')->with('notification', 'Please login!');
}
});
Route::filter('check_permissions', function () {
$route = Router::route(Request::method(), URI::current());
$uses = $route->action['uses'];
list($controller, $action) = explode('@', $uses);
$module = Module::where('controller', '=', $controller)->only('id');
$group_id = Auth::user()->group_id;
$check = Group::find($group_id)->modules()->where('module_id', '=', $module)->first();
if ($check == null) {
return View::make('error.forbidden');
}
});
示例9: module_class
/**
* Return the full path to the given module class.
*
* @param string $module
* @param string $class
*
* @return string
*/
function module_class($module, $class)
{
$module = Module::where('slug', $module);
$namespace = config('modules.namespace') . $module['basename'];
return "{$namespace}\\{$class}";
}
示例10: init
public function init($tableName, $id = null)
{
$modelName = studly_case(str_singular($tableName));
$model = '\\' . $modelName;
// If there's no model in root namespace, check in Photon ns
if (!class_exists($model)) {
$model = '\\Orangehill\\Photon\\' . $modelName;
}
// Get model instance for current module
$this->modelInstance = new $model();
// Fetch module data by table name
$this->data['module'] = Module::where('table_name', $tableName)->first();
// Return error page if no module is found
if (!$this->data['module']) {
return \View::make('photon::errors.missing');
}
// Fetch Fields
$this->data['fields'] = $this->data['module']->fields;
// If entry ID has been provided fetch the entry data to hydrate a form
if ($id) {
$this->data['entry'] = $this->modelInstance->find($id);
}
// Check for certain field types that need to be handled specialy later in postEntry()
foreach ($this->data['fields'] as $field) {
if ($field->field_type == 'image') {
$this->imageFields[] = $field;
}
if ($field->field_type == 'boolean') {
$this->booleanFields[] = $field;
}
if ($field->field_type == 'one-to-many') {
$this->oneToManyFields[] = $field;
}
if ($field->field_type == 'many-to-many') {
$this->manyToManyFields[] = $field;
}
}
// Handle oneToMany fields
if (isset($this->oneToManyFields) and count($this->oneToManyFields) > 0) {
// $data['oneToMany'] will be used to populate the select field
$this->data['oneToMany'] = array();
foreach ($this->oneToManyFields as $oneToManyField) {
// Fetch the data from related table
$module = \Orangehill\Photon\Module::find($oneToManyField->relation_table);
$this->data['oneToMany'][$oneToManyField->column_name] = $this->fetchRelationTable($module, $oneToManyField->id);
}
}
// Handle manyToMany fields
if (isset($this->manyToManyFields) and count($this->manyTDoManyFields) > 0) {
// $data['manyToMany'] will be used to populate the dual select field
$this->data['manyToMany'] = array();
foreach ($this->manyToManyFields as $manyToManyField) {
// Fetch the data from related table
$module = \Orangehill\Photon\Module::find($manyToManyField->relation_table);
$this->data['manyToMany'][$manyToManyField->column_name]['available'] = $this->fetchRelationTable($module, $manyToManyField->id);
$this->data['manyToMany'][$manyToManyField->column_name]['selected'] = array();
// Fetch Selected Items
if (is_numeric(\Request::segment(3))) {
$tableName = $module->table_name;
$selected = $this->data['entry']->{$tableName}()->get();
foreach ($selected as $item) {
$this->data['manyToMany'][$manyToManyField->column_name]['selected'][] = $item->id;
}
// Set a table name inside an array
$this->data['manyToMany'][$manyToManyField->column_name]['tableName'] = $tableName;
}
}
}
// Set the breadcrumbs array
$this->data['breadcrumbs'] = array(array('url' => 'javascript:;', 'anchor' => $this->data['module']->name));
}
示例11: uninitialize
/**
* Uninitialize the modules.
*
* @param $slug
*
* @return \Illuminate\Http\Response
*/
public function uninitialize($slug)
{
Audit::log(Auth::user()->id, trans('admin/modules/general.audit-log.category'), trans('admin/modules/general.audit-log.msg-uninitialize', ['slug' => $slug]));
$module = \Module::where('slug', $slug)->first();
if ($module) {
if (\Module::isInitialized($slug)) {
if (\Module::isDisabled($slug)) {
\Module::uninitialize($slug);
Flash::success(trans('admin/modules/general.status.uninitialized', ['name' => $module['name']]));
} else {
Flash::warning(trans('admin/modules/general.status.not-disabled', ['name' => $module['name']]));
}
} else {
Flash::warning(trans('admin/modules/general.status.not-initialized', ['name' => $module['name']]));
}
} else {
Flash::error(trans('admin/modules/general.status.not-found', ['slug' => $slug]));
}
return redirect('/admin/modules');
}
示例12: getMaintenance
/**
* Resolve and instantiate the module's maintenance class.
*
* @param $slug
* @return object
*/
public function getMaintenance($slug)
{
$maintenanceInstance = null;
$nameSpace = \Module::where('slug', $slug)->first()['namespace'];
$maintenanceFile = config('modules.path') . '/' . $nameSpace . '/Utils/' . $nameSpace . 'Maintenance.php';
$maintenanceClass = '\\' . config('modules.namespace') . $nameSpace . '\\Utils\\' . $nameSpace . 'Maintenance';
require $maintenanceFile;
$maintenanceInstance = new $maintenanceClass();
return $maintenanceInstance;
}
示例13:
</div>
<div class="col-sm-6">
<div class="row" style="font-size: 16px" >
<div class="form-group">
<div class="col-sm-12"><h4 class="m-t-none m-b">Modules list</h4>
<span id="module_list" name="module_list">
@if(intval($student_course_enrolments->course_name)>0)
<?php
$selected_modules_list = Module::where('course_id', '=', $student_course_enrolments->course_name)->lists('name', 'id');
$ii = 1;
?>
@foreach( $selected_modules_list as $modules)
{{ '<br>'.$ii.' '.$modules }}
<?php
$ii++;
?>
@endforeach
@endif
</span>
</div>
</div>
</div>
<br><br>