/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { //dd($request->all()); $issue = new Issue(array('title' => $request->get('title'), 'description' => $request->get('description'), 'language' => $request->get('language'), 'volume_id' => $request->get('volume_id'))); $issue->save(); return redirect('/issue')->with('status', 'Issue created successfully'); }
/** * Execute the console command. * * @return mixed */ public function fire() { $market = $this->argument('market'); $fileName = storage_path() . '/app/' . time() . '.xls'; file_put_contents($fileName, $this->getHtmlContent($this->argument('url'))); $reader = PHPExcel_IOFactory::createReader('Excel5'); $excel = $reader->load($fileName); $sheet = $excel->getSheet(); $i = 2; while ($sheet->getCell("A{$i}") != "") { $code = $sheet->getCell("B{$i}"); $name = $sheet->getCell("C{$i}"); $issue = Issue::where('code', $code)->first(); if (!$issue) { $issue = new Issue(); } $issue->code = $code; $issue->name = $name; $issue->market = $market; if ($issue->getOriginal() != $issue->getAttributes()) { $issue->save(); } $i++; } unlink($fileName); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { // $issue = new Issue(); //$issue = $request->all(); $issue->title = $request->get('title'); $issue->content = $request->get('content'); $issue->published_at = new DateTime(); //Carbon::now(); $issue->save(); $success = "Issue has been added!"; return view('developer.cpp.index')->with('success', $success); //echo $issue->title; //echo $issue->content; //echo $issue->published_at; }
public function upload(StoreIssuePostRequest $request) { try { $city = $this->city->firstOrCreate(['name' => Input::get('city')]); $issue = new Issue(); $issue->city_id = $city->id; $issue->email = Input::get('email'); $issue->comment = Input::get('comment'); $issue->username = Input::get('username'); $issue->status_id = Status::$OPEN; $issue->facebook_id = Input::get('facebook_id'); $issue->category_id = Input::get('category_id'); $lonlat = Input::get('lonlat'); $issue->geom = DB::raw("ST_GeomFromText('POINT({$lonlat})', 4326)"); $issue->image_path = $issue->upload(Input::file('file')); return $issue->save() ? 'Parabéns! Problema reportado.' : 'Ops, saiu algo errado... x_x'; } catch (Exception $e) { return $e->getMessage(); } }
public function createissue(Request $request) { $issue = new Issue(); $latlng = explode(",", $request->loc); $issue->lat = str_replace("(", "", $latlng[0]); $issue->lng = str_replace(")", "", $latlng[1]); $issue->user_id = $request->city_id; $issue->title = $request->title; $issue->description = $request->description; $issue->status = "N"; $issue->user_ip = $request->ip(); $issue->email = $request->email; $issue->phone = $request->phone; if ($request->file('image')) { $imageName = rand(5000, 100000) . '.png'; $request->file('image')->move(base_path() . '/public/images/issues/', $imageName); $issue->image = '/images/issues/' . $imageName; } $issue->save(); return $issue; }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $issue = new Issue(); if (!Auth::user()) { return Redirect::to(route('auth.getLogin')); } $input = Input::all(); $issue->issue_msg = $input['issue']; if (array_key_exists('phone', $input)) { $issue->phone = $input['phone']; } else { $issue->phone = ""; } if (array_key_exists('email', $input)) { $issue->email = $input['email']; } else { $issue->email = ""; } $issue->user()->associate(Auth::user()); $issue->save(); return redirect(route('home'))->withSuccess("Messaggio inviato correttamente."); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(Request $request) { // $rules = ['issueNo' => 'required', 'user_id' => 'required', 'createdDate' => 'required', 'type' => 'required', 'project_id' => 'required', 'sendDate' => 'required', 'question' => 'required']; $this->validate($request, $rules); $issue = new Issue(array('issueNo' => $request->get('issueNo'), 'createdDate' => $request->get('createdDate'), 'type' => $request->get('type'), 'status' => '等待回覆')); $project = Project::findOrFail($request->get('project_id')); $issue->project()->associate($project); $user = User::findOrFail($request->get('user_id')); $issue->user()->associate($user); $issue->save(); foreach ($request->get('sendList') as &$receiver) { if (empty($sendList)) { if ($receiver == '業務') { $target_id = $project->salesman; } elseif ($receiver == '業務主管') { $target = User::where('job', '業務主管')->firstOrFail(); $target_id = $target->id; } elseif ($receiver == '產品專員') { $target = User::where('job', '產品專員')->firstOrFail(); $target_id = $target->id; } elseif ($receiver == '總經理') { $target = User::where('job', '總經理')->firstOrFail(); $target_id = $target->id; } $sendList = $target_id; } else { if ($receiver == '業務') { $target_id = $project->salesman; } elseif ($receiver == '業務主管') { $target = User::where('job', '業務主管')->firstOrFail(); $target_id = $target->id; } elseif ($receiver == '產品專員') { $target = User::where('job', '產品專員')->firstOrFail(); $target_id = $target->id; } elseif ($receiver == '總經理') { $target = User::where('job', '總經理')->firstOrFail(); $target_id = $target->id; } $sendList = $sendList . "|" . $target_id; } } $question = new Question(array('question' => $request->get('question'), 'sendDate' => $request->get('sendDate'), 'type' => $request->get('type'), 'sendList' => $sendList, 'status' => '等待回覆')); $question->issue()->associate($issue); $sender = User::find(\Auth::id()); $question->sender()->associate($sender); $question->save(); Mail::send('emails.issueSend', ['user' => $user], function ($m) use($user) { $m->to($user->email, $user->name)->subject('Your issue has been forwarded!'); }); return \Redirect::to('issue/index')->with('message', 'Your Issue has been created!'); }
public function postIssue(Request $request) { $issue = new Issue($request->input()); $issue->save(); return redirect('/issue/add-issue'); }