public function Supplierlist() { $name = Input::get('name'); $partners = Partner::where('name', 'like', '%' . $name . '%')->where('supplier', 'Yes')->where('status', 'Active')->get(); $data = ['supplier' => $partners]; return Response::json($data, 200, array(), JSON_PRETTY_PRINT); }
public function run() { DB::table('partners')->delete(); Partner::create(['applicant_id' => 1, 'partner' => 'Pepper Potts', 'title' => 'CFO', 'location' => 'Monroe, LA', 'email' => '*****@*****.**', 'phone' => '5125551020']); Partner::create(['applicant_id' => 1, 'partner' => 'James Rhodes', 'title' => 'Colonel', 'location' => 'Norfolk, VA', 'email' => '*****@*****.**', 'phone' => '5125559999']); Partner::create(['applicant_id' => 4, 'partner' => 'Sam Wilson', 'title' => 'Falcon', 'location' => 'Washington, D.C.', 'email' => '*****@*****.**', 'phone' => '5125995599']); }
/** * * @return Response */ function anyEdit(Request $request) { $edit = DataEdit::source(new Object()); // Return to partner on create abort if ($edit->status == 'create') { $partner = Partner::find($request->get('partner_id', 0)); if ($partner instanceof Partner) { $edit->link(url("/partner/edit?show=" . $partner->id), "abbrechen", "TR")->back(); $edit->model->partner_id = $partner->id; } else { // TODO Flash Error return redirect(url('/partner')); } } else { $partner = $edit->model->partner; if ($edit->status == 'show') { $edit->link(url('/object/note?noteable_id=' . $edit->model->id), 'notiz anlegen', 'BR'); $edit->link(url("/task/edit?object_id=" . $edit->model->id), "aufgabe anlegen", "BR"); $edit->link(url("/photo/edit?object_id=" . $edit->model->id), "photo anlegen", "BR"); $edit->link(url("/partner/edit?show=" . $partner->id), (string) $partner, "TR")->back(); } else { if ($edit->status == 'modify') { $edit->link(url("/partner/edit?show=" . $partner->id), (string) $partner, "TR")->back(); $edit->link(url("/partner/edit?delete=" . $partner->id), (string) $partner, "TR"); } } } // Display only: Partner name $edit->add('dummy', 'Partner', 'text')->attributes(['readonly' => 'readonly'])->showValue((string) $partner)->updateValue((string) $partner)->insertValue((string) $partner); $edit->add('name', 'Name', 'text')->attributes(['class' => 'autofocus'])->rule('required|unique:objects,name' . $edit->status == 'modify' ? ',' . $edit->model->id : '')->insertValue($partner->shortname); $edit->add('address1', 'Strasse Nr', 'text')->rule('required')->insertValue($partner->address1); $edit->add('address2', 'PLZ Ort', 'autocomplete')->rule('required')->insertValue($partner->address2)->remote("name", "name", url('/01/ac/address2')); return $edit->view('object', compact('edit')); }
/** * Run the database seeds. * * @return void */ public function run() { Partner::firstOrCreate(['name' => "McDonalds", 'featured_image' => '/images/sample_images/hotels/1.jpg', 'type' => 'Food', 'price' => 5.99, 'description' => 'A lovely restaurant for family meals.', 'location_id' => 2, 'distance' => 20.5, 'email' => '*****@*****.**', 'logo' => '/images/sample_images/logos/mcdonalds.png', 'url' => 'http://mcdonalds.com']); Partner::firstOrCreate(['name' => "Bewleys", 'featured_image' => '/images/sample_images/hotels/2.jpg', 'type' => 'Hotel', 'price' => 64.98999999999999, 'description' => 'A fancy-schmancy hotel', 'location_id' => 2, 'distance' => 5.65, 'email' => '*****@*****.**', 'logo' => '/images/sample_images/logos/bewleys.png', 'url' => 'http://bewleys.com']); Partner::firstOrCreate(['name' => "Ramen", 'featured_image' => '/images/sample_images/hotels/3.jpg', 'type' => 'Food', 'price' => 6.0, 'description' => 'Asian street food', 'location_id' => 4, 'distance' => 89, 'email' => '*****@*****.**', 'logo' => '/images/sample_images/logos/ramen.jpg', 'url' => 'http://ramen.com']); Partner::firstOrCreate(['name' => "Rament", 'featured_image' => '/images/sample_images/hotels/3.jpg', 'type' => 'Food', 'price' => 6.0, 'description' => 'Asian street food better than Ramen', 'location_id' => 4, 'distance' => 89, 'email' => '*****@*****.**', 'logo' => '/images/sample_images/logos/rament.jpg', 'url' => 'http://rament.com']); }
public function ShowBranchProfile($id, $branchid) { $update = PartnerBranch::where('id', $branchid)->first(); $countries = Country::all(); $partnerid = Partner::find($id); return view('deskpad/updatebranch', compact('update', 'partnerid', 'countries')); }
public function ShowUpdateContacts($id, $branchid) { $updatecontact = PartnerContact::where('id', $branchid)->first(); $countries = Country::all(); $citizenships = Citizenship::all(); $partnertitles = Partnertitle::all(); $partnerid = Partner::find($id); return view('deskpad/updatecontact', compact('updatecontact', 'partnerid', 'countries', 'citizenships', 'partnertitles')); }
/** * Run the database seeds. * * @return void */ public function run() { for ($i = 1; $i <= 3; $i++) { $partner = Partner::find($i); $event = Event::find(1); $distance = LocationController::getMapsMatrixDistance($event->location, $partner->location); $event->partners()->save($partner, ['distance' => $distance]); } }
public function delete($id) { $entry = Partner::find($id); if (isset($entry)) { Partner::where('id', $id)->update(array('trash' => 1)); return \Redirect::route('partner')->with('success', $entry->title . ' deleted succesfully!'); } else { return \Redirect::route('partner')->with('error', 'Failed to delete, invalid credentials.'); } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $user = new Users(); $user->fill($request->all()); $user->password = Hash::make($request->input('password')); $user->save(); $data['partner'] = Partner::orderBy('created_at', 'asc')->get(); $data['category'] = Category::with('SubCategory')->orderBy('created_at', 'asc')->get(); return view('site.success', $data); }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Partner::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function home() { $all = Category::where('parent', '=', 0); $fullcat = Category::get(); $allarticles = Article::orderBy('id', 'desc')->take(10)->get(); $alllessons = Lesson::groupBy('categories_id')->orderBy('id', 'desc')->take(10)->get(); $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get(); $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get(); $lessons = Lesson::all(); $partners = Partner::all(); return view(proj . '.home', ['title' => trans('accueil.accueil'), 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'fullcat' => $fullcat, 'allarticles' => $allarticles, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'partners' => $partners, 'alllessons' => $alllessons])->with('lessons', $lessons); }
public function index() { $totalNumber = 5; // number of items to take for each section $data = ["events" => Event::where('end_datetime', '>', date(time()))->get()->take($totalNumber), "partners" => Partner::all()->take($totalNumber), "news" => News::all()->take($totalNumber), "media" => Media::where('processed', 0)->get()->take($totalNumber * 2)->chunk(3), "staffs" => User::where('is_staff', 1)->get(), "locations" => Location::all()->take($totalNumber)]; $i = 0; foreach ($data['events'] as $event) { $mediaCount = count(Media::where('processed', false)->where('event_id', $event->id)->get()); $data['events'][$i]->mediaCount = $mediaCount; $i++; } return View::make('admin.index')->with($data); }
/** * Run the database seeds. * * @return void */ public function run() { //$partner_id = \App\Partner::where('acronym','=','MBA')->pluck('id'); //$application_id = \App\Application::where('acronym','=','MBAGrades')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #1', 'description' => 'MBA Grades Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'MBA')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'MBAGrades')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #2', 'description' => 'MBA Grades Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'MBA')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'MBAGrades')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #3', 'description' => 'MBA Grades Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'DOC')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'DOCGrades')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #4', 'description' => 'Doctoral Grades Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'EE')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'Atlas')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #5', 'description' => 'Atlas Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'EE')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'Atlas')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #6', 'description' => 'Atlas Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'EE')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'Atlas')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #7', 'description' => 'Atlas Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'OPS')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'QuickCodes')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #8', 'description' => 'Quick Codes Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'OPS')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'QuickCodes')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #9', 'description' => 'Quick Codes Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'OPS')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'QuickCodes')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #10', 'description' => 'Quick Codes Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); $partner_id = \App\Partner::where('acronym', '=', 'OPS')->pluck('id'); $application_id = \App\Application::where('acronym', '=', 'QuickCodes')->pluck('id'); $environment_id = \App\Environment::where('name', '=', 'CEE')->pluck('id'); DB::table('runs')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Test Run #11', 'description' => 'Quick Codes Smoke Tests', 'start_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'end_date_time' => Carbon\Carbon::now()->toDateTimeString(), 'environment_id' => $environment_id]); }
/** * Действие для отображения индексной страницы */ public function index() { $partners = Partner::whereEnabled(true)->orderBy('created_at', 'DESC')->get(); $projects = Project::whereEnabled(true)->orderBy('created_at', 'DESC')->get(); return view('marketing.partners-projects.index', compact('partners', 'projects')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { // $customers = Partner::getSupplier(''); return view('purchases.create', compact('customers')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $user = Auth::user(); $partner = Partner::create(['name' => $request->name, 'email' => $request->email, 'phone' => $request->phone, 'type_id' => $request->type, 'group_id' => $user->group->id]); return redirect(url('partner')); }
public function run() { DB::table('partners')->delete(); Partner::create(['loan_id' => 1, 'partner' => 'Pepper Potts', 'title' => 'CFO', 'percent_owned' => 28, 'ssn' => '918273645', 'address' => '1 Tower Road', 'city' => 'Natural', 'state_id' => 4, 'zip' => '77631', 'email' => '*****@*****.**', 'phone' => '5125551020', 'age' => 34]); Partner::create(['loan_id' => 1, 'partner' => 'James Rhodes', 'title' => 'Colonel', 'percent_owned' => 20, 'ssn' => '991827364', 'address' => '1 Patriot Blvd', 'city' => 'Natural', 'state_id' => 4, 'zip' => '77631', 'email' => '*****@*****.**', 'phone' => '5125559999', 'age' => 44]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Partner::destroy($id); return redirect(route('admin.partners.index'))->with('success', 'Le partenaire a bien été supprimé'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $pat = Partner::dontDelete($id); if ($pat == []) { $partner = Partner::findOrFail($id); $partner->delete(); Session::flash('message', $partner->name . ' was deleted !'); return redirect()->route('partners.index'); } else { dd($pat); Session::flash('message', ' dont is possible delete the partner is linked to any product !'); return redirect()->route('partners.index'); } }
public function partnerStore(Request $request) { $input = $request->all(); $input['user_id'] = Auth::user()['id']; Partner::create($input); return redirect('/work/create/1'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $partner = Partner::findOrFail($id); try { File::delete(public_path() . '/uploads/partner/' . $partner->image); $partner->destroy($id); } catch (Exception $e) { App::abort(404); } return Redirect::route('admin.partner.show'); }
/** * 创建客户(入库) * @author AndyLee <*****@*****.**> */ public function postCompanyDetail() { /** * full_name 公司全称 * name 公司简称 * leader 法人 * registion_type 注册类型 * address 详细地址 * registed_funds 注册资本 * register_time 经营期限开始 * end_time 经营期限结束 * register_number 工商注册号 * registed_funds_type 注册资本类型 * scope 经营范围 * bookkeeper 财务负责人 一般取当前操作员 * contact 联系人 * mobile 手机 * partners 股东信息 */ $input = Input::Only('full_name', 'name', 'registion_type', 'address', 'registed_funds', 'register_time', 'end_time', 'register_number', 'scope', 'import_partners', 'bookkeeper', 'contact', 'mobile', 'partners', 'registed_funds_type', 'leader'); $rules = ['full_name' => 'required', 'name' => 'required', 'registion_type' => 'required', 'address' => 'required', 'registed_funds' => 'required', 'register_time' => 'date', 'end_time' => 'date']; $v = Validator::make($input, $rules); if ($v->fails()) { Session::flash('error', $v->messages()->first()); return Redirect::to(action('CustomerController@getCreate')); } /** * 处理注册资本 * 如"2000.818万美元"; 将返回2000 818 */ preg_match_all("/[x80-xff]+/", $input['registed_funds'], $match); $uuid = Uuid::uuid1(); $company = new Company(); $company->full_name = trim($input['full_name']); $company->user_id = Session::get('company_id'); $company->uuid = $uuid->toString(); $company->bookkeeper = Auth::user()->id; $company->name = trim($input['name']); $company->location = trim($input['address']); $company->registion_type = $input['registion_type']; $company->create_time = time(); /** * 处理公司简称首字母 */ $first_word = mb_substr($input['name'], 0, 1, 'utf-8'); $pinyin = App::make('pinyin'); $order = $pinyin->letter($first_word); $company->order = $order; if (isset($match[0][1])) { $company->registed_funds = $match[0][0] . '.' . $match[0][1]; } else { $company->registed_funds = $match[0][0]; } if (!empty($input['register_time'])) { $company->register_time = strtotime($input['register_time']); } if (!empty($input['end_time'])) { $company->end_time = strtotime($input['end_time']); } if (!empty($input['register_number'])) { $company->register_number = $input['register_number']; } if (!empty($input['scope'])) { $company->scope = $input['scope']; } if (!empty($input['leader'])) { $company->leader = $input['leader']; } if (!empty($input['registed_funds_type'])) { $company->funds_type = $input['registed_funds_type']; } else { $company->funds_type = "人民币"; } $company->operator_id = Auth::user()->id; $company->save(); /** * 如果存在联系人就加入公司联系人列表 */ if (!empty($input['contact']) and !empty($input['mobile'])) { $contact = new Contact(); $contact->company_id = $company->id; $contact->operator_id = Auth::user()->id; $contact->name = trim($input['contact']); $contact->mobile = trim($input['mobile']); $contact->is_default = 1; $contact->save(); } /** * 如果股东信息存在就加入公司股东表 */ if (!empty($input['partners']) and $input['import_partners'] == 1) { $partners = unserialize($input['partners']); /** * 循环获取股东 */ foreach ($partners as $k) { $partner = new Partner(); $partner->company_id = $company->id; $partner->operator_id = Auth::user()->id; $partner->partner_type = $k['C1'] ? $k['C1'] : '境内中国公民'; $partner->name = $k['C2']; $partner->certificate = $k['C3']; $partner->certificate_number = $k['C4'] ? $k['C4'] : ''; if ($k['RN'] === 1) { $post = '董事长'; } else { $post = '董事'; } $partner->post = $post; $partner->save(); } } /** * 初始化证照信息 */ $certs = Config::get('customer.certificate'); foreach ($certs as $k => $v) { foreach ($v as $m) { $certificate = new Certificate(); $certificate->company_id = $company->id; $certificate->operator_id = Auth::user()->id; $certificate->certificate_type = $k; $certificate->certificate_number = ''; $certificate->certificate_path = ''; // $certificate->remarks = $m; $certificate->name = $m; $certificate->save(); } } Session::flash('success', '创建客户公司完成'); return Redirect::to(action('CustomerController@getIndex')); }
function anyEdit(Request $request) { $partner = null; $object = null; $edit = DataEdit::source(new Task()); if ($edit->status == 'create') { $edit->link(url('/task'), 'abbrechen', 'TR')->back(); } if ($edit->status == 'show') { $edit->link(url('/task/note?noteable_id=' . $edit->model->id), 'notiz anlegen', 'BR'); } if ($edit->status == 'modify') { $edit->link(url('/task/edit?delete=' . $edit->model->id), 'löschen', 'TR'); } // Add Partner reference if ($request->has('partner_id')) { $partner = Partner::find($request->get('partner_id')); if ($partner instanceof Partner) { $edit->model->partner_id = $partner->id; } } else { if ($request->has('object_id')) { $object = Object::find($request->get('object_id')); if ($object instanceof Object) { $edit->model->object_id = $object->id; $edit->model->partner_id = $object->partner_id; $partner = $object->partner; } } else { $partner = $edit->model->partner; $object = $edit->model->object; } } $edit->add('name', 'Aufgabe', 'text')->attributes(['class' => 'autofocus'])->rule('required'); $edit->add('assigned_to', 'Verantwortlich', 'select')->options([null => '-- Nicht zugeordnet --'] + User::lists("name", "id")); if ($edit->status == 'create') { $edit->add('note', 'Details', 'textarea'); } else { if ($edit->status == 'modify') { $edit->add('is_finished', 'Erledigt', 'checkbox'); } else { if ($edit->status == 'show') { // Display Partner $edit->add('dummy3', 'Erledigt', 'text')->showValue($edit->model->is_finished ? 'ja' : 'nein')->attributes(['readonly' => 'readonly']); } } } $begin_at = date('Y-m-d'); $edit->add('begin_at', 'Start', 'date')->format('Y-m-d')->insertValue($begin_at)->showValue($begin_at)->rule('required'); $finish_at = date('Y-m-d', strtotime('+1 week')); $edit->add('finish_at', 'Ende', 'date')->format('Y-m-d')->insertValue($finish_at)->showValue($finish_at)->rule('required'); $duration = $edit->model->duration; $edit->add('dummy4', 'Dauer', 'text')->showValue($duration)->attributes(['readonly' => 'readonly']); $duein = $edit->model->duein; $edit->add('dummy5', 'Fällig', 'text')->showValue($duein)->attributes(['readonly' => 'readonly']); // Display Partner $edit->add('dummy1', 'Partner', 'text')->insertValue($partner ? $partner : null)->updateValue($partner ? $partner : null)->showValue($partner ? $partner : null)->attributes(['readonly' => 'readonly']); // Display Object $edit->add('dummy2', 'Standort', 'text')->insertValue($object ? $object : null)->updateValue($object ? $object : null)->showValue($object ? $object : null)->attributes(['readonly' => 'readonly']); $edit->saved(function () use($edit) { // Create a note for details if ($edit->status == 'create') { $text = isset($edit->fields['note']) ? trim($edit->fields['note']->value) : ''; if (strlen($text) > 0) { $note = new Note(['text' => $text]); $edit->model->notes()->save($note); } } }); return $edit->view('task', compact('edit')); }
/** * 编辑股东信息 * @return mixed * @param $id * @param $pid * @author AndyLee <*****@*****.**> */ public function postModifyPartner($id, $pid) { /** * partner_name 股东名称 * partner_type 股东类型 * credits 出资金额 * post 职位 * certificate 证件类型 * certificate_number 证件号码 */ $input = Input::Only('partner_name', 'partner_type', 'credits', 'post', 'certificate', 'certificate_number'); $rules = ['partner_name' => 'required', 'partner_type' => 'required|in:境内中国公民,全民所有制,有限公司,股份有限公司,外国企业,其他', 'credits' => 'numeric', 'post' => 'required|in:董事长,董事,总经理,监事', 'certificate' => 'required|in:身份证,营业执照,注册证书,港澳台胞证,其他']; $v = Validator::make($input, $rules); if ($v->fails()) { Session::flash('error', $v->messages()->first()); return Redirect::to(action('PartnerController@getModifyPartner', [Session::get('customer_id'), $pid])); } try { $record = Partner::findOrFail($pid); } catch (ModelNotFoundException $e) { Session::flash('error', '对不起,此条纪录不存在'); return Redirect::to(action('PartnerController@getPartner', Session::get('customer_id'))); } if ($record->company_id === Session::get('customer_id') || $record->operator_id === Auth::user()->id) { $record->name = $input['partner_name']; $record->credits = $input['credits']; $record->certificate = $input['certificate']; $record->certificate_number = $input['certificate_number']; $record->post = $input['post']; $record->partner_type = $input['partner_type']; $record->save(); Session::flash('success', '操作成功, 更新股东信息完成'); } else { Session::flash('error', '操作失败, 您可以没权限进行操作'); } return Redirect::to(action('PartnerController@getPartner', Session::get('customer_id'))); }
/** * Adds the suggested partner to the database using the details * returned from the Google Places API * @param $encryptedPlaceID The encrypted place ID, of the place to be added to the database */ public function addSuggestedPartner($encryptedPlaceID) { //decrypt place id $placeID = Crypt::decrypt($encryptedPlaceID); //Find from google places $result = file_get_contents('https://maps.googleapis.com/maps/api/place/details/json?placeid=' . $placeID . '&key=' . env('GOOGLE_API_KEY')); //store the location (call location.createLocationForPlace( $longitude, $latitude, $title )) $result = json_decode($result, true); $longitude = $result['result']['geometry']['location']['lng']; $latitude = $result['result']['geometry']['location']['lat']; $title = $result['result']['name']; $locationID = LocationController::createLocationForPlace($longitude, $latitude, $title); //Create new partner in db $price = 0; if (isset($result['result']['price_level'])) { $price = 5 * $result['result']['price_level']; } $url = isset($result['result']['website']) ? $result['result']['website'] : ""; $type = isset($result['result']['types'][0]) ? $result['result']['types'][0] : ""; $newData = array("name" => $title, "description" => $title, "type" => $type, "price" => $price, "location_id" => $locationID, "email" => "", "featured_image" => "/images/red-geometric-background.png", "url" => $url, "logo" => "/images/default_profile_image.png"); // Create the new partner $newPartner = Partner::create($newData); //associate partner with event //TODO }
public function showNewsDetail($slug, $id) { $data['category'] = Category::with('SubCategory')->orderBy('created_at', 'asc')->get(); $data['comment'] = Comment::where('news_id', $id)->get(); $data['slider'] = Slide::orderBy('created_at', 'asc')->get(); $data['sideslider'] = SideSlider::orderBy('created_at', 'asc')->get(); $data['news'] = News::findOrFail($id); $data['partner'] = Partner::orderBy('created_at', 'asc')->get(); $data['sideNews'] = News::orderBy('created_at', 'desc')->take(3)->skip(0)->get(); $data['album'] = Album::orderBy('created_at', 'asc')->take(12)->skip(0)->get(); $data['staff'] = Staff::orderBy('created_at', 'asc')->take(5)->skip(0)->get(); if ($slug != $data['news']->slug) { return Redirect::route('site.show.news.detail', $data['page']->slug, $id); } return view('site.news-detail', $data); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Partner::find($id)->delete(); return redirect('author/partners'); }
public static function filterAndPaginateDelete($name) { /*return \DB::table('selectPartners') ->onlyTrashed() ->where('name','like','%'.$name.'%') ->orderBy('name','ASC') ->paginate();*/ return Partner::name($name)->join('countrys', 'partners.country_id', '=', 'countrys.id')->join('citys', 'partners.city_id', '=', 'citys.id')->join('states', 'partners.state_id', '=', 'states.id')->select('partners.*', 'countrys.name as country_name', 'citys.name as city_name', 'states.name as state_name')->onlyTrashed()->orderBy('partners.name', 'ASC')->paginate(); }
use Culpa\BlameableObserver; use Culpa\CreatedBy; use Culpa\UpdatedBy; use Culpa\DeletedBy; class Partner extends Model { use LocatableTrait; use NoteableTrait; use SoftDeletes; use CreatedBy; use UpdatedBy; use DeletedBy; protected $blameable = array('created', 'updated', 'deleted'); protected $table = 'partners'; /** * */ function objects() { return $this->hasMany('App\\Object', 'partner_id'); } /** * */ function __toString() { return $this->name; } } Partner::observe(new BlameableObserver());
/** * Действие для удаления партнёра * * @param $id * @return \Illuminate\Http\RedirectResponse */ public function getDelete($id) { // Получение данных $partner = Partner::find($id); if (empty($partner)) { abort(404); } // Удаляем изображение $imagePath = public_path('assets' . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'partners' . DIRECTORY_SEPARATOR . $partner->image); if (file_exists($imagePath)) { File::delete($imagePath); } // Удаляем объект из БД $partner->delete(); return redirect()->back()->with('success', 'Партнёр успешно удален.'); }