本文整理汇总了PHP中Organization::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::where方法的具体用法?PHP Organization::where怎么用?PHP Organization::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
Route::resource('iterations', 'IterationsController');
//Route::resource('task', 'TaskController');
Route::resource('personalType', 'PersonalTypeController');
});
Route::group(['prefix' => 'messages'], function () {
Route::get('/', ['as' => 'messages', 'uses' => 'MessagesController@index']);
Route::get('create', ['as' => 'messages.create', 'uses' => 'MessagesController@create']);
Route::post('/', ['as' => 'messages.store', 'uses' => 'MessagesController@store']);
Route::get('{id}', ['as' => 'messages.show', 'uses' => 'MessagesController@show']);
Route::put('{id}', ['as' => 'messages.update', 'uses' => 'MessagesController@update']);
});
Route::get('users/delete', function () {
if (Request::ajax()) {
$id = Input::get("id");
$user = User::findOrFail($id);
$organizations = sizeof(Organization::where('usersid', '=', $id)->get());
if ($organizations >= 1) {
return Response::json(array('succes' => 'false', 'message' => 'No se puede borrar el registro. <br />El usuario es propietario de una organización'));
}
if ($user->delete()) {
return Response::json(array('succes' => 'true', 'message' => 'Usuario eliminado exitosamente', 'gr' => $user->organization()));
} else {
return Response::json(array('succes' => 'false', 'message' => 'Error, claves foráneas'));
}
}
});
Route::controller('projects', 'ProjectsController');
Route::controller('users', 'UsersController');
Route::get('/', 'UsersController@getLogin');
Route::post('update/{id}', 'UsersController@update');
Route::get('edit/{id}', 'GraphicsController@iterationSummary');
示例2: function
Route::get('sign-in', ['as' => 'sign-in', 'uses' => 'SessionsController@create']);
Route::post('sign-in', ['as' => 'sign-in', 'uses' => 'SessionsController@store']);
Route::get('sign-up', ['as' => 'sign-up', 'uses' => 'SignupsController@create']);
Route::post('sign-up', ['as' => 'sign-up', 'uses' => 'SignupsController@store']);
});
Route::group(['domain' => 'toodoo.dev', 'before' => 'auth'], function () {
Route::get('/', ['uses' => 'HomeController@show', 'as' => 'home']);
Route::get('dashboard', ['uses' => 'HomeController@dashboard', 'as' => 'dashboard']);
Route::delete('sign-out', ['as' => 'sign-out', 'uses' => 'SessionsController@destroy']);
});
Route::group(['domain' => '{organizations}.toodoo.dev', 'before' => 'auth|tenant'], function () {
Route::get('/', ['uses' => 'OrganizationsController@show', 'as' => 'organizations.show']);
Route::get('settings', ['uses' => 'OrganizationsController@edit', 'as' => 'settings']);
Route::put('settings', ['uses' => 'OrganizationsController@update', 'as' => 'settings']);
Route::bind('organizations', function ($value, $route) {
return Organization::where('slug', $value)->firstOrFail();
});
Route::resource('todos', 'TodosController');
// Will remove for manual routes maybe?
Route::model('todos', 'Todo');
Route::resource('users', 'UsersController');
Route::model('users', 'User');
Route::get('styles/organization-custom.css', function (Organization $org) {
$response = Response::make(View::make('organizations.css', ['css' => $org->css]));
$response->header('Content-Type', 'text/css');
return $response;
});
});
View::composer('shared._notifications', function ($view) {
$view->with('flash', ['success' => Session::get('success'), 'error' => Session::get('error')]);
});
示例3: load_organizations
public function load_organizations()
{
$country_id = $_POST['country_id'];
$data = new Organization();
if ($country_id > 0) {
$data->where('country_id', $country_id);
}
$data->get();
echo '<select name="org_id" class="form-control">';
echo '<option value="">-- select organization --</option>';
foreach ($data as $key => $data_item) {
echo '<option value="' . $data_item->id . '">' . $data_item->org_name . '</option>';
}
echo '</select>';
}
示例4: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$event = VolunteerEvent::find($id);
$organizations = Organization::where('user_id', '=', Auth::user()->id)->lists('id', 'name');
return View::make('events.edit', compact('event', 'organizations'));
}
示例5: function
<?php
/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
App::singleton('organization', function () {
$organization = Organization::where('name', 'Arquinova')->get()->first();
$organization->auxName = str_replace(" ", '-', $organization->name);
foreach ($organization->projects as $project) {
$project->auxName = str_replace(" ", '-', $project->name);
$project->auxName = stripAccents($project->auxName);
}
return $organization;
});
App::bind('foo', function ($app) {
return new FooBar();
});
View::share('organization', app('organization'));
});
/**
* Replace accents
**/
function stripAccents($str)
示例6: array
default:
$object = '';
}
return Response::json($object);
}));
Route::post('{object_name}/search/json', array('as' => 'search', function ($object_name) {
if (!Input::has('query')) {
return Response::json(array());
}
$query = Input::get('query', '');
$query = '%' . str_replace(' ', '%', $query) . '%';
switch ($object_name) {
case 'user':
$results = User::where('email', 'LIKE', $query)->orWhere('first_name', 'LIKE', $query)->get()->toArray();
foreach ($results as $key => $user) {
$full_name = $user['first_name'] . ' ' . substr($user['last_name'], 0, 1);
$results[$key]['name'] = $full_name;
unset($results[$key]['last_name']);
}
break;
case 'organization':
$results = Organization::where('name', 'LIKE', $query)->get();
break;
default:
$results = array();
}
return Response::json($results);
}));
// CREATE FILTERS TO DETERMINE WHAT AUTHENTICATION IS NEEDED
// FOR EXAMPLE, ANY ROUTE WITH /edit IN THE NAME REQUIRES AT LEAST
// EDIT PERMISSIONS