本文整理汇总了PHP中app\Company类的典型用法代码示例。如果您正苦于以下问题:PHP Company类的具体用法?PHP Company怎么用?PHP Company使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Company类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(Request $request)
{
$input = $request->all();
// $field_name = implode('|',$input['website']['locales']);
$company = new Company();
$company->name = $input['client']['company_name'];
$company->alias = $input['website']['sub_name'];
$company->save();
$user = new User();
$user->name = $input['client']['name'];
$user->email = $input['client']['email'];
$user->password = $input['client']['password'];
$user->ip = '*';
$user->branch_id = 1;
$user->company_id = $company->id;
$user->active = 1;
$user->save();
$user->roles()->attach(Role::find(1)->id);
// $gr_fields = new GrFields;
// $gr_fields->field_name = $field_name;
// $gr_fields->company_id = $company->id;
// $gr_fields->save();
session(['input' => $input]);
return redirect('thanks');
}
示例2: profile
public function profile($id)
{
$company = new Company();
$province = new Province();
$object = $company->_getById($id);
$provinces = $province->_getAll();
return view('company.profile', compact('object', 'provinces'));
}
示例3: saveCompanyDetails
public static function saveCompanyDetails(Request $request)
{
$rules = self::getRules();
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return Redirect::to('/system/company')->withErrors($validator)->withInput()->send();
} else {
$companyDetailsContent = CompanyRepository::count();
if ($companyDetailsContent > 0) {
$companyDetails = CompanyRepository::getCompanyDetails();
if ($request->file('company_logo_name')) {
if ($companyDetails->company_logo_name != null) {
CommonTasks::deleteImage($companyDetails->company_logo_name);
}
$storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
$companyDetails->company_logo_name = $storageName;
} else {
if ($request->get('clear_check') == 'checked') {
CommonTasks::deleteImage($companyDetails->company_logo_name);
$companyDetails->company_logo_name = null;
}
}
$companyDetails->company_name = $request->get("company_name");
$companyDetails->company_description = $request->get("company_description");
$companyDetails->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
$companyDetails->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
$companyDetails->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
$companyDetails->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
$companyDetails->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
$companyDetails->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
$companyDetails->push();
Session::flash('message', 'Company Information Saved');
return Redirect::to('/system/company')->send();
} else {
$company = new Company();
$company->company_name = $request->get("company_name");
$company->company_description = $request->get("company_description");
$company->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
$company->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
$company->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
$company->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
$company->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
$company->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
if ($request->file('company_logo_name')) {
$storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
$company->company_logo_name = $storageName;
} else {
$company->company_logo_name = null;
}
$company->save();
Session::flash('message', 'Company Information Saved');
return Redirect::to('/system/company')->send();
}
}
}
示例4: edit
public function edit($id)
{
$userName = Auth::user()->name;
$companies = Company::all();
$campain = Campain::find($id);
return view('campain.edit', ['userName' => $userName, 'companies' => $companies, 'campain' => $campain]);
}
示例5: boot
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
$router->bind('article', function ($value) {
return $this->getArticle()->where('slug', $value)->firstOrFail();
});
$router->bind('cong-ty', function ($value) {
return \App\Company::where('slug', $value)->firstOrFail();
});
$router->bind('thiet-ke-thi-cong', function ($value) {
return $this->designModel->getDesigns()->where('designs.slug', $value)->firstOrFail();
});
$router->bind('house', function ($value) {
return $this->houseModel->getHouses()->where('houses.slug', $value)->firstOrFail();
});
$router->bind('company', function ($value) {
return \App\Company::where('slug', $value)->firstOrFail();
});
$router->bind('project', function ($value) {
return $this->projectModel->getProjects()->where('projects.slug', $value)->firstOrFail();
});
$router->model('owner', 'App\\House');
$router->model('agency', 'App\\House');
$router->model('message', 'App\\Message');
parent::boot($router);
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$validator = Validator::make($request->all(), ['name' => 'required|unique:papers', 'size' => 'required|unique:papers']);
if ($validator->fails()) {
if ($request->ajax()) {
return response()->json($validator->messages());
exit;
} else {
return \Redirect::back()->withErrors($validator)->withInput();
}
}
array_forget($request, "_token");
$all_request = $request->all();
$paper = new Paper();
foreach ($all_request as $key => $value) {
$paper->{$key} = $value;
}
$paper->save();
$papers = Paper::all();
if ($request->ajax()) {
if ($papers) {
foreach ($papers as $paper) {
echo "\n <tr>\n <td>{$paper->id}</td>\n <td>{$paper->name}</td>\n <td>{$paper->description}</td>\n <td>{$paper->dimension}</td>\n <td>{$paper->unit}</td>\n\n <td><button class='edtPaperLink btn-primary' cid='{$paper->id}' cname='{$paper->name}' cdescription='{$paper->description}' cdimension='{$paper->dimension}' cunit='{$paper->unit}'><span class='glyphicon glyphicon-pencil'></span></button></td>\n <td><button class='btn-danger' data-target='#myModalPaperEdit' data-toggle='modal'><span class='glyphicon glyphicon-trash'></span></button></td>\n </tr>\n ";
}
}
exit;
}
return View("settings.paper", ["companies" => Company::all(), 'papers' => $papers, 'title' => 'Job Papers Setting']);
}
示例7: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 20; $i++) {
\App\Company::create(['title' => $faker->unique()->company, 'address' => $faker->streetAddress, 'phone' => $faker->phoneNumber]);
}
}
示例8: authenticate
public function authenticate(Request $request)
{
// TODO: authenticate JWT
$credentials = $request->only('email', 'password');
// dd($request->all());
// Validate credentials
$validator = Validator::make($credentials, ['password' => 'required', 'email' => 'required']);
if ($validator->fails()) {
return response()->json(['message' => 'Invalid credentials', 'errors' => $validator->errors()->all()], 422);
}
// Get user by email
$company = Company::where('email', $credentials['email'])->first();
// Validate Company
if (!$company) {
return response()->json(['error' => 'Invalid credentials'], 422);
}
// Validate Password
if (!Hash::check($credentials['password'], $company->password)) {
return response()->json(['error' => 'Invalid credentials'], 422);
}
// Generate Token
$token = JWTAuth::fromUser($company);
// Get expiration time
$objectToken = JWTAuth::setToken($token);
$expiration = JWTAuth::decode($objectToken->getToken())->get('exp');
return response()->json(['access_token' => $token, 'token_type' => 'bearer', 'expires_in' => $expiration]);
}
示例9: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$type = $this->input('type_request');
if ($type == 0) {
return ['name' => 'required|max:255|unique:companies', 'email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'required|min:5|max:20|same:confirm_password', 'confirm_password' => 'required|min:5'];
} else {
$email = $this->input('email');
$name = $this->input('name');
$user_id = $this->input('user_id');
$company_id = $this->input('company_id');
$company = Company::findOrFail($company_id);
$user = User::findOrFail($user_id);
if ($user->email == $email) {
if ($company->name == $name) {
return ['first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
} else {
return ['name' => 'required|max:255|unique:companies', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
}
} else {
if ($company->name == $name) {
return ['email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
} else {
return ['name' => 'required|max:255|unique:companies', 'email' => 'required|email|unique:users', 'first_name' => 'required|max:255', 'last_name' => 'required|max:255', 'password' => 'min:5|max:20', 'new_password' => 'min:5|same:confirm_password'];
}
}
}
}
示例10: 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]);
}
示例11: 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');
}
示例12: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
foreach (range(1, 30) as $index) {
\App\Company::create(['name' => $faker->company()]);
}
}
示例13: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$companies = Company::all();
$accountancies = Accountancy::all();
return view('admin.accountancy.index')->with(['companies' => $companies, 'accountancies' => $accountancies]);
}
示例14: 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'));
}
示例15: store
/**
* Update the users profile
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$user = User::find($request->input('user_id'));
$user->name = $request->input('name');
$user->email = $request->input('email');
$user->username = $request->input('username');
if ($request->input('password') != '') {
$user->password = bcrypt($request->input('password'));
}
$user->update();
$company = Company::where('user_id', $request->input('user_id'))->first();
$company->name = $request->input('company_name');
$company->description = $request->input('company_description');
$company->phone = $request->input('company_phone');
$company->email = $request->input('company_email');
$company->address1 = $request->input('company_address');
$company->address2 = $request->input('company_address2');
$company->city = $request->input('company_city');
$company->postcode = $request->input('company_postcode');
if ($request->hasFile('logo')) {
$file = $request->file('logo');
$name = Str::random(25) . '.' . $file->getClientOriginalExtension();
$image = Image::make($request->file('logo')->getRealPath())->resize(210, 113, function ($constraint) {
$constraint->aspectRatio();
});
$image->save(public_path() . '/uploads/' . $name);
$company->logo = $name;
}
$company->update();
flash()->success('Success', 'Profile updated');
return back();
}