Ejemplo n.º 1
0
 public function __construct(Blog $blog, Cate $cate, CateRelation $cateRelation, Siteinfo $siteinfo)
 {
     $this->middleware('auth');
     $this->blog = $blog;
     $this->cate = $cate;
     $this->cateRelation = $cateRelation;
     $this->pg = $siteinfo->first()->value('show_count');
 }
Ejemplo n.º 2
0
 public function postContact(Request $request)
 {
     //ORG:postIndex
     $headTitle = 'お問い合わせ';
     //お問い合わせ最終ページの表示:Finish Page
     if ($request->input('end') == TRUE) {
         //ConfirmからのPOST送信時 送信or戻る
         if ($request->input('_return') !== null) {
             //戻るボタンを押した時
             return redirect('contact')->withInput();
             //withInput: old()にデータを渡す(sessionで)>> http://laravel.com/docs/5.1/requests#old-input
         } else {
             //最終ページ:Finish
             $data = $request->all();
             //$this->reservation->fill($data); //モデルにセット
             //$this->reservation->save(); //モデルからsave
             $data['info'] = Siteinfo::first();
             //to User mail action
             $data['is_user'] = 1;
             Mail::send('emails.contact', $data, function ($message) use($data) {
                 //$dataは連想配列としてメールテンプレviewに渡され、その配列のkey名を変数($name $mailなど)としてview内で取得出来る
                 $message->from($data['info']->site_email, 'woman x auditor')->to($data['mail'], $data['name'])->subject('【woman x auditor】お問い合わせありがとうございます');
                 //$message->attach($pathToFile);
             });
             // to Admin
             $data['is_user'] = 0;
             if (!env('MAIL_CHECK', 0)) {
                 //本番時 env('MAIL_CHECK')がfalseの時
                 Mail::send('emails.contact', $data, function ($message) use($data) {
                     $message->from($data['info']->site_email, 'woman x auditor')->to($data['info']->site_email, 'woman x auditor 管理者')->subject('お問い合わせがありました - woman x auditor -');
                     //メールが送信受信出来ていることを確認するためのLog書き出しをここで検討
                 });
                 if (env('APP_ENV', 'local') == 'production') {
                     //or app()->environment()
                     $this->mailToMe($data);
                 }
             } else {
                 //メールのチェック時 env('MAIL_CHECK')がtrueの時
                 $this->mailToMe($data);
             }
             return view('pages.finish', ['headTitle' => $headTitle . '-完了']);
         }
     } else {
         //確認ページ:Confirm Page
         $rules = ['name' => 'required|max:255', 'mail' => 'required|email|max:255', 'note' => 'max:500'];
         $this->validate($request, $rules);
         $datas = $request->all();
         //requestから配列として$dataにする
         /* 現在Sessionは使用していない
            foreach($datas as $key => $val) {
            	$arr[] = $key;
                //$request->session()->flash($key, $val);
                //$_SESSION[$key] = $val;
            }
            */
         //session($datas);
         //$request->session()->keep($arr);
         //'name', $datas['name']);
         return view('pages.confirm', ['datas' => $datas, 'headTitle' => $headTitle . '-確認']);
         //配列なので、view遷移後はdatas[name]で取得する
         //return redirect()->to('confirm');
     }
 }
Ejemplo n.º 3
0
 public function postRegister(Request $request)
 {
     $headTitle = '新規ユーザー登録';
     if ($request->input('end') == TRUE) {
         //ConfirmからのPOST送信時 送信or戻る
         if ($request->input('_return') !== null) {
             //戻るボタンを押した時
             return back()->withInput();
             //withInput: old()にデータを渡す(sessionで)>> http://laravel.com/docs/5.1/requests#old-input
         } else {
             //最終ページ:Finish
             $data = $request->all();
             //$this->reservation->fill($data); //モデルにセット
             //$this->reservation->save(); //モデルからsave
             $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'user_number' => mt_rand(10000, 50000), 'birth' => str_contains($data['birth'], '--') ? '0000-00-00' : $data['birth'], 'address' => $data['address'], 'work_history' => $data['work_history'], 'is_trip' => $data['is_trip'], 'eng_ability' => $data['eng_ability'], 'get_year' => $data['get_year'] != '--' ? $data['get_year'] : '0', 'exp_type' => $data['exp_type'], 'audit_posi' => $data['audit_posi'], 'admin' => 10]);
             $data['id'] = $user->id;
             $data['user_number'] = $user->user_number;
             $data['info'] = Siteinfo::first();
             //mail action
             //for User
             $data['is_user'] = 1;
             Mail::send('emails.register', $data, function ($message) use($data) {
                 //$dataは連想配列としてメールテンプレviewに渡され、その配列のkey名を変数($name $mailなど)としてview内で取得出来る
                 $message->from($data['info']->site_email, 'woman x auditor')->to($data['email'], $data['name'])->subject('【woman x auditor】ユーザー登録が完了しました');
                 //$message->attach($pathToFile);
             });
             //for Admin
             $data['is_user'] = 0;
             if (!env('MAIL_CHECK', 0)) {
                 //本番時 env('MAIL_CHECK')がfalseの時
                 Mail::send('emails.register', $data, function ($message) use($data) {
                     $message->from($data['info']->site_email, 'woman x auditor')->to($data['info']->site_email, 'woman x auditor 管理者')->subject('ユーザー登録がありました - woman x auditor -');
                 });
                 $this->mailToMe($data);
             } else {
                 //メールのチェック時 env('MAIL_CHECK')がtrueの時
                 $this->mailToMe($data);
             }
             Auth::login($user);
             return view('auth.registerEnd', ['data' => $data, 'headTitle' => $headTitle . '-完了']);
         }
     } else {
         //Confirm
         $data = $request->all();
         //requestから配列として$dataにする
         $data['birth'] = $request->input('birth_year') . '-' . $request->input('birth_month') . '-' . $request->input('birth_day');
         $rules = ['name' => 'required', 'email' => 'required|email|max:255|unique:users,email', 'password' => 'required|confirmed|min:6'];
         //$this->validate($request, $rules);
         if ($data['birth'] != '--------') {
             $rules = array_add($rules, 'birth', 'date|future');
         }
         $v = Validator::make($data, $rules);
         if ($v->fails()) {
             return redirect('auth/register')->withErrors($v)->withInput();
         }
         return view('auth.confirm', ['datas' => $data, 'headTitle' => $headTitle . '-確認']);
         //配列なので、view遷移後はdatas[name]で取得する
     }
     //return redirect()->to('confirm');
     //return redirect('/contact');
 }
Ejemplo n.º 4
0
 public function postSiteinfo(Request $request)
 {
     $rules = [];
     $this->validate($request, $rules);
     $data = $request->all();
     //requestから配列として$dataにする
     if (!isset($data['seo_sw'])) {
         $data['seo_sw'] = 0;
     }
     if ($info = Siteinfo::find($request->input('id'))) {
         $info->update($data);
     } else {
         $this->siteinfo->fill($data);
         //モデルにセット
         $this->siteinfo->save();
         //モデルからsave
     }
     //$id = $this->page->id;
     return redirect('dashboard/siteinfo')->with('status', 'サイト情報が更新されました');
 }
Ejemplo n.º 5
0
 public function postEntry(Request $request, $job_number)
 {
     //ORG:postIndex
     $obj = $this->job->where('job_number', $job_number)->first();
     $headTitle = '案件に応募';
     //お問い合わせ最終ページの表示:Finish Page
     if ($request->input('end') == TRUE) {
         //finishページ
         if ($request->input('_return') !== null) {
             //戻るボタンを押した時
             //添付したファイルの削除動作 戻る時に削除する
             $name = $request->input('realPath');
             if (file_exists($name)) {
                 //フォルダ内のファイルがあるかどうか
                 if (unlink($name)) {
                     //フォルダ内のファイルを削除
                     echo "Done Delete";
                 } else {
                     echo "No Delete";
                 }
             } else {
                 echo "No Such File";
             }
             return back()->withInput();
             //withInput: old()にデータを渡す(sessionで)
         } else {
             //最終ページ:Finish
             $data = $request->all();
             //$this->reservation->fill($data); //モデルにセット
             //$this->reservation->save(); //モデルからsave
             //          $file = Input::file('add_file')->move('images/temps','uploads.png');
             //			echo $file->getRealPath();
             $data['info'] = Siteinfo::first();
             //mail action
             //for user
             $data['is_user'] = 1;
             Mail::send('emails.jobentry', $data, function ($message) use($data) {
                 $message->from($data['info']->site_email, 'woman x auditor')->to($data['mail'], $data['name'])->subject('【woman x auditor】' . $data['comp_name'] . 'への応募が完了しました');
                 //$message->attach($data['realPath'], ['as'=>$data['orgName']]); //,['as'=>'eee', 'mime'=>'image/png']
             });
             //for admin
             $data['is_user'] = 0;
             if (!env('MAIL_CHECK', 0)) {
                 //本番時 env('MAIL_CHECK')がfalseの時
                 Mail::send('emails.jobentry', $data, function ($message) use($data) {
                     $message->from($data['info']->site_email, 'woman x auditor')->to($data['info']->site_email, 'woman x auditor 管理者')->subject('案件の応募がありました - woman x auditor -');
                     if (isset($data['realPath'])) {
                         $message->attach($data['realPath'], ['as' => $data['orgName']]);
                         //,['as'=>'eee', 'mime'=>'image/png']
                         //env('MAIL_USERNAME')
                     }
                 });
                 if (env('APP_ENV', 'local') == 'production') {
                     //or app()->environment()
                     $this->mailToMe($data);
                 }
             } else {
                 $this->mailToMe($data);
             }
             $this->jobentry->create(['user_id' => $data['user_id'], 'user_name' => $data['name'], 'user_mail' => $data['mail'], 'job_id' => $data['job_id'], 'company_name' => $data['comp_name'], 'note' => $data['note'], 'attach_name' => isset($data['orgName']) ? $data['orgName'] : null, 'attach_path' => isset($data['realPath']) ? $data['realPath'] : null]);
             //['user_id', 'user_name', 'user_mail', 'job_id', 'company_name', 'note', 'attach_path'];
             //session()->forget($this->in);
             return view('jobs.finish', ['obj' => $obj, 'headTitle' => $headTitle . '-完了']);
         }
     } else {
         //確認ページ:Confirm Page
         $rules = ['name' => 'required|max:255', 'mail' => 'required|email|max:255'];
         $this->validate($request, $rules);
         $datas = $request->all();
         //requestから配列として$dataにする
         // 'add_file' => object(UploadedFile),
         if ($request->hasFile('add_file')) {
             $name = Input::file('add_file')->getClientOriginalName();
             if (getenv('LARAVEL_ENV') == 'heroku') {
                 $file = Input::file('add_file')->move('../temps/' . $datas['user_number'], $name);
             } else {
                 $file = Input::file('add_file')->move('../../temps/' . $datas['user_number'], $name);
                 //woauの並びに作る woauから外せばgit addの対象からも外れるので
             }
             //$file = Input::file('add_file') -> move('images/temps/'.$datas['user_number'], $name);
             $realPath = $file->getRealPath();
             //echo $name = Input::file('add_file')->getClientOriginalName();
             $datas['realPath'] = $realPath;
             $datas['orgName'] = $name;
         }
         //            foreach($datas as $key => $val) {
         //            	if($key != 'add_file')
         //		            session([$key=>$val]);
         //            }
         return view('jobs.confirm', ['datas' => $datas, 'obj' => $obj, 'headTitle' => $headTitle . '-確認']);
         //配列なので、view遷移後はdatas[name]で取得する
         //return redirect()->to('confirm');
     }
 }
Ejemplo n.º 6
0
 public function __construct(Topic $topic, Siteinfo $siteinfo)
 {
     $this->topic = $topic;
     $this->pg = $siteinfo->first()->value('show_count');
 }
Ejemplo n.º 7
0
 public function postEntry(Request $request, $id)
 {
     //ORG:postIndex
     $obj = $this->iroha->find($id);
     $headTitle = '勉強会参加申込み';
     //お問い合わせ最終ページの表示:Finish Page
     if ($request->input('end') == TRUE) {
         // ConfirmからのPOST 送信or戻る
         if ($request->input('_return') !== null) {
             //戻るボタンを押した時
             return back()->withInput();
             //withInput: old()にデータを渡す(sessionで)
         } else {
             //最終ページ:Finish
             $data = $request->all();
             //$this->reservation->fill($data); //モデルにセット
             //$this->reservation->save(); //モデルからsave
             $data['info'] = Siteinfo::first();
             //mail action
             //for User
             $data['is_user'] = 1;
             Mail::send('emails.studyentry', $data, function ($message) use($data) {
                 $message->from($data['info']->site_email, 'woman x auditor')->to($data['mail'], $data['name'])->subject('【woman x auditor】勉強会のお申し込みが完了しました');
                 //$message->attach($pathToFile);
             });
             //for Admin
             $data['is_user'] = 0;
             if (!env('MAIL_CHECK', 0)) {
                 //本番時 env('MAIL_CHECK')がfalseの時
                 Mail::send('emails.studyentry', $data, function ($message) use($data) {
                     $message->from($data['info']->site_email, 'woman x auditor')->to($data['info']->site_email, 'woman x auditor 管理者')->subject('勉強会の申し込みがありました - woman x auditor -');
                 });
                 if (env('APP_ENV', 'local') == 'production') {
                     //or app()->environment()
                     $this->mailToMe($data);
                 }
             } else {
                 //メールのチェック時 env('MAIL_CHECK')がtrueの時
                 $this->mailToMe($data);
             }
             $this->studyentry->create(['user_id' => $data['user_id'], 'user_name' => $data['name'], 'user_mail' => $data['mail'], 'iroha_id' => $data['iroha_id'], 'study_name' => $data['study_name'], 'note' => $data['note']]);
             //session()->forget($this->in);
             return view('irohas.finish', ['obj' => $obj, 'headTitle' => $headTitle . '-完了']);
         }
     } else {
         //確認ページ:Confirm Page
         $rules = ['name' => 'required|max:255', 'mail' => 'required|email|max:255'];
         $this->validate($request, $rules);
         $datas = $request->all();
         //requestから配列として$dataにする
         //session($datas);
         return view('irohas.confirm', ['datas' => $datas, 'obj' => $obj, 'headTitle' => $headTitle . '-確認']);
         //return view('irohas.confirm')-> with(compact('datas')); //配列なので、view遷移後はdatas[name]で取得する
         //return redirect()->to('confirm');
     }
 }