How to use plan class

Best Atoum code snippet using plan

add_publication_controller.php

Source:add_publication_controller.php Github

copy

Full Screen

...10use App\Models\type;11use App\Models\language;12use App\Models\Autors;13use App\Models\publication;14use App\Models\plan_contr;15use App\Models\fact_publ;16use App\Models\plan;17use App\Models\publisher;18use App\Http\Controllers\planing_controller;19use App\Http\Requests\add_publ_request;20class add_publication_controller extends Controller21{22 public function take_page(){23 if(Auth::check()){24 $sience_heads = Autors::where('Position', '!=' , '1')->get();25 return view('add_publication',['types' => type::all(),26 'languages' => language::all(),27 'autor' => Autors::all(),28 'sience_heads' => $sience_heads,29 'status_add' => false,30 'status_alert' => false,31 'publishers' => publisher::all()]);32 }else{33 return redirect()->route('planing');34 }35 }36 public function add_publition(add_publ_request $req){37 //year creater38 $sience_heads = Autors::where('Position', '!=' , '1')->get();39 $pubDate = new DateTime($req->pub_date);40 $controleDate = new DateTime($pubDate->format('Y') . '-08-31');41 $publ_year = $pubDate->format('Y');42 if($pubDate <= $controleDate){43 $publ_year -=1;44 }45 //dd($year_publ);46 //year crater end47 if($req->autor1 != 'null'){48 $publ = new publication();49 $publ->Publication_Name = $req->pub_name;50 if($req->ext_url != null){51 $publ->Ext_Link = $req->ext_url;52 }53 //$publ->Int_link =54 $publ->Type = $req->pub_type;55 $publ->Publication_Date = $req->pub_date;56 $publ->Language = $req->pub_lang;57 $publ->Publisher = $req->publisher;58 59 60 $publ->Issue_Number = $req->Issue_Number;61 62 if($req->start_page != null){63 $publ->Start_Page = $req->start_page;64 }65 if($req->end_page != null){66 $publ->End_Page = $req->end_page;67 }68 if($req->UPP != null){69 $publ->UPP = $req->UPP;70 }71 $publ->Autor1 = $req->autor1;72 if($req->autor2 != 'null'){73 $publ->Autor2 = $req->autor2;74 }75 if($req->autor3 != 'null'){76 $publ->Autor3 = $req->autor3;77 }78 if($req->autor4 != 'null'){79 $publ->Autor4 = $req->autor4;80 }81 if($req->autor5 != 'null'){82 $publ->Autor5 = $req->autor5;83 }84 if($req->autor6 != 'null'){85 $publ->Autor6 = $req->autor6;86 }87 if($req->autor7 != 'null'){88 $publ->Autor7 = $req->autor7;89 }90 91 $UPP = intval($req->end_page) - intval($req->start_page) + 1 ;92 $UPP = $UPP*0.1031;93 //$publ->UPP = round($UPP, 3, PHP_ROUND_HALF_UP);94 $publ->UPP = $req->upp;95 96 97 //$url = '' ;98 99 //$saved = false;100 /*$file = File::get($req->file('upload'));101 if(!Storage::disk('ftp')->exists('/files/' . $publ->Publication_Name . '.pdf')){102 Storage::disk('ftp')->put('/files/' . $publ->Publication_Name . '.pdf', $file);103 $url = Storage::disk('ftp')->url('/files/' . $publ->Publication_Name . '.pdf');104 }else{105 $i = 0;106 while($saved != true){107 if(Storage::disk('ftp')->exists('/files/' . $publ->Publication_Name . ' (' . $i . ')' . '.pdf')){108 $saved = false;109 $i++;110 }else{111 Storage::disk('ftp')->put('/files/' . $publ->Publication_Name . ' (' . $i . ')' . '.pdf', $file);112 $url = Storage::disk('ftp')->url('/files/' . $publ->Publication_Name . ' (' . $i . ')' . '.pdf');113 $saved = true;114 }115 }116 }*/117 118 //$publ->Int_link = $url;119 if($req->sience_head != "null"){120 $publ->Supervisor = $req->sience_head;121 }122 $publ->publ_id = $publ->id;123 $publ->save();124 $this_publ = publication::where('Publication_Name' , $req->pub_name)->first();125 publication::where('id', $this_publ->id)->update(array('publ_id' => $this_publ->id));126 $publ_date = new DateTime($req->pub_date); 127 $publ_year = $publ_date->format('Y');128 $control_date = new DateTime($publ_date->format('Y'). '-08-31');129 $min_year = plan::all()->min('year_start');130 if($publ_date <= $control_date){131 $publ_year -= 1;132 }133 134 if($publ_year >= $min_year ){135 if($req->autor1 != 'null'){136 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');137 $autor_pl_st = DB::table('autors')->where('id',$req->autor1)->first()->Planing_Status; 138 $plan = plan::where('id_autor' , $publ->Autor1 )->where('year_start', $publ_year)->first();139 if($autor_pl_st != false && $plan->status == false){140 if($publ->Type == 1){141 $sum = 0;142 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;143 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;144 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);145 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);146 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){147 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;148 }149 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){150 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;151 }152 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){153 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;154 }155 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){156 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;157 }158 if($sum == 0){159 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);160 }161 162 }else if($publ->Type == 2){163 $sum = 0;164 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;165 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;166 167 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);168 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);169 170 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){171 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;172 }173 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){174 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;175 }176 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){177 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;178 }179 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){180 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;181 }182 if($sum == 0){183 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);184 }185 }else if($publ->Type == 3){186 $sum = 0;187 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;188 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;189 190 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);191 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);192 193 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){194 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;195 }196 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){197 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;198 }199 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){200 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;201 }202 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){203 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;204 }205 if($sum == 0){206 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);207 }208 }else if($publ->Type == 4){209 $sum = 0;210 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;211 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;212 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);213 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);214 215 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){216 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;217 }218 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){219 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;220 }221 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){222 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;223 }224 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){225 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;226 }227 if($sum == 0){228 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);229 }230 }231 }232 }if($req->autor2 != 'null'){233 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');234 $autor_pl_st = DB::table('autors')->where('id',$req->autor2)->first()->Planing_Status; 235 $plan = plan::where('id_autor' , $publ->Autor2 )->where('year_start', $publ_year)->first();236 if($autor_pl_st != false && $plan->status == false){237 if($publ->Type == 1){238 $sum = 0;239 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;240 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;241 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);242 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);243 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){244 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;245 }246 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){247 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;248 }249 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){250 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;251 }252 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){253 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;254 }255 if($sum == 0){256 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);257 }258 259 }else if($publ->Type == 2){260 $sum = 0;261 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;262 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;263 264 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);265 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);266 267 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){268 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;269 }270 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){271 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;272 }273 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){274 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;275 }276 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){277 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;278 }279 if($sum == 0){280 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);281 }282 }else if($publ->Type == 3){283 $sum = 0;284 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;285 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;286 287 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);288 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);289 290 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){291 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;292 }293 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){294 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;295 }296 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){297 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;298 }299 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){300 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;301 }302 if($sum == 0){303 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);304 }305 }else if($publ->Type == 4){306 $sum = 0;307 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;308 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;309 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);310 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);311 312 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){313 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;314 }315 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){316 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;317 }318 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){319 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;320 }321 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){322 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;323 }324 if($sum == 0){325 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);326 }327 }328 }329 }if($req->autor3 != 'null'){330 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');331 $autor_pl_st = DB::table('autors')->where('id',$req->autor3)->first()->Planing_Status; 332 $plan = plan::where('id_autor' , $publ->Autor3 )->where('year_start', $publ_year)->first();333 if($autor_pl_st != false && $plan->status == false){334 if($publ->Type == 1){335 $sum = 0;336 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;337 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;338 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);339 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);340 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){341 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;342 }343 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){344 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;345 }346 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){347 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;348 }349 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){350 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;351 }352 if($sum == 0){353 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);354 }355 356 }else if($publ->Type == 2){357 $sum = 0;358 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;359 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;360 361 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);362 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);363 364 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){365 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;366 }367 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){368 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;369 }370 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){371 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;372 }373 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){374 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;375 }376 if($sum == 0){377 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);378 }379 }else if($publ->Type == 3){380 $sum = 0;381 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;382 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;383 384 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);385 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);386 387 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){388 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;389 }390 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){391 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;392 }393 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){394 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;395 }396 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){397 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;398 }399 if($sum == 0){400 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);401 }402 }else if($publ->Type == 4){403 $sum = 0;404 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;405 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;406 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);407 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);408 409 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){410 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;411 }412 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){413 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;414 }415 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){416 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;417 }418 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){419 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;420 }421 if($sum == 0){422 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);423 }424 }425 }426 }if($req->autor4 != 'null'){427 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');428 $autor_pl_st = DB::table('autors')->where('id',$req->autor4)->first()->Planing_Status; 429 $plan = plan::where('id_autor' , $publ->Autor4 )->where('year_start', $publ_year)->first();430 if($autor_pl_st != false && $plan->status == false){431 if($publ->Type == 1){432 $sum = 0;433 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;434 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;435 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);436 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);437 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){438 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;439 }440 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){441 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;442 }443 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){444 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;445 }446 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){447 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;448 }449 if($sum == 0){450 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);451 }452 453 }else if($publ->Type == 2){454 $sum = 0;455 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;456 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;457 458 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);459 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);460 461 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){462 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;463 }464 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){465 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;466 }467 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){468 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;469 }470 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){471 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;472 }473 if($sum == 0){474 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);475 }476 }else if($publ->Type == 3){477 $sum = 0;478 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;479 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;480 481 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);482 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);483 484 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){485 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;486 }487 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){488 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;489 }490 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){491 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;492 }493 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){494 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;495 }496 if($sum == 0){497 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);498 }499 }else if($publ->Type == 4){500 $sum = 0;501 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;502 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;503 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);504 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);505 506 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){507 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;508 }509 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){510 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;511 }512 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){513 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;514 }515 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){516 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;517 }518 if($sum == 0){519 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);520 }521 }522 }523 }if($req->autor5 != 'null'){524 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');525 $autor_pl_st = DB::table('autors')->where('id',$req->autor5)->first()->Planing_Status; 526 $plan = plan::where('id_autor' , $publ->Autor5 )->where('year_start', $publ_year)->first();527 if($autor_pl_st != false && $plan->status == false){528 if($publ->Type == 1){529 $sum = 0;530 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;531 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;532 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);533 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);534 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){535 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;536 }537 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){538 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;539 }540 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){541 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;542 }543 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){544 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;545 }546 if($sum == 0){547 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);548 }549 550 }else if($publ->Type == 2){551 $sum = 0;552 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;553 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;554 555 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);556 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);557 558 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){559 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;560 }561 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){562 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;563 }564 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){565 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;566 }567 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){568 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;569 }570 if($sum == 0){571 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);572 }573 }else if($publ->Type == 3){574 $sum = 0;575 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;576 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;577 578 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);579 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);580 581 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){582 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;583 }584 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){585 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;586 }587 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){588 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;589 }590 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){591 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;592 }593 if($sum == 0){594 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);595 }596 }else if($publ->Type == 4){597 $sum = 0;598 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;599 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;600 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);601 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);602 603 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){604 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;605 }606 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){607 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;608 }609 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){610 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;611 }612 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){613 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;614 }615 if($sum == 0){616 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);617 }618 }619 }620 }if($req->autor6 != 'null'){621 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');622 $autor_pl_st = DB::table('autors')->where('id',$req->autor6)->first()->Planing_Status; 623 $plan = plan::where('id_autor' , $publ->Autor6 )->where('year_start', $publ_year)->first();624 if($autor_pl_st != false && $plan->status == false){625 if($publ->Type == 1){626 $sum = 0;627 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;628 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;629 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);630 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);631 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){632 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;633 }634 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){635 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;636 }637 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){638 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;639 }640 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){641 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;642 }643 if($sum == 0){644 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);645 }646 647 }else if($publ->Type == 2){648 $sum = 0;649 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;650 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;651 652 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);653 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);654 655 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){656 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;657 }658 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){659 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;660 }661 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){662 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;663 }664 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){665 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;666 }667 if($sum == 0){668 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);669 }670 }else if($publ->Type == 3){671 $sum = 0;672 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;673 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;674 675 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);676 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);677 678 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){679 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;680 }681 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){682 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;683 }684 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){685 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;686 }687 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){688 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;689 }690 if($sum == 0){691 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);692 }693 }else if($publ->Type == 4){694 $sum = 0;695 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;696 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;697 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);698 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);699 700 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){701 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;702 }703 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){704 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;705 }706 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){707 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;708 }709 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){710 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;711 }712 if($sum == 0){713 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);714 }715 }716 }717 }if($req->autor7 != 'null'){718 //$publ_year = Carbon::createFromFormat('Y-m-d', $publ->Publication_Date)->format('Y');719 $autor_pl_st = DB::table('autors')->where('id',$req->autor7)->first()->Planing_Status; 720 $plan = plan::where('id_autor' , $publ->Autor7 )->where('year_start', $publ_year)->first();721 if($autor_pl_st != false && $plan->status == false){722 if($publ->Type == 1){723 $sum = 0;724 $theses = plan_contr::where('plan_id', $plan->id)->first()->theses-1;725 $theses_contr = fact_publ::where('plan_id', $plan->id)->first()->theses + 1 ;726 plan_contr::where('plan_id', $plan->id)->update(['theses' => $theses]);727 fact_publ::where('plan_id', $plan->id)->update(['theses' => $theses_contr]);728 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){729 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;730 }731 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){732 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;733 }734 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){735 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;736 }737 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){738 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;739 }740 if($sum == 0){741 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);742 }743 744 }else if($publ->Type == 2){745 $sum = 0;746 $professional_articles = plan_contr::where('plan_id', $plan->id)->first()->professional_articles-1;747 $professional_articles_contr = fact_publ::where('plan_id', $plan->id)->first()->professional_articles + 1;748 749 plan_contr::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles]);750 fact_publ::where('plan_id', $plan->id)->update(['professional_articles' => $professional_articles_contr]);751 752 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){753 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;754 }755 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){756 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;757 }758 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){759 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;760 }761 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){762 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;763 }764 if($sum == 0){765 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);766 }767 }else if($publ->Type == 3){768 $sum = 0;769 $scopus = plan_contr::where('plan_id', $plan->id)->first()->scopus-1;770 $scopus_contr = plan_contr::where('plan_id', $plan->id)->first()->scopus+1;771 772 plan_contr::where('plan_id', $plan->id)->update(['scopus' => $scopus]);773 fact_publ::where('plan_id', $plan->id)->update(['scopus' => $scopus_contr]);774 775 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){776 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;777 }778 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){779 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;780 }781 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){782 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;783 }784 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){785 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;786 }787 if($sum == 0){788 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);789 }790 }else if($publ->Type == 4){791 $sum = 0;792 $manuals = plan_contr::where('plan_id', $plan->id)->first()->manuals-1;793 $manuals_contr = plan_contr::where('plan_id', $plan->id)->first()->manuals+1;794 plan_contr::where('plan_id', $plan->id)->update(['manuals' => $manuals]);795 fact_publ::where('plan_id', $plan->id)->update(['manuals' => $manuals_contr]);796 797 if(plan_contr::where('plan_id', $plan->id)->first()->theses >= 0){798 $sum += plan_contr::where('plan_id', $plan->id)->first()->theses;799 }800 if(plan_contr::where('plan_id', $plan->id)->first()->professional_articles >= 0){801 $sum += plan_contr::where('plan_id', $plan->id)->first()->professional_articles;802 }803 if(plan_contr::where('plan_id', $plan->id)->first()->scopus >= 0){804 $sum += plan_contr::where('plan_id', $plan->id)->first()->scopus;805 }806 if(plan_contr::where('plan_id', $plan->id)->first()->manuals >= 0){807 $sum += plan_contr::where('plan_id', $plan->id)->first()->manuals;808 }809 if($sum == 0){810 plan::where('id', plan_contr::where('plan_id', $plan->id)->first()->plan_id)->update(['status' => true]);811 }812 }813 }814 }815 }816 817 818 //dd($publ_year);819 820 return view('add_publication',['types' => type::all(),821 'languages' => language::all(),822 'autor' => Autors::all(),823 'sience_heads' => $sience_heads,824 'status_add' => true,825 'status_alert' => false,826 'publishers' => publisher::all()]);827 828 }else{829 return view('add_publication',['types' => type::all(),830 'languages' => language::all(),831 'autor' => Autors::all(),832 'sience_heads' => $sience_heads,833 'status_add' => false,834 'status_alert' => true,835 'publishers' => publisher::all()]);836 } 837 }838 public function change_publ_start(Request $req){839 return view('change_publ' , ['types' => type::all(),840 'languages' => language::all(),841 'autor' => Autors::all(),842 'sience_heads' => Autors::where('Position', '!=' , '1')->get(),843 'status_alert' => false,844 'status_add' => false,845 'publishers' => publisher::all(),846 'publ' => publication::where('id', $req->publ_id)->first()]);847 }848 public function change_publ_s(Request $req){849 //$publ_old = publication::where('id', $req->id)->first();850 planing_controller::delete_publ_from_plan($req->id);851 publication::where('id', $req->id)->update(array('Publication_Name' => $req->pub_name,852 'Type' => $req->pub_type,853 'Language' => $req->pub_lang,854 'Publisher' => $req->publisher,855 'Start_Page' => $req->start_page,856 'End_Page' => $req->end_page,857 'UPP' => $req->upp,858 'Publication_Date' => $req->pub_date,859 'Issue_Number' => $req->Issue_Number,860 'Ext_Link' => $req->ext_url,861 'Autor1' => $req->autor1));862 if($req->autor2 == 'null'){863 publication::where('id', $req->id)->update(array('Autor2' => null));864 }else{865 publication::where('id', $req->id)->update(array('Autor2' =>$req->autor2));866 }867 if($req->autor3 == 'null'){868 publication::where('id', $req->id)->update(array('Autor3' => null));869 }else{870 publication::where('id', $req->id)->update(array('Autor3' =>$req->autor3));871 }872 if($req->autor4 == 'null'){873 publication::where('id', $req->id)->update(array('Autor4' => null));874 }else{875 publication::where('id', $req->id)->update(array('Autor4' =>$req->autor4));876 }877 if($req->autor5 == 'null'){878 publication::where('id', $req->id)->update(array('Autor5' => null));879 }else{880 publication::where('id', $req->id)->update(array('Autor5' =>$req->autor5));881 }882 if($req->autor6 == 'null'){883 publication::where('id', $req->id)->update(array('Autor6' => null));884 }else{885 publication::where('id', $req->id)->update(array('Autor6' =>$req->autor6));886 }887 if($req->autor7 == 'null'){888 publication::where('id', $req->id)->update(array('Autor7' => null));889 }else{890 publication::where('id', $req->id)->update(array('Autor7' =>$req->autor7));891 }892 if($req->sience_head == 'null'){893 publication::where('id', $req->id)->update(array('Supervisor' => null));894 }else{895 publication::where('id', $req->id)->update(array('Supervisor' => $req->sience_head));896 }897 planing_controller::add_publ_to_plan($req->id);898 return view('change_publ' , ['types' => type::all(),899 'languages' => language::all(),900 'autor' => Autors::all(),901 'sience_heads' => Autors::where('Position', '!=' , '1')->get(),902 'status_alert' => false,903 'status_add' => true,904 'publishers' => publisher::all(),905 'publ' => publication::where('id', $req->id)->first()]);906 }907 public function delete_publ(Request $req){908 planing_controller::delete_publ_from_plan($req->publ_id);909 $publ = publication::where('id', $req->publ_id)->first();910 $date_publ = new DateTime($publ->Publication_Date);911 $year_publ = $date_publ->format('Y');912 $check_date = new DateTime($date_publ->format('Y').'-08-31');913 if($check_date >= $date_publ){914 $year_publ-=1;915 }916 917 publication::where('id', $req->publ_id)->delete();918 return redirect('/');919 }920}...

Full Screen

Full Screen

Plan.php

Source:Plan.php Github

copy

Full Screen

...21 $this->load->library("form_validation");22 $this->form_validation->set_error_delimiters('<div class="alert alert-danger 23 style="font-size:px;" >','</div>');24 25 $this->form_validation->set_rules('plan_title', 'Plan Name', 'required');26 $this->form_validation->set_rules('plan_code', 'Plan Code', 'required');27 $this->form_validation->set_rules('plan_duration', 'Plan Duration', 'required');28 $this->form_validation->set_rules('percentage', 'Percentage', 'required');29 30 31 if($this->form_validation->run()){32 33 $this->load->model('PlanModel');34 35 $data=array('plan_title' => $this->input->post('plan_title'),36 'plan_code' => $this->input->post('plan_code'),37 'plan_duration' => $this->input->post('plan_duration'),38 'percentage' => $this->input->post('percentage'));39 40 41 42 $result =$this->PlanModel->AddPlan($data);43 if ($result == true){ 44 45 die ('<div class="alert alert-success pull-left">46 Submited successfully</div>47 <script>$("#new_plan_form")[0].reset();</script>');48 } 49 else{50 die ('Please Resubmit');51 }52 }53 else{54 echo validation_errors();55 }56 }57 58/*******Function For Updating New Plan**************/59 60 public function UpdatePlan($id){61 62 header('Access-Control-Allow-Origin:*');63 $this->load->library("form_validation");64 $this->form_validation->set_error_delimiters('<div class="alert alert-danger 65 style="font-size:px;" >','</div>');66 67 $this->form_validation->set_rules('plan_title', 'Plan Name', 'required');68 $this->form_validation->set_rules('plan_code', 'Plan Code', 'required');69 $this->form_validation->set_rules('plan_duration', 'Plan Duration', 'required');70 $this->form_validation->set_rules('percentage', 'Percentage', 'required');71 72 73 if($this->form_validation->run()){74 75 $this->load->model('PlanModel');76 77 $data=array('plan_title' => $this->input->post('plan_title'),78 'plan_code' => $this->input->post('plan_code'),79 'plan_duration' => $this->input->post('plan_duration'),80 'percentage' => $this->input->post('percentage'));81 82 83 84 $result =$this->PlanModel->UpdatePlan($data,$id);85 if ($result == true){ 86 87 die ('<div class="alert alert-success pull-left">88 Updated successfully</div>89 <script>$("#new_plan_form")[0].reset();</script>');90 } 91 else{92 die ('Please Resubmit');93 }94 }95 else{96 echo validation_errors();97 }98 }99/********Plan List*************/100 public function PlanList(){101 $this->load->view('includes/header');102 $this->load->view('includes/aside');103 $this->load->model('PlanModel');104 $data['plan_list']=$this->PlanModel->PlanList();105 $this->load->view('Plan/PlanList',$data);106 $this->load->view('includes/footer');107 }108/********Delete Plan *************/109 public function DeletePlan(){110 header('Access-Control-Allow-Origin:*');111 $this->load->model('PlanModel');112 $final= $this->PlanModel->DeletePlan($this->input->get_post('plan_id'));113 if( $final==true ){114 die('Delete Successfully');115 }116 else{117 die('Unable To Delete');118 }119 120 121 }122}123?>...

Full Screen

Full Screen

DetailPlanController.php

Source:DetailPlanController.php Github

copy

Full Screen

...6use App\Models\Plan;7use Illuminate\Http\Request;8class DetailPlanController extends Controller9{10 protected $repository, $plan;11 public function __construct(DetailPlan $detailPlan, Plan $plan)12 {13 $this->repository = $detailPlan;14 $this->plan = $plan;15 $this->middleware(['can:plans']);16 }17 public function index($urlPlan)18 {19 if (!$plan = $this->plan->where('url', $urlPlan)->first()) {20 return redirect()->back();21 }22 // $details = $plan->details();23 $details = $plan->details()->paginate();24 return view('admin.pages.plans.details.index', [25 'plan' => $plan,26 'details' => $details,27 ]);28 }29 public function create($urlPlan)30 {31 if (!$plan = $this->plan->where('url', $urlPlan)->first()) {32 return redirect()->back();33 }34 return view('admin.pages.plans.details.create', [35 'plan' => $plan,36 ]);37 }38 public function store(StoreUpdateDetailPlan $request, $urlPlan)39 {40 if (!$plan = $this->plan->where('url', $urlPlan)->first()) {41 return redirect()->back();42 }43 // $data = $request->all();44 // $data['plan_id'] = $plan->id;45 // $this->repository->create($data);46 $plan->details()->create($request->all());47 return redirect()->route('details.plan.index', $plan->url);48 }49 public function edit($urlPlan, $idDetail)50 {51 $plan = $this->plan->where('url', $urlPlan)->first();52 $detail = $this->repository->find($idDetail);53 if (!$plan || !$detail) {54 return redirect()->back();55 }56 return view('admin.pages.plans.details.edit', [57 'plan' => $plan,58 'detail' => $detail,59 ]);60 }61 public function update(StoreUpdateDetailPlan $request, $urlPlan, $idDetail)62 {63 $plan = $this->plan->where('url', $urlPlan)->first();64 $detail = $this->repository->find($idDetail);65 if (!$plan || !$detail) {66 return redirect()->back();67 }68 $detail->update($request->all());69 return redirect()->route('details.plan.index', $plan->url);70 }71 public function show($urlPlan, $idDetail)72 {73 $plan = $this->plan->where('url', $urlPlan)->first();74 $detail = $this->repository->find($idDetail);75 if (!$plan || !$detail) {76 return redirect()->back();77 }78 return view('admin.pages.plans.details.show', [79 'plan' => $plan,80 'detail' => $detail,81 ]);82 }83 public function destroy($urlPlan, $idDetail)84 {85 $plan = $this->plan->where('url', $urlPlan)->first();86 $detail = $this->repository->find($idDetail);87 if (!$plan || !$detail) {88 return redirect()->back();89 }90 $detail->delete();91 return redirect()92 ->route('details.plan.index', $plan->url)93 ->with('message', 'Registro detalado com sucesso');94 }95}...

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1use atoum\atoum;2use atoum\atoum\plan;3use atoum\atoum\plan\asserters;4use atoum\atoum\plan\asserters\adapter;5use atoum\atoum\plan\asserters\mock;6use atoum\atoum\plan\asserters\phpString;7use atoum\atoum\plan\asserters\phpClass;8use atoum\atoum\plan\asserters\phpFunction;9use atoum\atoum\plan\asserters\phpConstant;10use atoum\atoum\plan\asserters\phpVariable;11use atoum\atoum\plan\asserters\phpExtension;12use atoum\atoum\plan\asserters\phpNamespace;13use atoum\atoum\plan\asserters\phpTrait;14use atoum\atoum\plan\asserters\phpInterface;15use atoum\atoum\plan\asserters\phpMethod;16use atoum\atoum\plan\asserters\phpProperty;17use atoum\atoum\plan\asserters\phpGenerator;18use atoum\atoum\plan\asserters\phpObject;

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1require_once 'atoum/classes/plan.php';2require_once 'atoum/classes/plan.php';3require_once 'atoum/classes/plan.php';4require_once 'atoum/classes/plan.php';5require_once 'atoum/classes/plan.php';6require_once 'atoum/classes/plan.php';7require_once 'atoum/classes/plan.php';8require_once 'atoum/classes/plan.php';9require_once 'atoum/classes/plan.php';10require_once 'atoum/classes/plan.php';11require_once 'atoum/classes/plan.php';12require_once 'atoum/classes/plan.php';13require_once 'atoum/classes/plan.php';14require_once 'atoum/classes/plan.php';15require_once 'atoum/classes/plan.php';16require_once 'atoum/classes/plan.php';17require_once 'atoum/classes/plan.php';18require_once 'atoum/classes/plan.php';19require_once 'atoum/classes/plan.php';20require_once 'atoum/classes/plan.php';21require_once 'atoum/classes/plan.php';

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1use \mageekguy\atoum\reports\cobertura as coberturaReport;2use \mageekguy\atoum\writers\std as stdWriter;3$report = $script->addDefaultReport();4$writer = new stdWriter();5$report->addWriter($writer);6$coberturaReport = new coberturaReport();7$coberturaReport->addWriter(new stdWriter());8$runner->addReport($coberturaReport);9$runner->setBootstrapFile('bootstrap.php');10$runner->addTestsFromDirectory('tests/');11use \mageekguy\atoum\reports\cobertura as coberturaReport;12use \mageekguy\atoum\writers\std as stdWriter;13$report = $script->addDefaultReport();14$writer = new stdWriter();15$report->addWriter($writer);16$coberturaReport = new coberturaReport();17$coberturaReport->addWriter(new stdWriter());18$runner->addReport($coberturaReport);19$runner->setBootstrapFile('bootstrap.php');20$runner->addTestsFromDirectory('tests/');21use \mageekguy\atoum\reports\cobertura as coberturaReport;22use \mageekguy\atoum\writers\std as stdWriter;23$report = $script->addDefaultReport();24$writer = new stdWriter();25$report->addWriter($writer);26$coberturaReport = new coberturaReport();27$coberturaReport->addWriter(new stdWriter());28$runner->addReport($coberturaReport);29$runner->setBootstrapFile('bootstrap.php');30$runner->addTestsFromDirectory('tests/');31use \mageekguy\atoum\reports\cobertura as coberturaReport;32use \mageekguy\atoum\writers\std as stdWriter;33$report = $script->addDefaultReport();34$writer = new stdWriter();35$report->addWriter($writer);36$coberturaReport = new coberturaReport();37$coberturaReport->addWriter(new stdWriter());38$runner->addReport($coberturaReport);

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1$plan = new plan\plan(1);2$plan->add(2);3$plan->add(3);4$plan->add(4);5$plan->add(5);6$plan->add(6);7$plan->add(7);8$plan->add(8);9$plan->add(9);10$plan->add(10);11$plan->add(11);12$plan->add(12);13$plan->add(13);14$plan->add(14);15$plan->add(15);16$plan->add(16);17$plan->add(17);18$plan->add(18);19$plan->add(19);20$plan->add(20);21$plan->add(21);22$plan->add(22);23$plan->add(23);24$plan->add(24);25$plan->add(25);26$plan->add(26);27$plan->add(27);28$plan->add(28);29$plan->add(29);30$plan->add(30);31$plan->add(31);32$plan->add(32);33$plan->add(33);34$plan->add(34);35$plan->add(35);36$plan->add(36);37$plan->add(37);38$plan->add(38);39$plan->add(39);40$plan->add(40);41$plan->add(41);42$plan->add(42);43$plan->add(43);44$plan->add(44);45$plan->add(45);46$plan->add(46);47$plan->add(47);48$plan->add(48);49$plan->add(49);50$plan->add(50);51$plan->add(51);52$plan->add(52);53$plan->add(53);54$plan->add(54);55$plan->add(55);56$plan->add(56);57$plan->add(57);58$plan->add(58);59$plan->add(59);60$plan->add(60);61$plan->add(61);62$plan->add(62);63$plan->add(63);64$plan->add(64);65$plan->add(65);66$plan->add(66);67$plan->add(67);68$plan->add(68);69$plan->add(69);70$plan->add(70);71$plan->add(

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1$plan = new Atoum\Plan();2$plan->addTestFile('tests/1.php');3$runner->addPlan($plan);4$runner->run();5$plan = new Atoum\Plan();6$plan->addTestFile('tests/2.php');7$runner->addPlan($plan);8$runner->run();9$plan = new Atoum\Plan();10$plan->addTestFile('tests/3.php');11$runner->addPlan($plan);12$runner->run();13$plan = new Atoum\Plan();14$plan->addTestFile('tests/4.php');15$runner->addPlan($plan);16$runner->run();17$plan = new Atoum\Plan();18$plan->addTestFile('tests/5.php');19$runner->addPlan($plan);20$runner->run();21$plan = new Atoum\Plan();22$plan->addTestFile('tests/6.php');23$runner->addPlan($plan);24$runner->run();25$plan = new Atoum\Plan();26$plan->addTestFile('tests/7.php');27$runner->addPlan($plan);28$runner->run();29$plan = new Atoum\Plan();30$plan->addTestFile('tests/8.php');31$runner->addPlan($plan);32$runner->run();33$plan = new Atoum\Plan();34$plan->addTestFile('tests/9.php');35$runner->addPlan($plan);36$runner->run();37$plan = new Atoum\Plan();38$plan->addTestFile('tests/10.php');39$runner->addPlan($plan);40$runner->run();41$plan = new Atoum\Plan();42$plan->addTestFile('tests/11.php');43$runner->addPlan($plan);44$runner->run();

Full Screen

Full Screen

plan

Using AI Code Generation

copy

Full Screen

1require_once 'vendor/autoload.php';2use \Atoum\Atoum;3$plan = new Atoum\Plan();4$plan->setPlanName('Free');5$plan->setPrice(0);6$plan->setCurrency('USD');7$plan->setUsers(1);8$plan->setProjects(1);9$plan->setStorage(1);10$plan->setSubdomains(1);11$plan->setDomains(1);12$plan->setDatabases(1);13$plan->setCronjobs(1);14$plan->setEmails(1);15$plan->setFtp(1);16$plan->setSsl(1);17$plan->setPhp(1);18$plan->setMysql(1);19$plan->setPostgresql(1);20$plan->setCpanel(1);21$plan->setSoftaculous(1);22$plan->setCloudlinux(1);23$plan->setNginx(1);24$plan->setApache(1);25$plan->setLiteSpeed(1);26$plan->setRuby(1);27$plan->setPython(1);28$plan->setPerl(1);29$plan->setNodejs(1);30$plan->setRubyonrails(1);31$plan->setJava(1);32$plan->setTomcat(1);33$plan->setMemcached(1);34$plan->setRedis(1);35$plan->setGit(1);36$plan->setSvn(1);37$plan->setBackup(1);38$plan->setBackupFrequency(1);39$plan->setBackupLocation(1);40$plan->setBackupSpace(1);41$plan->setBackupRetention(1);42$plan->setBackupType(1);43$plan->setBackupTime(1);44$plan->setBackupEmail(1);45$plan->setSupport(1);46$plan->setSupportType(1);47$plan->setSupportTime(1);48$plan->setSupportEmail(1);49$plan->setSupportPhone(1);50$plan->setSupportChat(1);51$plan->setSupportTicket(1);52$plan->setSupportForum(1);53$plan->setSupportKnowledgebase(1);54$plan->setSupportTutorials(1);55$plan->setSupportVideos(1);56$plan->setSupportWebinars(1);

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful