本文整理汇总了PHP中Organization::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::all方法的具体用法?PHP Organization::all怎么用?PHP Organization::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::all方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
DB::table('todos')->truncate();
foreach (Organization::all() as $org) {
Todo::create(['name' => 'First Todo', 'user_id' => $org->users[0]->id, 'organization_id' => $org->id, 'completed' => true]);
Todo::create(['name' => 'Second Todo', 'user_id' => $org->users[0]->id, 'organization_id' => $org->id]);
Todo::create(['name' => 'Todo from Second', 'user_id' => $org->users[1]->id, 'organization_id' => $org->id]);
Todo::create(['name' => 'Third Todo', 'user_id' => $org->users[0]->id, 'organization_id' => $org->id]);
}
}
示例2: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::transaction(function () {
Schema::table('organizations', function (Blueprint $table) {
$table->string('slug', 255)->nullable()->index();
});
foreach (Organization::all() as $org) {
$org->slug = Str::slug($org->name);
$org->save();
}
});
}
开发者ID:sonico999,项目名称:Multitenant-Apps-in-Laravel,代码行数:17,代码来源:2014_09_12_005935_AddSlugToOrganizationsTable.php
示例3: run
public function run()
{
DB::table('users')->truncate();
DB::table('organization_user')->truncate();
$usernames = ['machuga', 'second', 'third', 'admin'];
foreach (Organization::all() as $org) {
foreach ($usernames as $username) {
$username = $org->isVendor() ? $username : $username . $org->id;
$user = User::create(['name' => ucfirst($username), 'email' => "{$username}@example.com", 'password' => $username, 'active' => true, 'admin' => starts_with($username, 'admin')]);
$user->organizations()->attach($org->id);
}
}
}
示例4: getPlatforms
/**
* @test
*/
public function getPlatforms()
{
$orgs = \Organization::all([], ['_id']);
$results = [];
foreach ($orgs as $o) {
$platforms = \Platform::rssFeeds($o);
$count = count($platforms);
if ($count === 0) {
continue;
}
$results = array_merge($results, $platforms);
}
$this->assertNotEquals(0, count($results));
return $results;
}
示例5: run
public function run()
{
DB::table('users')->truncate();
$usernames = ['tonetlds', 'demo', 'admin'];
foreach (Organization::all() as $org) {
foreach ($usernames as $username) {
$username = $username . '-' . $org->name;
User::create(['organization_id' => $org->id, 'username' => $username, 'email' => $username . '@lucianotonet.com', 'password' => $username, 'password_confirmation' => $username, 'confirmation_code' => NULL, 'remember_token' => NULL, 'confirmed' => TRUE, 'admin' => starts_with($username, 'admin')]);
}
}
// User::create([
// 'id' => 1,
// 'username' => 'tonetlds',
// 'email' => 'tonetlds@gmail.com',
// 'password' => Hash::make('254608'),
// 'confirmation_code' => NULL,
// 'remember_token' => NULL,
// 'confirmed' => 1,
// ]);
}
示例6: index
function index()
{
$this->organizations = Organization::all();
}
示例7: index
/**
* Display a listing of organizations
*
* @return Response
*/
public function index()
{
$organizations = Organization::all();
return View::make('organizations.index', compact('organizations'));
}
示例8: edit
function edit()
{
$this->user = User::find($this->params('id'));
$this->organizations = Organization::all();
}
示例9: all
/**
* Manages all school registered
* @before _secure, _school, _admin
*/
public function all()
{
$this->setSEO(array("title" => "All Schools"));
$view = $this->getActionView();
$limit = RequestMethods::get("limit", 10);
$page = RequestMethods::get("page", 1);
$organizations = Organization::all(array(), array("name", "user_id", "created"), "created", "desc", $limit, $page);
$view->set("organizations", $organizations);
}
示例10: add
function add()
{
$this->organizations = Organization::all();
}
示例11: popularPackages
public function popularPackages()
{
$this->seo(array("title" => "Popular Packages", "view" => $this->getLayoutView()));
$view = $this->getActionView();
$organizations = Organization::all(array("live = ?" => true), array("id", "name"));
$limit = RequestMethods::get("limit", 10);
$page = RequestMethods::get("page", 1);
$packages = Package::all(array("live = ?" => 1), array("title", "organization_id", "charge", "id"), "created", "desc", $limit, $page);
$total = (int) Package::count(array("live = ?" => 1));
$results = array();
foreach ($packages as $p) {
$data = array("title" => $p->title, "lab" => $organizations[$p->organization_id]->name, "lab_id" => $p->organization_id, "charge" => $p->charge, "id" => $p->id);
$results[] = ArrayMethods::toObject($data);
}
$view->set("packages", $results)->set("total", $total);
}
示例12: function
$credentials['email'] = Input::get('email');
}
return Password::reset($credentials, function ($user, $password) {
$user->setPassword($password);
$user->save();
return Redirect::route('login');
});
});
// JSON VIEWS
Route::get('{object_name}/json', array('as' => 'json', function ($object_name) {
switch ($object_name) {
case 'users':
$object = User::all();
break;
case 'organizations':
$object = Organization::all();
break;
default:
$object = '';
}
return Response::json($object);
}));
Route::get('{object_name}/{id}/json', array('as' => 'json', function ($object_name, $id) {
switch ($object_name) {
case 'user':
$object = User::find($id);
break;
case 'organization':
$object = Organization::find($id);
break;
default:
示例13: generateBills
public function generateBills()
{
$orgs = Organization::all(["live = ?" => true]);
foreach ($orgs as $org) {
$imp_cost = 0;
$click_cost = 0;
$month_ini = new DateTime("first day of last month");
$month_end = new DateTime("last day of last month");
$start = $month_ini->format('Y-m-d');
$end = $month_end->format('Y-m-d');
$dateQuery = Utils::dateQuery(['start' => $start, 'end' => $end]);
// find advertiser performances to get clicks and impressions
$performances = \Performance::overall($dateQuery, User::all(['org_id' => $org->_id, 'type' => 'advertiser'], ['_id']));
$clicks = $performances['total_clicks'];
if ($clicks > 1000) {
$click_cost = 0.001 * $clicks * $org->meta["bill"]["tcc"];
}
$impressions = $performances['total_impressions'];
if ($impressions > 100000) {
$imp_cost = 0.001 * 0.001 * $impressions * $org->meta["bill"]["mic"];
}
$total = $click_cost + $imp_cost;
$bill = new Bill(["org_id" => $org->id, "impressions" => $impressions, "clicks" => $clicks, "mic" => $org->meta["bill"]["mic"], "tcc" => $org->meta["bill"]["tcc"], "start" => $start, "end" => $end, "amount" => $total, "live" => false, "created" => Db::time('-1 day')]);
if ($total > 1) {
$bill->save();
$user = User::first(["org_id = ?" => $org->id, "type = ?" => "admin"]);
Mail::send(['user' => $user, 'bill' => $bill, 'template' => 'adminBilling', 'subject' => 'Billing at vNative', 'click_cost' => $click_cost, 'imp_cost' => $imp_cost, 'org' => $org]);
}
}
}