當前位置: 首頁>>代碼示例>>PHP>>正文


PHP App::environment方法代碼示例

本文整理匯總了PHP中App\Http\Controllers\App::environment方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::environment方法的具體用法?PHP App::environment怎麽用?PHP App::environment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Http\Controllers\App的用法示例。


在下文中一共展示了App::environment方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getUser

 public function getUser()
 {
     $all = User::all();
     $env = \App::environment();
     var_dump($all, $env);
     foreach ($all as $v) {
         var_dump($env);
         var_dump($v->name);
         var_dump($v->nickname);
         var_dump($v->createTime);
         var_dump($v->updateTime);
         var_dump($v->deleteTime);
     }
     //$id = 30;
     //$user = UserService::getUserById($id);
     //$list = UserService::getList(1,10);
     //\Debugbar::info();
     //\Debugbar::error('Error!');
     //\Debugbar::warning('Watch out…');
     //\Debugbar::addMessage('Another message', 'mylabel');
     //\Debugbar::startMeasure('render','Time for rendering');
     //\Debugbar::stopMeasure('render');
     //\Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
     //echo 'ssss';
     //\Debugbar::disable();
     /*
     foreach($list  as $k=>$v){
     	   //var_dump($v['name']);
     }
     var_dump($list);
     */
 }
開發者ID:xzungshao,項目名稱:lar5-one,代碼行數:32,代碼來源:UserController.php

示例2: debug

 public function debug()
 {
     echo '<pre>';
     echo '<h1>Environment</h1>';
     echo \App::environment() . '</h1>';
     echo '<h1>Debugging?</h1>';
     if (config('app.debug')) {
         echo "Yes";
     } else {
         echo "No";
     }
     echo '<h1>Database Config</h1>';
     /*
     The following line will output your MySQL credentials.
     Uncomment it only if you're having a hard time connecting to the database and you
     need to confirm your credentials.
     When you're done debugging, comment it back out so you don't accidentally leave it
     running on your live server, making your credentials public.
     */
     //print_r(config('database.connections.mysql'));
     echo '<h1>Test Database Connection</h1>';
     try {
         $results = \DB::select('SHOW DATABASES;');
         echo '<strong style="background-color:green; padding:5px;">Connection confirmed</strong>';
         echo "<br><br>Your Databases:<br><br>";
         print_r($results);
     } catch (Exception $e) {
         echo '<strong style="background-color:crimson; padding:5px;">Caught exception: ', $e->getMessage(), "</strong>\n";
     }
     echo '</pre>';
 }
開發者ID:stiwarih,項目名稱:p4,代碼行數:31,代碼來源:HomeController.php

示例3: handleMediaUpload

 protected function handleMediaUpload($request, $inputName)
 {
     if ($request->hasFile($inputName)) {
         $upload = $request->file($inputName);
         $folderName = date('Y/m');
         $dest = 'assets/uploads/' . $folderName . '/';
         if (!file_exists($dest)) {
             mkdir($dest, 0777, TRUE);
         }
         $extension = $upload->getClientOriginalExtension();
         $mime = $upload->getMimeType();
         $filename = md5(time() . $upload->getClientOriginalName());
         $type = 'file';
         if ($mime == 'application/pdf') {
             $type = 'pdf';
         } else {
             if (strpos($mime, 'image/') !== FALSE) {
                 $type = 'image';
             }
         }
         $status = $upload->move($dest, $filename . '_o.' . $extension);
         if ($status) {
             $media = new \App\Models\Media();
             $media->type = $type;
             $media->path = $dest;
             $media->name = $filename;
             $media->ext = $extension;
             $media->third_party_type = '';
             $media->third_party_thumbnail = '';
             $media->third_party_id = '';
             $media->save();
             if ($type == 'image') {
                 // Add image to queue for processing
                 \Queue::pushOn('media-fpassets-' . \App::environment(), new \App\Commands\ProcessImage($media));
             }
             return $media;
         }
         echo 'asdf';
     }
     return null;
 }
開發者ID:joshhudnall,項目名稱:beancounter,代碼行數:41,代碼來源:Controller.php

示例4: getIndex

 public function getIndex($id = '')
 {
     if (\App::environment('local')) {
         if ($id == '') {
             $folder = Folder::where('unit_id', Auth::user()->personil->unit->id)->where('folder_induk', null)->get();
         } else {
             $folder = Folder::where('unit_id', Auth::user()->personil->unit->id)->where('folder_induk', $id)->get();
         }
         //            $breadcumb[0] = Auth::user()->personil->unit->singkatan;
         $induk = '';
         //            $i = 1;
         //           foreach($folder as $fol){
         //               TODO; breadcumb folder induk?
         //           }
         //            dd($breadcumb);
         $file = $this->getFilePengadaan($id);
         return view('folder.listing', compact('folder', 'id', 'breadcumb', 'file'));
     } else {
         return view('folder.production');
     }
 }
開發者ID:wandriputra,項目名稱:Arsip-Proyek-Integrate-with-SAP,代碼行數:21,代碼來源:folderController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @return \Illuminate\Http\Response
  */
 public function store(UserRequest $request)
 {
     // Check authorisation and throw 404 if not
     if (!Auth::user()->allowedTo('add', 'user')) {
         return view('errors/404');
     }
     $user_request = $request->except('roles');
     $user_request['password'] = bcrypt($user_request['password']);
     // encrypt password from form
     // Empty State field if rest of address fields are empty
     if (!$user_request['address'] && !$user_request['suburb'] && !$user_request['postcode']) {
         $user_request['state'] = '';
     }
     // Null email field if empty  - for unique validation
     if (!$user_request['email']) {
         $user_request['email'] = null;
     }
     // Create User
     $user = User::create($user_request);
     Toastr::success("Created new user");
     // Attach Roles
     $roles = $request->get('role_type') == 'int' ? $request->get('roles_int') : $request->get('roles_ext');
     if ($roles) {
         foreach ($roles as $role) {
             $user->attachRole($role);
         }
     }
     // Email new User
     if (\App::environment('prod')) {
         $email_list = "tara@capecod.com.au";
         $email_list = explode(';', $email_list);
         $email_list = array_map('trim', $email_list);
         // trim white spaces
         $email_user = Auth::user()->email;
         $data = ['date' => $user->created_at->format('d/m/Y g:i a'), 'username' => $user->username, 'fullname' => $user->fullname, 'company_name' => $user->company->name, 'created_by' => Auth::user()->fullname, 'site_owner' => Auth::user()->company->name];
         Mail::send('emails/new-user', $data, function ($m) use($email_list) {
             $m->from('do-not-reply@safeworksite.net');
             $m->to($email_list);
             $m->subject('New User Notification');
         });
     }
     return view('user/list');
 }
開發者ID:unclefudge,項目名稱:whs,代碼行數:48,代碼來源:UserController.php

示例6: test

 public function test(Request $request)
 {
     ClassroomSessionExcuse::truncate();
     ClassroomSessionAttendance::where('student_id', 10001)->update(['valid' => 0]);
     exit;
     $student_id = 4796;
     $order_dir = in_array($request->input('order_dir'), ['ASC', 'DESC']) ? $request->input('order_dir') : 'ASC';
     $exams = Exam::select('exams.type', 'exams.start_at', 'exams.finish_at', 'exams.name', 'exams.id')->join('subject_subjects as subsub', 'subsub.id', '=', 'exams.subject_id')->join('student_subjects as stusub', function ($j) use($student_id) {
         $j->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', $student_id)->where('stusub.state', '=', 'study');
     })->where(function ($query) use($request, $student_id) {
         $query->orWhereIn('exams.type', ['midterm', 'remidterm'])->orWhereRaw('exams.id IN (SELECT ce.exam_id FROM classrooms_exam as ce
                             JOIN classrooms as c ON c.id = ce.classroom_id
                             JOIN classroom_students as cs ON cs.classroom_id = c.id
                                 AND cs.student_id = ' . $student_id . '
                             WHERE exam_id = exams.id GROUP BY ce.id)');
         if ($request->has('finalExam')) {
             $query->orWhereIn('exams.type', ['final', 'summer', 'refinal']);
         }
     })->where('exams.semester_id', semester()->id)->where('finish_at', '>=', date('Y-m-d H:i:s'))->groupBy('exams.id')->orderBy('exams.start_at', $order_dir)->with(['questions' => function ($w) {
         $w->select('questionbank_questions.id', 'questionbank_questions.question', 'questionbank_questions.type');
         if (false) {
             $w->orderByRaw('RAND()');
         } else {
             $w->orderBy('questionbank_questions.type', 'DESC');
         }
     }, 'questions.choices' => function ($w) {
         $w->select('questionbank_choices.id', 'questionbank_choices.question_id', 'questionbank_choices.choice', 'questionbank_choices.istrue');
     }])->get();
     return $exams;
     exit;
     $specialities = Specialty::selectRaw('asp.id, asp.name, asp.short_description, asp.description, GROUP_CONCAT(adp.subject_ids) as subject_ids, COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->with('departments')->get();
     foreach ($specialities as $specialty) {
         $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/"], "", $specialty->subject_ids));
         $specialty->hours = Subject::whereIn('id', $subject_ids)->sum('hour');
         foreach ($specialty->departments as $department) {
             $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/", '/"/', "/'/"], "", $department->subject_ids));
             // var_dump($subject_ids);
             $department->subjects = Subject::whereIn('id', $subject_ids)->get();
         }
     }
     $specialities->makeHidden(['subject_ids']);
     return $specialities;
     exit;
     $status_ping_url = \App::environment('local') ? 'http://46.40.236.186:9090/DARES/public/classrooms/classrooms/status_ping' : route('classrooms.sessions.status-ping');
     $WiziqApi = new WiziqApi();
     try {
         $wiziqclassroom = WiziqClassroom::build("test", new DateTime("2016-08-10 23:55:00"))->withPresenter(20, "test teacher")->withAttendeeLimit(config("classrooms.attendee_limit"))->withReturnUrl('https://el-css.edu.om')->withDuration(10)->withExtendDuration(0)->withStatusPingUrl($status_ping_url)->withTimeZone("Asia/Muscat")->withLanguageCultureName("ar-SA")->withCreateRecording(true);
         $response = $WiziqApi->create($wiziqclassroom);
         \Log::info($response);
         exit(var_dump($response));
         $data = ['wiziq_id' => $response['class_id'], 'recording_link' => $response['recording_url'], 'presenter_link' => $response['presenter_url']];
         /** add attendees to virtual classroom */
         Log::info($response);
         if ($session->fill($data)->save() && $response) {
             $error = $this->createStudentsSessions($classroom->students, $session);
         }
     } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
         $error = 1;
     } catch (\mikemix\Wiziq\Common\Http\Exception\InvalidResponseException $e) {
         $error = 1;
     } catch (\PDOException $e) {
         $error = 1;
     }
     if ($error == 0) {
         event(new VirtualClassroomsCreated());
     } else {
         $session->wiziq_status = 'error';
         $session->save();
     }
 }
開發者ID:hisambahaa,項目名稱:DARES,代碼行數:70,代碼來源:AdminController.php


注:本文中的App\Http\Controllers\App::environment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。