本文整理汇总了PHP中app\Company::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::find方法的具体用法?PHP Company::find怎么用?PHP Company::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateCompany
public function updateCompany(Request $request)
{
$company = Company::find(Auth::user()->company_id);
if ($request->has('company-name')) {
$company->name = $request->input('company-name');
}
if ($request->has('address')) {
$company->address = $request->input('address');
}
if ($request->has('city')) {
$company->city = $request->input('city');
}
if ($request->has('state')) {
$company->state = $request->input('state');
}
if ($request->has('zip')) {
$company->zip = $request->input('zip');
}
if ($request->has('email')) {
$company->email = $request->input('email');
}
if ($request->has('phone')) {
$company->phone = $request->input('phone');
}
$request->session()->flash('success', 'Company Updated!');
$company->save();
$team = User::where('company_id', $company->id)->where('user_type', 2)->get();
return view('manage.company', ['company' => Company::find(Auth::user()->company_id), 'team' => $team]);
}
示例2: showSettings
public function showSettings()
{
$companies = \App\Company::all()->lists('name', 'id');
$current_company = \App\Company::find(Auth::user()->current_company);
// dd($current_company);
return view('settings.settings', compact('companies', 'current_company'));
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param int $id
*
* @return Response
*/
public function update(Request $request, $id)
{
$data = $request->except(['created_at', 'deleted_at']);
$company = Company::find($id);
$company->update($data);
return redirect()->to('wpanel/profile');
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
// $this->validate($request, $this->form_rules);
$data = ['name' => $request->input('name'), 'website_name' => $request->input('website_name'), 'slogan' => $request->input('slogan'), 'phone_number' => $request->input('phone_number'), 'cell_phone' => $request->input('cell_phone'), 'address' => $request->input('address'), 'state' => $request->input('state'), 'city' => $request->input('city'), 'facebook' => $request->input('facebook'), 'facebook_app_id' => $request->input('facebook_app_id'), 'twitter' => $request->input('twitter'), 'zip_code' => $request->input('zip_code'), 'google_maps_key_api' => $request->input('google_maps_key_api'), 'email' => $request->input('email'), 'contact_email' => $request->input('contact_email'), 'sales_email' => $request->input('sales_email'), 'support_email' => $request->input('support_email'), 'description' => $request->input('description'), 'keywords' => $request->input('keywords'), 'about_us' => $request->input('about_us'), 'refund_policy' => $request->input('refund_policy'), 'privacy_policy' => $request->input('privacy_policy'), 'terms_of_service' => $request->input('terms_of_service')];
$company = Company::find($id);
$company->update($data);
return redirect()->to('wpanel/profile');
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
$company = Company::find($id);
$data = $request->except(['_token', '_method']);
//dd($data);
$company->update($data);
return redirect()->to('company');
}
示例6: loadCompany
public static function loadCompany($id)
{
$company = Company::find($id);
if (!empty($company)) {
if (intval(Auth::id()) !== intval($company->user_id)) {
$company = null;
}
}
return $company;
}
示例7: edit
public function edit($user_id, Request $request)
{
$start_time = $request->get('start') ? date("Y-m-d", strtotime($request->get('start') . " -1 day")) : date("Y-m-d", strtotime("-1 month -1 day"));
$end_time = $request->get('end') ? date("Y-m-d", strtotime($request->get('end') . " +1 day")) : date("Y-m-d", strtotime("+1 day"));
$company_id = Auth::user()->role == "supadmin" ? $request->get('company_id') : $this->company_id[0];
$email = User::where('id', $user_id)->select('email')->pluck('email');
$currency = Company::find($company_id)->currency->title;
$data = Payment::shifts($user_id, $company_id, $start_time, $end_time);
return view('payment.shifts')->with(['data' => $data, 'currency' => $currency, 'user_email' => $email, 'user_id' => $user_id, 'user_company_id' => $company_id]);
}
示例8: getApprove
public function getApprove($id)
{
if (!$this->entrust->hasRole("super_admin")) {
return Redirect::back()->with("error", "You are Not authorized to perform This action");
}
$company = Company::find($id);
$company->status = "approved";
$company->save();
return Redirect::back()->with("success", "Company Has Been Approved successfully");
}
示例9: test_new_company_is_suspended
public function test_new_company_is_suspended()
{
$company = factory(Company::class)->create();
$this->seeInDatabase('companies', ['id' => $company->id, 'is_suspended' => true]);
$company->is_suspended = false;
$company->save();
$this->seeInDatabase('companies', ['id' => $company->id, 'is_suspended' => false]);
$companyAgain = Company::find($company->id);
$this->assertEquals(false, (bool) $companyAgain->is_suspended);
}
示例10: delete
public function delete(Request $request)
{
try {
$this->validate($request, ['id' => 'required']);
$company = Company::find($request->id);
$company->forceDelete();
return response(1, 200);
} catch (\Exception $e) {
return response(0, 400);
}
}
示例11: getEdit
public function getEdit($id)
{
$agreement = Agreement::find($id);
$company = Company::find($agreement->company_id);
$clients = $company->clients()->selectRaw('CONCAT(name, " (Cli)") name_type, id')->lists('name_type', 'id')->all();
$providers = $company->providers()->selectRaw('CONCAT(name, " (Pro)") name_type, id')->lists('name_type', 'id')->all();
$companies = $clients + $providers;
$companies_selected = $agreement->companies()->getRelatedIds()->all();
$data = array('agreement' => $agreement, 'companies' => $companies, 'companies_selected' => $companies_selected);
return view('admin.agreement.edit', $data);
}
示例12: update
public function update($id)
{
$input = \Input::all();
$v = \Validator::make($input['company'], \App\Company::$updateRules);
if ($v->fails()) {
return \Redirect::route('companies.edit', ['id' => $id])->withErrors($v->errors())->withInput();
}
$company = \App\Company::find($id);
$company->update($input['company']);
return \Redirect::route('companies.show', ['company' => $company]);
}
示例13: destroy
public function destroy($id)
{
$company = Company::find($id);
if (!$company) {
return response()->json(['message' => 'Record not found'], 404);
}
if (\Auth::user()->id != $company->id) {
return response()->json(['message' => 'You haven\'t permission to delete this entry'], 401);
}
return response()->json($company->delete(), 204);
}
示例14: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Blade::directive('hasrole', function ($expression) {
$expression = explode(',', str_replace(['(', ')', "'"], '', $expression));
return '<?php if(' . (Auth::user() && Auth::user()->hasRole($expression) ? 1 : 0) . '): ?>';
});
Blade::directive('endhasrole', function () {
return '<?php endif; ?>';
});
$table = 'company';
if (\Schema::hasTable($table)) {
$main_company = Company::find(1);
\View::share('main_company', $main_company);
}
}
示例15: boot
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$table = "company";
if (\Schema::hasTable($table)) {
$main_company = Company::find(1)->toArray();
$categories_menu = \Cache::remember('categories_mothers', 25, function () {
return Category::select('id', 'name')->childsOf('mothers')->actives()->get()->toArray();
});
$menu = [];
foreach ($categories_menu as $value) {
$menu[$value['id']] = $value;
}
\View::share('main_company', $main_company);
\View::share('categories_menu', $menu);
}
}