Exemplo n.º 1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $knowledge = Knowledge::findOrFail($id);
     $knowledge->delete();
     Session::flash('message', 'Successfully Deleted your Data!');
     return redirect()->back();
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $this->knowledges = \App\Knowledge::orderBy('ordre')->get();
     //dd(\App\Knowledge::orderBy('ordre'));
     view()->share('knowledges', $this->knowledges);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function resourceCenter()
 {
     $resources = Knowledge::whereCategory('resource-center')->paginate(15);
     $data = ['parentPage' => 'Knowledge base', 'page' => 'Resource Center', 'title' => 'Teleaus | Resource Center Page', 'resources' => $resources];
     return view('resource-center')->with($data);
 }
Exemplo n.º 4
0
 public function gettrained($users)
 {
     //Start by destroying all current knowledge
     Knowledge::where('product_id', $this->id)->delete();
     //'age','skin_type','skin_tone','sensitive_skin','special_circumstances'
     $pure_discrete = array('skin_type', 'skin_tone', 'sensitive_skin');
     foreach ($pure_discrete as $key => $value) {
         $popular = $this->getpopularattr($users, $value);
         if ($popular == null) {
             continue;
         }
         $knowledge = new Knowledge();
         $knowledge->product_id = $this->id;
         $knowledge->key = $value;
         $knowledge->value = $popular;
         $knowledge->save();
     }
     //Working with age
     $popular = $this->getpopularattr($users, 'age');
     if (!($popular == null)) {
         $knowledge = new Knowledge();
         $knowledge->product_id = $this->id;
         if ($popular == 1) {
             $knowledge->key = 'max_age';
             $knowledge->value = 15;
             $knowledge->save();
         } elseif ($popular == 8) {
             $knowledge->key = 'min_age';
             $knowledge->value = 75;
             $knowledge->save();
         } else {
             $knowledge->key = 'min_age';
             $knowledge->value = ($popular - 2) * 10 + 15;
             $knowledge->save();
             $knowledge2 = new Knowledge();
             $knowledge2->product_id = $this->id;
             $knowledge2->key = 'max_age';
             $knowledge2->value = ($popular - 2) * 10 + 25;
             $knowledge2->save();
         }
     }
     $circuimstance_value = $this->getpopularcircumstance($users);
     if ($circuimstance_value != null) {
         $knowledge = new Knowledge();
         $knowledge->product_id = $this->id;
         $knowledge->key = 'special_circumstances';
         $knowledge->value = json_encode(array($circuimstance_value => 'true'));
         $knowledge->save();
     }
     return true;
 }