public function store($companyId, $request) { $cacheTag = ['companies', 'company' . $companyId, 'domains']; $cacheKey = 'index'; $_companies = Companies::find($companyId); if ($_companies) { if (!empty($request['domains'])) { foreach ($request['domains'] as $value) { if (strpos($value, 'localhost') !== 0) { $validator = $this->validate($value); if ($validator->fails()) { return new \Exception($validator->errors()->first()); } } if (Domains::where('domain', '=', $value)->where('company_id', '<>', $companyId)->count() > 0) { return new \Exception('O domínio ' . $value . ' já está sendo usado por outro company'); } } $_companies->domains()->delete(); foreach ($request['domains'] as $value) { Logs::create(['activity' => 'store', 'module' => 'companies_domains', 'ref' => $value]); $_companies->domains()->create(['company_id' => $companyId, 'domain' => $value]); } Cache::tags($cacheTag)->flush(); return true; } else { return true; } } else { return new \Exception("Houve um erro ao localizar registro (id not found)"); } }
private function passData($id = null) { $jobs = new \App\Models\Jobs(); if (!is_null($id)) { $jobs = Jobs::findOrNew($id); } $companyPreference = $jobs->getCompanyPreference() ? $jobs->getCompanyPreference() : new \App\Models\CompanyPreference(); $address = $jobs->address()->first() ? $jobs->address()->first() : new \App\Models\Addresses(); $commOrBon = CommisionOrBonus::all()->sortBy("Commission_Or_Bonus")->toArray(); $lns = SupportedLanguages::all()->sortBy("Language_Name")->toArray(); if (sizeof($commOrBon) == 0) { $commOrBon = new \App\Models\CommisionOrBonus(); } $tEndUser = TargetEndUser::all()->sortBy("Target_End_User")->toArray(); foreach ($commOrBon as $commisionOrBonusVal) { $commisionOrBonus[$commisionOrBonusVal["id_Commission_Or_Bonus"]] = $commisionOrBonusVal["Commission_Or_Bonus"]; } foreach ($tEndUser as $tgEndUser) { $targetEndUser[$tgEndUser["id_Target_End_User"]] = $tgEndUser["Target_End_User"]; } foreach ($lns as $langs) { $languages[$langs["id_Language"]] = $langs["Language_Name"]; } $companies = Companies::SelectOptionsModel(); $jobType = $jobs->getJobType(); $jobFamilyOptions = JobFamily::getJobsFamilyOptions(); $jobTypesOptions = JobType::getJobsTypesByJobFamilyOptions($jobType->id_Job_Family); $countryModel = $address->getCountry(); $regionsOptions = Region::getRegionsOptions(); $countryOptions = Country::getCountriesOptionsByRegion($countryModel->id_Region); return compact("companies", "commisionOrBonus", "targetEndUser", "jobFamilyOptions", "regionsOptions", "countryOptions", "languages", "jobs", "companyPreference", "address", "jobTypesOptions"); }
public function destroy($companyId, $managerId) { if (Companies::isManager($companyId)) { $data = $this->companiesManagersRepository->destroy($companyId, $managerId); return $this->jsonDataResponse($data); } else { return new \Exception('Você não tem permissão para realizar esta ação >:('); } }
public function store($companyId, Request $request) { if (Companies::isManager($companyId)) { $data = $this->companiesDomainsRepository->store($companyId, $request->all()); return $this->jsonDataResponse($data); } else { return new \Exception('Você não tem permissão para realizar esta ação >:('); } }
public function searchsubd($params) { $query = Companies::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); // load the search form data and validate if (!($this->load($params) && $this->validate())) { return $dataProvider; } return $dataProvider; }
/** * Get statistic data. * * @return Response */ public function monthStatistic($month, $year, Request $request) { $statistics = new \stdClass(); $StatisticEndDate = Carbon::create($year, $month, 1, 0, 0, 0)->addMonth(1); $StatisticStartDate = Carbon::create($year, $month, 1, 0, 0, 0); $statistics->companies = [Companies::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), Companies::whereNull("Deleted")->get()->count()]; $statistics->products = [Products::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), Products::whereNull("Deleted")->get()->count()]; $statistics->news = [News::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), News::whereNull("Deleted")->get()->count()]; $statistics->people = [People::whereNull("Deleted")->where("Date_Created", "<", $StatisticEndDate)->where("Date_Created", ">", $StatisticStartDate)->get()->count(), People::whereNull("Deleted")->get()->count()]; return json_encode($statistics); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Companies::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['company_id' => $this->company_id, 'company_created_date' => $this->company_created_date, 'company_inception' => $this->company_inception]); $query->andFilterWhere(['like', 'company_name', $this->company_name])->andFilterWhere(['like', 'company_email', $this->company_email])->andFilterWhere(['like', 'company_address', $this->company_address])->andFilterWhere(['like', 'company_status', $this->company_status]); return $dataProvider; }
public function search($input) { $query = Companies::query(); $columns = Schema::getColumnListing('companies'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }
public function actionIndex() { echo 111; $this->layout = 'register'; $user = new Users(); $model = new Companies(); if (isset($_POST['Users'])) { echo 111; die; $model->name = $_POST['Users']['name']; if ($model->save()) { $user->attributes = $_POST['Users']; $user->password = md5($_POST['Users']['password']); $user->phone = '12345567890'; $user->company_id = $model->id; $user->status = 'none'; $user->reg_date = date('Y-m-d H:m:i'); if ($user->save()) { $activated = new Activations(); $activated->setAttributes(array('type' => 'registration', 'add_data' => '', 'user_id' => $user->id, 'key' => substr(preg_replace('/[oO0Il1]/i', '', md5(rand() . rand() . rand() . time())), 0, 24), 'date' => date('Y-m-d H:m:i'))); if ($activated->save()) { Yii::$app->mailer->compose()->setFrom('*****@*****.**')->setTo('*****@*****.**')->setSubject('sfsdfsdfsdf')->setTextBody('sdfsfsdddddddddddddddddddddddddd')->send(); $login = new LoginForm(); $login->email = $_POST['Users']['email']; $login->password = $_POST['Users']['password']; echo 1111; die; if ($login->login()) { $this->render('main', ['model' => $model]); } } } } } return $this->render('registration', ['model' => $model, 'user' => $user]); }
public function destroy($companyId, $managerId) { $cacheTag = ['companies', 'company' . $companyId, 'managers']; $_company = Companies::find($companyId); if ($_company) { $_manager = $_company->managers()->select(['id'])->where('id', '=', $managerId); if ($_manager->count() > 0) { Cache::tags($cacheTag)->flush(); Logs::create(['activity' => 'destroy', 'module' => 'companies_managers', 'ref' => $managerId]); return $_company->managers()->detach($_manager->first()->id); } else { return new \Exception("Houve um erro ao localizar registro (manager not found)"); } } else { return new \Exception("Houve um erro ao localizar registro (id not found)"); } }
public function postUser() { $Company = Input::only("Title", "Address1", "Address2", "ZipCode", "City", "Phone", "Email", "CountryID"); $Inputs = Input::only("Username", "Password"); $Validator = Validator::make($Inputs, ["Username" => "required", "Password" => "required"]); $hasConnection = Storage::disk('local')->exists('instapack-connections.json'); $hasEmailSettings = Storage::disk('local')->exists('instapack-emails.json'); if ($Validator->fails() || $hasConnection == FALSE || $hasEmailSettings == FALSE) { return redirect()->route("instapack::user")->withInput()->withErrors($Validator)->with("Errormessage", "test"); } $Company["isOwn"] = 1; $Inputs["Password"] = Hash::make($Inputs["Password"]); $Data = array("Status" => "Installed", "ResultCode" => str_random(40)); $Connection = json_decode(Storage::disk('local')->get('instapack-connections.json')); $Emails = json_decode(Storage::disk('local')->get('instapack-emails.json')); $deg = new DotEnvGen(); $deg->parseExample(); $deg->setField("APP_ENV", "production"); $deg->setField("APP_DEBUG", "false"); $deg->setField("APP_KEY", $Data["ResultCode"]); $deg->setField("APP_URL", Request::root()); $deg->setField("DB_HOST", $Connection->Hostname); $deg->setField("DB_PORT", "3306"); $deg->setField("DB_DATABASE", $Connection->Database); $deg->setField("DB_USERNAME", $Connection->Username); $deg->setField("DB_PASSWORD", $Connection->Password); $deg->setField("MAIL_DRIVER", "smtp"); $deg->setField("MAIL_HOST", $Emails->Hostname); $deg->setField("MAIL_PORT", "587"); $deg->setField("MAIL_USERNAME", $Emails->Hostname); $deg->setField("MAIL_PASSWORD", $Emails->Hostname); $deg->setField("MAIL_ENCRYPTION", "null"); $deg->createEnv(base_path() . "/.env"); /* Migration and Seeds */ Artisan::call('migrate'); Artisan::call('db:seed'); Users::create($Inputs); Companies::create($Company); Storage::disk('local')->delete(['instapack-connections.json', 'instapack-emails.json']); Storage::disk('local')->put('instapack.json', $Data); return redirect("/"); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $origin = $this->getOrigin($request); config(['global.origin.current' => $origin]); config(['global.ip.current' => $request->ip()]); if ($request->company_token) { $data = Cache::tags(['companies', 'company' . $request->company_token])->remember('token', 60 * 24 * 7, function () use($request) { $_company = Companies::where('token', $request->company_token); if ($_company->count() > 0) { $_company = $_company->first(); return ['id' => $_company->id, 'name' => $_company->name, 'uri' => $_company->uri, 'active' => $_company->active, 'domains' => $_company->domains()->lists('domain')->toArray(), 'managers' => $_company->managers()->get(['id', 'name', 'email', 'active', 'role'])->toArray()]; } else { return false; } }); if (!empty($data)) { config(['global.companies.current' => $data]); } else { Cache::tags(['companies', 'company' . $request->company_token])->forget('origin'); } } return $next($request); }
private function passData($id = null) { $products = new \App\Models\Products(); if (!is_null($id)) { $products = Products::findOrNew($id); } if (!is_null($id)) { $cProducts = Products::where("id_Product", "!=", $id)->whereNull("Deleted")->orderBy('Product_Title')->get()->toArray(); $attachments = $products->attachments()->get(); $productFocusSubTypeList = $products->focusSubType()->get(); $productCompetitors = $products->competitor()->get(); } else { $cProducts = Products::whereNull("Deleted")->orderBy('Product_Title')->get()->toArray(); if (!Session::has('ProductAttachments')) { Session::set('ProductAttachments', $products->attachments()->get()); } $attachments = Session::get("ProductAttachments"); if (!Session::has('ProductFocusSubType')) { Session::set('ProductFocusSubType', $products->focusSubType()->get()); } $productFocusSubTypeList = Session::get("ProductFocusSubType"); if (!Session::has('ProductCompetitors')) { Session::set('ProductCompetitors', $products->competitor()->get()); } $productCompetitors = Session::get("ProductCompetitors"); } //dd($productFocusSubTypeList); $pFocus = ProductFocus::all(); $pfType = ProductFocusType::where("id_Product_Focus", "=", $products->id_Product_Focus ? $products->id_Product_Focus : 1)->get()->toArray(); $pfsType = ProductFocusSubType::where("id_Product_Focus_Type", "=", $products->id_Product_Focus_Type ? $products->id_Product_Focus_Type : 1)->get()->toArray(); $pPos = Positions::all()->toArray(); $competitorProducts = []; foreach ($pFocus as $prFocus) { $productFocus[$prFocus["id_Product_Focus"]] = $prFocus["Product_Focus"]; } foreach ($pfType as $prfFocus) { $productFocusType[$prfFocus["id_Product_Focus_Type"]] = $prfFocus["Product_Focus_Type"]; } foreach ($pfsType as $prfsFocus) { $productFocusSubType[$prfsFocus["id_Product_Focus_Sub_Type"]] = $prfsFocus["Product_Focus_Sub_Type"]; } foreach ($cProducts as $cpProducts) { $competitorProducts[$cpProducts["id_Product"]] = $cpProducts["Product_Title"]; } foreach ($pPos as $prPos) { $positions[$prPos["id_Position"]] = $prPos["Position_Name"]; } $Companies = Companies::SelectOptionsModel(); $TargetEndUser = TargetEndUser::CheckboxesModel(); $TargetMarket = TargetMarket::CheckboxesModel(); $AssetClass = AssetClass::CheckboxesModel(); $AvailabilityTerritory = AvailabilityTerritory::CheckboxesModel(); $TargetEndUserSelection = $products->TargetEndUserSelection(); $TargetMarketSelection = $products->TargetMarketSelection(); $ClassAssetsSelection = $products->ClassAssetsSelection(); $TerritorySelection = $products->TerritorySelection(); return compact("products", "productFocus", "productFocusType", "productFocusSubType", "Companies", "TargetMarket", "TargetEndUser", "AssetClass", "competitorProducts", "AvailabilityTerritory", "positions", "attachments", "TerritorySelection", "TargetEndUserSelection", "TargetMarketSelection", "ClassAssetsSelection", "productFocusSubTypeList", "productCompetitors"); }
/** * Finds the Companies model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Companies the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Companies::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getCompanies() { return $this->hasMany(Companies::className(), ['user_id' => 'id']); }
/** * Run the database seeds. * * @return void */ public function run() { \App\Models\Companies::create(['name' => 'Pingado Web - Agência Digital', 'uri' => 'pingadoweb.com.br', 'active' => true, 'token' => uniqid()]); \App\Models\Configurations::create(['company_id' => 1]); }
use app\models\Companies; use kartik\select2\Select2; /* @var $this yii\web\View */ /* @var $model app\models\Branches */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="branches-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), 'language' => 'en', 'options' => ['placeholder' => 'Select a company ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'branch_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'branch_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive', '' => ''], ['prompt' => '']); ?>
/** * @return \yii\db\ActiveQuery */ public function getC() { return $this->hasOne(Companies::className(), ['C_ID' => 'C_ID']); }
public function getCompany() { return $this->hasMany(Companies::className(), ['id_company' => 'id_company']); }
use yii\helpers\ArrayHelper; use app\models\Companies; use app\models\Branches; /* @var $this yii\web\View */ /* @var $model app\models\Departments */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="departments-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'companies_company_id')->dropDownList(ArrayHelper::map(Companies::find()->all(), 'company_id', 'company_name'), ['prompt' => 'Select a company..']); ?> <?php echo $form->field($model, 'branches_branch_id')->dropDownList(ArrayHelper::map(Branches::find()->all(), 'branch_id', 'branch_name'), ['prompt' => 'Select a branch..']); ?> <?php echo $form->field($model, 'department_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'department_status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive', '' => ''], ['prompt' => '']); ?>
public static function getConfigutationsByCompanyId($companyId) { $_company = Companies::find($companyId); return $_company->configurations; }
public function convertScript() { $data = 'data'; Excel::load('/storage/app/Medium1.xlsx', function ($reader) use($data) { $existsData = []; $reader->each(function ($sheet) use($existsData) { $company = $sheet->getTitle(); $companyModel = Companies::where("Company_Full_Name", "like", "%{$company}%")->first(); $rowData = $sheet->toArray(); foreach ($rowData as $row) { if (isset($row) && count($row)) { $name = isset($row['name']) ? trim($row['name']) : ""; if (!strlen($name) && in_array(strtolower($name), $existsData)) { continue; } $title = isset($row['title']) ? trim($row['title']) : ""; $description = isset($row['description']) ? trim($row['description']) : ""; // $employeeType = EmployeeType::all(["Type_Name"])->toArray(); // // $present = []; // foreach ($employeeType as $aType) { // if (!in_array($aType["Type_Name"], $present)) $present[] = strtolower($aType["Type_Name"]); // } //// echo "<pre>"; //// print_r($present); //// echo "</pre>"; // $Employee_types = []; // // $ptitle = explode(",", $title); // // foreach ($ptitle as $part) { // $title_part = trim(strtolower($part)); // if (strlen($title_part) == 0) { // continue; // } // $created = false; // foreach ($present as $item) { // $sameLatters = similar_text(strtolower($item), $title_part, $per); // if ($per < 80 && !in_array($title_part, $present)) { // $created = true; // $present[] = $title_part; // $Employee_types[] = EmployeeType::create(["Type_Name" => ucwords($title_part)]); // } // } // if (!$created) { // $Employee_types[] = EmployeeType::where("Type_Name", 'like', "%" . ucwords($title_part) . "%")->get()->first(); // } // // } // $flname = explode(" ", $name); $peopleFields = []; $addressFields = []; $employeeFields = []; $peopleFields['First_Name'] = is_array($flname) && isset($flname[0]) && strlen($flname[0]) ? $flname[0] : ""; $peopleFields['Surname'] = is_array($flname) && isset($flname[1]) && strlen($flname[1]) ? $flname[1] : ""; if (count($flname) == 3 && $description != "") { $peopleModel = People::where("Career_Description", "like", "%{$description}%")->get(); if ($peopleModel->count()) { foreach ($peopleModel as $pModel) { $peopleFields['Surname'] = is_array($flname) && isset($flname[2]) && strlen($flname[2]) ? $flname[2] : ""; $peopleFields['Middle_Name'] = is_array($flname) && isset($flname[1]) && strlen($flname[1]) ? $flname[1] : ""; echo $peopleFields['First_Name'] . " : " . $peopleFields['Middle_Name'] . " : " . $peopleFields['Surname']; $pModel->fill($peopleFields)->save(); } } } // // if ($peopleFields['First_Name'] && $peopleFields['First_Name'] || ($peopleFields['First_Name'])) { // $addressModel = Addresses::create($addressFields); // $peopleFields['Career_Description'] = $description; // $peopleFields['Date_Created'] = Carbon::now(); // $peopleFields['AddressId'] = $addressModel->AddressId; // $peopleModel = People::create($peopleFields); // if ($companyModel) { // $peopleModel->careerHistory()->save(new \App\Models\CareerHistory([ // "Position_Name" => $title, "Company_Name" => $companyModel->Company_Full_Name, // "Current_Position_Status" => 1 // ])); // } // $employeeModel = $peopleModel->employee()->create($employeeFields); // foreach ($Employee_types as $EmployeeType) { // $employeeModel->employeeType()->save($EmployeeType); // } // // } // $existsData[] = strtolower($name); } // // // Loop through all rows // $sheet->each(function($row) { // echo $row; // }); } }); }); }
public function getkycCompanyinfo() { $email = strtolower($this->request->query['email']); $kycid = $this->request->query['kycid']; if ($email == "" || $kycid == "") { return $this->render(array('json' => array('success' => 0))); } $document = Companies::find('first', array('conditions' => array('email' => $email, 'email_code' => $kycid))); $encrypt = $document['hash']; // print_r($function->decrypt($encrypt,CONNECTION_DB_KYC)); if (count($document) == 1) { if ($emails['Verify']['Score'] >= 80) { return $this->render(array('json' => array('success' => 0, 'reason' => 'Aleredy KYC complete'))); } else { return $this->render(array('json' => array('success' => 1, 'id' => $encrypt))); } } else { return $this->render(array('json' => array('success' => 0))); } }
/** * Deletes a company * * @param string $id */ public function deleteAction($id) { $companies = Companies::findFirstById($id); if (!$companies) { $this->flash->error("Company was not found"); return $this->forward("companies/index"); } if (!$companies->delete()) { foreach ($companies->getMessages() as $message) { $this->flash->error($message); } return $this->forward("companies/search"); } $this->flash->success("Company was deleted"); return $this->forward("companies/index"); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id, Request $request) { $company = Companies::findOrFail($id); $company->fill(["Deleted" => Carbon::now()])->save(); return redirect(route('admin.companies.index')); }
public function getTagsList($category) { switch ($category) { case 'Companies': return Companies::whereNull("Deleted")->orderBy('Company_Full_Name', 'asc')->get(['id_Company as id', 'Company_Full_Name as description'])->toJson(); case 'People': return People::whereNull("Deleted")->orderBy('First_Name', 'asc')->get(['id_People as id', 'First_Name as description'])->toJson(); case 'Vertical': return Vertical::all(['id_Vertical as id', 'Main_Description as description'])->toJson(); case 'Products': return Products::whereNull("Deleted")->orderBy('Product_Title', 'asc')->get(['id_Product as id', 'Product_Title as description'])->toArray(); case 'Events': return Event::all(['id_Event as id', 'Event_Title as description'])->toJson(); } }
public function destroy($id) { $cacheTag = ['companies']; if ($this->isManager($id)) { $_model = Companies::find($id); if ($_model) { Logs::create(['activity' => 'destroy', 'module' => 'companies', 'ref' => $id]); Cache::tags($cacheTag)->flush(); return $_model->delete(); } else { return new \Exception("Houve um erro ao localizar registro (id not found)"); } } else { return new \Exception('Você não tem permissão para realizar esta ação >:('); } }
/** * @return \yii\db\ActiveQuery */ public function getCompany() { return $this->hasOne(Companies::className(), ['id' => 'company_id']); }
public function verifyCompany($id = null) { $company = Companies::find('first', array('conditions' => array('hash' => $id))); if (count($company) == 0) { return $this->redirect('kyc::index'); exit; } if ($company['verify']['verified'] == "Yes") { return $this->redirect('kyc::verified'); } $image_corporation = File::find('first', array('conditions' => array('details_corporation_id' => (string) $company['_id']))); if ($image_corporation['filename'] != "") { $imagename_corporation = $image_corporation['_id'] . '_' . $image_corporation['filename']; $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_corporation; file_put_contents($path, $image_corporation->file->getBytes()); } $image_articles = File::find('first', array('conditions' => array('details_articles_id' => (string) $company['_id']))); if ($image_articles['filename'] != "") { $imagename_articles = $image_articles['_id'] . '_' . $image_articles['filename']; $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_articles; file_put_contents($path, $image_articles->file->getBytes()); } $image_resolution = File::find('first', array('conditions' => array('details_resolution_id' => (string) $company['_id']))); if ($image_resolution['filename'] != "") { $imagename_resolution = $image_resolution['_id'] . '_' . $image_resolution['filename']; $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_resolution; file_put_contents($path, $image_resolution->file->getBytes()); } $image_directors = File::find('first', array('conditions' => array('details_directors_id' => (string) $company['_id']))); if ($image_directors['filename'] != "") { $imagename_directors = $image_directors['_id'] . '_' . $image_directors['filename']; $path = LITHIUM_APP_PATH . '/webroot/documents/' . $imagename_directors; file_put_contents($path, $image_directors->file->getBytes()); } return compact('company', 'imagename_corporation', 'imagename_articles', 'imagename_resolution', 'imagename_directors'); }