本文整理汇总了PHP中Organization::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Organization::find方法的具体用法?PHP Organization::find怎么用?PHP Organization::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Organization
的用法示例。
在下文中一共展示了Organization::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: signup
/**
* Signup a new account with the given parameters
*
* @param array $input Array containing 'username', 'email' and 'password'.
*
* @return User User object that may or may not be saved successfully. Check the id to make sure.
*/
public function signup($input)
{
// $name = array_get($input, 'organization');
$org = new Organization();
$lcode = $org->encode($name);
$organization = Organization::find(array_get($input, 'organization_id'));
$organization->licensed = 100;
$organization->license_code = $lcode;
$organization->update();
$user = new User();
$user->username = array_get($input, 'username');
$user->email = array_get($input, 'email');
$user->password = array_get($input, 'password');
$user->user_type = array_get($input, 'user_type');
$user->username = array_get($input, 'username');
$user->organization_id = '1';
// The password confirmation will be removed from model
// before saving. This field will be used in Ardent's
// auto validation.
$user->password_confirmation = array_get($input, 'password_confirmation');
// Generate a random confirmation code
$user->confirmation_code = md5(uniqid(mt_rand(), true));
// Save if valid. Password field will be hashed before save
$this->save($user);
return $user;
}
示例2: balanceSheet
public static function balanceSheet($date)
{
$accounts = Account::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('pdf.financials.balancesheet', compact('accounts', 'date', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Balance Sheet.pdf');
}
示例3: stock
public function stock()
{
$items = Item::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('erpreports.stockReport', compact('items', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Stock Report.pdf');
}
示例4: getOrgDocs
public function getOrgDocs($id)
{
$organization = Organization::find($id);
$user = Organization::find($id)->user();
$documents = User::find($organization->user->id)->documents;
return View::make('inspector.documents_view', ['organization' => $organization, 'user' => $user, 'documents' => $documents]);
}
示例5: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$organization = Organization::find($id);
$organization->delete();
Session::flash('successMessage', 'Your delete was successful.');
return Redirect::action('OrganizationsController@index');
}
示例6: payments
public function payments()
{
$payments = Payment::all();
$erporders = Erporder::all();
$erporderitems = Erporderitem::all();
$organization = Organization::find(1);
$pdf = PDF::loadView('erpreports.paymentsReport', compact('payments', 'erporders', 'erporderitems', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Payment List.pdf');
}
示例7: edit
public function edit($id)
{
$organization = Organization::find($id);
if (!Auth::user()->hasPermissionTo('edit', $organization)) {
Session::put('status', 'error');
Session::put('message', 'You do not have permission to edit this organization!');
return Redirect::to('organization/' . $organization->id);
} elseif (Input::has('_token')) {
return $this->save($organization, array_except(Input::all(), '_token'));
} else {
return View::make('organization.edit', array('organization' => $organization));
}
}
示例8: postUpdate
/**
*
**/
public function postUpdate()
{
$organization = Organization::find(Input::get('id'));
$organization->name = Input::get('name');
$file = Input::file('image');
if ($file != null) {
$upload_success = Input::file('image')->move('public/uploads', $file->getClientOriginalName());
$organization->logo = $file->getClientOriginalName();
}
$organization->address = Input::get('address');
$organization->webPage = Input::get('webPage');
$organization->save();
return Redirect::to('organization/edit')->with('message', 'Registro actualizado con exito');
}
示例9: addAction
public function addAction($f3)
{
$data = json_decode($f3->get('BODY'));
//allows to use one loop for both array and object input
if (!is_array($data)) {
$data = array($data);
}
$organization = new Organization();
$is_error = false;
$message = "";
$result = array();
foreach ($data as $item) {
//create the data in local DB only if it is created in the API
//attention - id's do not match
$res = $this->checkDuplicateNamesLocal($item);
if (max(array_count_values($res)) > 1) {
$is_error = true;
$message = "Your request data contains duplicate customer names";
continue;
}
//if first step pass - check if new items already exist in database
//(could be optimized into one query using IN() operator, depending on real data purpose )
foreach ($res as $item2) {
$organization->find(array('name = ?', $item2));
if ($organization->loaded()) {
$is_error = true;
$message = "Organization {$organization->name} already added to the database";
continue;
}
}
if (!$this->createAPIOrganizationRecursive($item)) {
$is_error = true;
$message = "Error while adding organization tree to the pipedrive API";
continue;
}
$this->createOrganizationRecursive($item, $result);
}
if ($is_error) {
$f3->set('content', $this->errorResponse($message));
} else {
$f3->set('content', $this->successResponse($result));
}
}
示例10: addNote
public function addNote()
{
$user_id = Input::get('user_id');
$org_id = Input::get('org_id');
$body = Input::get('body');
$flag = Input::get('flag');
$user = User::find($user_id);
$org = Organization::find($org_id);
if (!$user or !$org) {
err('Something went wrong with your submission');
return Redirect::back();
}
if (!me()->isOrgAdmin($org)) {
err('You do not have permission to leave organizational notes for that organization');
return Redirect::back();
}
$note = new OrganizationNote();
$note->organization_id = $org_id;
$note->body = $body;
$user->notes()->save($note);
msg('Note left successfully');
return Redirect::back();
}
示例11: getUserOrganization
public static function getUserOrganization()
{
$organization_id = 1;
$organization = Organization::find($organization_id);
return $organization;
}
示例12: postCalcDocs
public function postCalcDocs($id)
{
$user = User::find($id);
$documents = User::find($id)->documents;
$sum_org_movables_carrying_amount = 0;
$sum_org_value_movables_carrying_amount = 0;
$sum_org_buildings_carrying_amount = 0;
$sum_org_parcels_carrying_amount = 0;
$sum_org_movables_residual_value = 0;
$sum_org_value_movables_residual_value = 0;
$sum_org_buildings_residual_value = 0;
$sum_org_cars_carrying_amount = 0;
$sum_org_cars_residual_value = 0;
foreach ($documents as $document) {
$type = $document->os_type;
$items = Document::find($document->id)->items;
$sum_carrying_amount = 0;
$sum_residual_value = 0;
foreach ($items as $item) {
if (isset($item->carrying_amount)) {
$sum_carrying_amount = $sum_carrying_amount + $item->carrying_amount;
} else {
$sum_carrying_amount = $sum_carrying_amount;
}
if ($type != 'parcels') {
$variable = Item::find($item->id)->variable;
if (isset($variable->residual_value)) {
$sum_residual_value = $sum_residual_value + $variable->residual_value;
}
$sum_residual_value = $sum_residual_value;
}
}
$document->doc_carrying_amount = $sum_carrying_amount;
if ($type != 'parcels') {
$document->doc_residual_value = $sum_residual_value;
}
$document->save();
if ($type == 'movables') {
$sum_org_movables_carrying_amount = $sum_org_movables_carrying_amount + $document->doc_carrying_amount;
$sum_org_movables_residual_value = $sum_org_movables_residual_value + $document->doc_residual_value;
}
if ($type == 'value_movables') {
$sum_org_value_movables_carrying_amount = $sum_org_value_movables_carrying_amount + $document->doc_carrying_amount;
$sum_org_value_movables_residual_value = $sum_org_value_movables_residual_value + $document->doc_residual_value;
}
if ($type == 'cars') {
$sum_org_cars_carrying_amount = $sum_org_cars_carrying_amount + $document->doc_carrying_amount;
$sum_org_cars_residual_value = $sum_org_cars_residual_value + $document->doc_residual_value;
}
if ($type == 'buildings') {
$sum_org_buildings_carrying_amount = $sum_org_buildings_carrying_amount + $document->doc_carrying_amount;
$sum_org_buildings_residual_value = $sum_org_buildings_residual_value + $document->doc_residual_value;
}
if ($type == 'parcels') {
$sum_org_parcels_carrying_amount = $sum_org_parcels_carrying_amount + $document->doc_carrying_amount;
}
}
$organization_id = $user->organization_id;
$organization = Organization::find($organization_id);
$organization->org_movables_carrying_amount = $sum_org_movables_carrying_amount;
$organization->org_value_movables_carrying_amount = $sum_org_value_movables_carrying_amount;
$organization->org_cars_carrying_amount = $sum_org_cars_carrying_amount;
$organization->org_buildings_carrying_amount = $sum_org_buildings_carrying_amount;
$organization->org_parcels_carrying_amount = $sum_org_parcels_carrying_amount;
$organization->org_movables_residual_value = $sum_org_movables_residual_value;
$organization->org_value_movables_residual_value = $sum_org_value_movables_residual_value;
$organization->org_buildings_residual_value = $sum_org_buildings_residual_value;
$organization->org_cars_residual_value = $sum_org_cars_residual_value;
$organization->org_carrying_amount = $organization->org_movables_carrying_amount + $organization->org_value_movables_carrying_amount + $organization->org_buildings_carrying_amount + $organization->org_parcels_carrying_amount;
$organization->org_residual_value = $organization->org_movables_residual_value + $organization->org_value_movables_residual_value + $organization->org_buildings_residual_value;
$organization->save();
return Redirect::action('AdminController@getOrgDocs', [$organization_id]);
}
示例13: importCampaigns
/**
* Process the Meta table for campaign urls and create the
* campaign from the corresponding URL
*/
protected function importCampaigns()
{
$metas = \Meta::all(['prop = ?' => 'campImport']);
$users = [];
$orgs = [];
foreach ($metas as $m) {
$user = Usr::find($users, $m->propid, ['_id', 'org_id', 'email', 'meta']);
$org = \Organization::find($orgs, $user->org_id);
$categories = \Category::all(['org_id' => $org->_id], ['_id', 'name']);
$categories = array_values($categories);
$category = $categories[array_rand($categories)];
// fetch ad info foreach URL
$advert_id = $m->value['advert_id'];
$comm = $m->value['campaign'] ?? $org->meta;
if (!isset($comm['model']) || !isset($comm['rate'])) {
continue;
}
$urls = $m->value['urls'];
foreach ($urls as $url) {
$ad = \Ad::first(['org_id' => $org->_id, 'url' => $url]);
if ($ad) {
continue;
}
// already crawled URL may be due to failed cron earlier
$data = Utils::fetchCampaign($url);
$image = Utils::downloadImage($data['image']);
if (!$image) {
$image = '';
}
$ad = new \Ad(['user_id' => $advert_id, 'org_id' => $org->_id, 'title' => $data['title'], 'description' => $data['description'], 'url' => $url, 'image' => $image, 'category' => [$category->_id], 'type' => 'article', 'live' => false, 'device' => ['ALL']]);
if ($ad->validate()) {
$ad->save();
$rev = $comm['revenue'] ?? 1.25 * (double) $comm['rate'];
$commission = new \Commission(['ad_id' => $ad->_id, 'model' => $comm['model'], 'rate' => $comm['rate'], 'revenue' => round($rev, 6), 'coverage' => ['ALL']]);
$commission->save();
} else {
var_dump($ad->getErrors());
}
}
$msg = 'Campaigns imported for the user: ' . $user->email;
$this->log($msg);
$m->delete();
}
}
示例14: financials
public function financials()
{
$report = Input::get('report_type');
$date = Input::get('date');
$accounts = Account::all();
$organization = Organization::find(1);
if ($report == 'balancesheet') {
$pdf = PDF::loadView('pdf.financials.balancesheet', compact('accounts', 'date', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Balance Sheet.pdf');
}
if ($report == 'income') {
$pdf = PDF::loadView('pdf.financials.incomestatement', compact('accounts', 'date', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Income Statement.pdf');
}
if ($report == 'trialbalance') {
$pdf = PDF::loadView('pdf.financials.trialbalance', compact('accounts', 'date', 'organization'))->setPaper('a4')->setOrientation('potrait');
return $pdf->stream('Trial Balance.pdf');
}
}
示例15: array
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:
$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();