/** * Execute the console command. * * @return mixed */ public function fire() { echo "\n| This command will fake a whole lot of pet data! It will create\n"; echo "| as many pet records as you specify, and then associate five\n"; echo "| random pictures in /public/img/uploads with each new pet\n\n"; echo "How many pets would you like to fake?\n> "; $n = intval($this->ask('')); echo "working..."; //get size, user, and species ids $species_ids = []; $size_ids = []; $user_ids = []; Species::all()->each(function ($species) use(&$species_ids) { $species_ids[] = $species->id; }); Size::all()->each(function ($size) use(&$size_ids) { $size_ids[] = $size->id; }); User::all()->each(function ($user) use(&$user_ids) { $user_ids[] = $user->id; }); $names = ['fido', 'fluffy', 'muffins', 'whiskers', 'benji', 'kitty']; $colors = ['white', 'brown', 'black', 'calico', 'grey']; $descriptions = ['Use lap as chair. I am the best pooping rainbow while flying in a toasted bread costume in space lick yarn hanging out of own butt and stare at wall turn and meow stare at wall some more meow again continue staring . Stare at ceiling light eat grass, throw it back up, yet make meme, make cute face. Eat and than sleep on your face climb leg, so has closed eyes but still sees you. Hunt by meowing loudly at 5am next to human slave food dispenser drink water out of the faucet hide at bottom of staircase to trip human chew iPad power cord poop in litter box, scratch the walls yet fall over dead (not really but gets sypathy). Poop in the plant pot lick plastic bags. Sniff other cat\'s butt and hang jaw half open thereafter intently sniff hand get video posted to internet for chasing red dot attack feet, yet immediately regret falling into bathtub but run in circles. I am the best knock over christmas tree hunt anything that moves. Eat a plant, kill a hand. Sweet beast thug cat . Meow all night having their mate disturbing sleeping humans flop over, so ears back wide eyed. Please stop looking at your phone and pet me behind the couch claw drapes, eat from dog\'s food asdflkjaertvlkjasntvkjn (sits on keyboard). Pee in the shoe human is washing you why halp oh the horror flee scratch hiss bite.', 'Poop in litter box, scratch the walls refuse to drink water except out of someone\'s glass or leave dead animals as gifts, and put toy mouse in food bowl run out of litter box at full speed . Run in circles intently stare at the same spot. Lounge in doorway. Walk on car leaving trail of paw prints on hood and windshield cat snacks. Refuse to drink water except out of someone\'s glass pelt around the house and up and down stairs chasing phantoms eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap, so if it smells like fish eat as much as you wish or the dog smells bad. Leave hair everywhere meowzer! so chew iPad power cord, and poop on grasses yet sleep on dog bed, force dog to sleep on floor. Stare at wall turn and meow stare at wall some more meow again continue staring touch water with paw then recoil in horror spread kitty litter all over house but all of a sudden cat goes crazy chase laser instantly break out into full speed gallop across the house for no reason. Cat is love, cat is life. Sweet beast destroy the blinds pee in human\'s bed until he cleans the litter box, stare at wall turn and meow stare at wall some more meow again continue staring yet brown cats with pink ears and curl into a furry donut. Jump around on couch, meow constantly until given food, sit in box. Hide from vacuum cleaner human give me attention meow but has closed eyes but still sees you. Bathe private parts with tongue then lick owner\'s face lick butt love to play with owner\'s hair tie but poop in the plant pot for inspect anything brought into the house find something else more interesting. Mark territory mark territory stare out the window, but leave hair everywhere claws in your leg and get video posted to internet for chasing red dot. When in doubt, wash spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce but hunt by meowing loudly at 5am next to human slave food dispenser. Meow for food, then when human fills food dish, take a few bites of food and continue meowing jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed hack up furballs. Eat and than sleep on your face pelt around the house and up and down stairs chasing phantoms but touch water with paw then recoil in horror meow chase mice. I like big cats and i can not lie meowing non stop for food, tuxedo cats always looking dapper or hack up furballs asdflkjaertvlkjasntvkjn (sits on keyboard). Mark territory attack the dog then pretend like nothing happened shake treat bag, rub face on everything, for damn that dog . Get video posted to internet for chasing red dot sniff other cat\'s butt and hang jaw half open thereafter unwrap toilet paper i like big cats and i can not lie yet present belly, scratch hand when stroked, so poop on grasses chew foot. Meow paw at beetle and eat it before it gets away, eat from dog\'s food sun bathe, but scratch leg; meow for can opener to feed me but spit up on light gray carpet instead of adjacent linoleum and the dog smells bad. Leave hair everywhere kitty power! , human is washing you why halp oh the horror flee scratch hiss bite hide from vacuum cleaner meow all night having their mate disturbing sleeping humans. Mark territory spread kitty litter all over house play riveting piece on synthesizer keyboard thug cat . Hopped up on catnip purr while eating but scream at teh bath, make meme, make cute face or lick plastic bags yet spit up on light gray carpet instead of adjacent linoleum. Hide head under blanket so no one can see.', 'Eat from dog\'s food. Paw at beetle and eat it before it gets away play time, yet meow chase ball of string has closed eyes but still sees you hide when guests come over, and have secret plans. White cat sleeps on a black shirt stretch destroy couch as revenge. Leave hair everywhere put toy mouse in food bowl run out of litter box at full speed but asdflkjaertvlkjasntvkjn (sits on keyboard) ears back wide eyed yet my left donut is missing, as is my right asdflkjaertvlkjasntvkjn (sits on keyboard), or stare at ceiling. Vommit food and eat it again sun bathe intently sniff hand, fall over dead (not really but gets sypathy) paw at beetle and eat it before it gets away, for meow under the bed.']; $status = ['lost', 'found', 'adoptable']; $age = ['baby', 'young', 'adult', 'senior']; $gender = ['male', 'female', 'unknown']; $a_num = ['342335', '234567', '234412', '123123', '123345', '345345']; $breeds = ['doberman', 'short hair', 'long hair', 'husky']; $images = explode("\n", trim(`ls public/img/uploads`)); for ($i = 0; $i < $n; $i++) { if ($i % 10 == 0) { echo '.'; } $pet = new Pet(); $pet->name = $names[array_rand($names)]; $pet->species_id = $species_ids[array_rand($species_ids)]; $pet->status = $status[array_rand($status)]; $pet->color = $colors[array_rand($colors)]; $pet->age = $age[array_rand($age)]; $pet->description = $descriptions[array_rand($descriptions)]; $pet->gender = $gender[array_rand($gender)]; $pet->a_num = $a_num[array_rand($a_num)]; $pet->breed = $breeds[array_rand($breeds)]; $pet->size_id = $size_ids[array_rand($size_ids)]; $pet->user_id = $user_ids[array_rand($user_ids)]; $pet->save(); for ($j = 0; $j < 5; $j++) { $img = new Image(); $img->pet_id = $pet->id; $img->img_path = '/img/uploads/' . $images[array_rand($images)]; $img->save(); } } echo "\n"; $this->info('pets created!'); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Pet(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Pet'])) { $model->attributes = $_POST['Pet']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function savePet() { $pet = ['name' => Input::get('name')]; $rules = ['name' => 'required']; $valid = Validator::make($pet, $rules); if ($valid->passes()) { $pet = new Pet($pet); $pet->save(); if (!empty(Input::get('services'))) { $pet->services()->sync(Input::get('services')); } return Redirect::to('/pets')->with('success', 'Pet is saved!'); } else { return Redirect::back()->withErrors($valid)->withInput(); } }
/** * Change a pet's color to the paintbrush's color (if available). * * Changes the pet's pet_specie_color_id and destroys the item. * * If a pet doesn't have the specific color built out in * pet_specie_pet_specie_color, a failure message will be shown and the * item will not be destroyed. * * @param Pet $pet * @return string The success (or failure) message. **/ public function paint(Pet $pet) { $color = new PetSpecie_PetSpecieColor($this->db); $color = $color->findOneBy(array('pet_specie_id' => $pet->getPetSpecieId(), 'pet_specie_color_id' => $this->getPetSpecieColorId())); // It's possible that that particular color is not built out for // that species (ie, nobody f*****g drew it). Handle that. if ($color == null) { return "You put the brush down, realizing that this color is not available for your pet."; } elseif ($pet->getPetSpecieColorId() == $color->getPetSpecieColorId()) { return "You frown and notice that {$pet->getPetName()} is already painted in {$color->getColorName()}."; } $pet->setPetSpecieColorId($color->getPetSpecieColorId()); $pet->save(); $this->updateQuantity($this->getQuantity() - 1); return "{$pet->getPetName()} looks snazzy in <strong>{$color->getColorName()}</strong>!"; }
/** * Execute the console command. * * @return mixed */ public function fire() { echo "\n--- Lets create some pet postings! ---\n\n"; echo "| This will create a new pet record with the prompted information,\n"; echo "| a random status, age, and color, and user, species, and breed\n"; echo "| ids that belong to the first record of each in the database.\n\n"; echo "| This command will also get a list of the files in /img/uploads\n"; echo "| and select one at random from the list to create a new image\n"; echo "| object and record to tie to the pet object we just created.\n\n"; echo "name \n> "; $name = $this->ask(''); echo "color\n> "; $color = $this->ask(''); echo "description\n> "; $description = $this->ask(''); $species = ['cat', 'dog', 'other']; $species = $species[array_rand($species)]; $status = ['lost', 'found', 'adoptable']; $status = $status[array_rand($status)]; $age = ['baby', 'young', 'adult', 'senior']; $age = $age[array_rand($age)]; $gender = ['male', 'female', 'unknown']; $gender = $gender[array_rand($gender)]; $a_num = ['342335', '234567', '234412', '123123', '123345', '345345']; $a_num = $a_num[array_rand($a_num)]; $pet = new Pet(); $pet->name = $name; $pet->species_id = Species::first()->id; $pet->status = $status; $pet->color = $color; $pet->age = $age; $pet->description = $description; $pet->gender = $gender; $pet->a_num = $a_num; $pet->breed_id = Breed::first()->id; $pet->user_id = User::first()->id; $pet->save(); $images = explode("\n", trim(`ls public/img/uploads`)); $petImg = $images[array_rand($images)]; $img = new Image(); $img->pet_id = $pet->id; $img->img_path = "/img/uploads/{$petImg}"; $img->save(); $this->info('pet created!'); }
/** * Store a newly created pet in storage. * * @return Response */ public function store() { $data = Input::all(); $validator = Validator::make($data, Pet::$rules); $response = []; $response['input'] = $data; if ($validator->fails()) { $response['success'] = false; $response['errors'] = $validator->messages(); return Response::json($response); } $response['success'] = true; $response['errors'] = []; $pet = new Pet($data); $pet->save(); $response['pet'] = $pet; return Response::json($response); }
/** * Process the upload of an image * @return type string response page */ public static function upload() { $error = array('status' => 0, 'msg' => ''); $post = Core\Input::post(); //var_dump($post); //exit; $files = Core\Input::files(); $imageType = $files["fileToUpload"]['type']; $fileName = $files["fileToUpload"]['name']; $imageSize = $files["fileToUpload"]['size']; $target_dir = GROUP_UPLOAD_PATH . '/'; $target_file = $target_dir . $fileName; // the full path we want the image uploaded to $imageFileType = pathinfo($target_file, PATHINFO_EXTENSION); // extension and path info if (isset($post["submit"]) && $error['status'] === 0 && !empty($files["fileToUpload"]["tmp_name"])) { $check = getimagesize($files["fileToUpload"]["tmp_name"]); // image dimensions and other data if ($check !== false) { // File is an image if (file_exists($target_file)) { // File with at target path already exists, try to create a new unique target path $name = explode('.', $fileName); if ($name !== false) { $fileName = $name[0] . '_' . time() . '.' . $imageFileType; $target_file = $target_dir . $fileName; } else { $fileName = microtime() . '.' . $imageFileType; $target_file = $target_dir . $fileName; } } if (!file_exists($target_file)) { // File does not exist on target path, yet // Check file size if ($files["fileToUpload"]["size"] > 10000000) { // 10mb max $error['status'] = 1; $error['msg'] = "Sorry, the file is too large."; } else { // Allow certain file formats if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { $error['status'] = 1; $error['msg'] = "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; } else { if (move_uploaded_file($files["fileToUpload"]["tmp_name"], $target_file)) { // move uploaded file from temporary directory to target path // Get new dimensions list($width_orig, $height_orig) = getimagesize($target_file); $width_lrg = $width_orig; $height_lrg = $height_orig; $target_file_lrg_name = $fileName; $target_file_lrg = $target_dir . $target_file_lrg_name; // Resample uploaded image switch ($imageFileType) { case 'jpeg': $image = imagecreatefromjpeg($target_file); break; case 'jpg': $image = imagecreatefromjpeg($target_file); break; case 'png': $image = imagecreatefrompng($target_file); break; case 'gif': $image = imagecreatefromgif($target_file); break; default: die("Image not supported"); } $name = explode('.', $fileName); $width_med = $width_orig * 0.75; $height_med = $height_orig * 0.75; /* $rgba = imagecolorat($image, 0, 0); $alpha = ($rgba & 0x7F000000) >> 24; */ $image_med = imagecreatetruecolor($width_med, $height_med); // create a black background if ($imageFileType === 'png') { imagesavealpha($image_med, true); $trans_colour = imagecolorallocatealpha($image_med, 0, 0, 0, 127); imagefill($image_med, 0, 0, $trans_colour); } imagecopyresampled($image_med, $image, 0, 0, 0, 0, $width_med, $height_med, $width_orig, $height_orig); // overlay resampled image $size = '_' . round($width_med) . 'x' . round($height_med); $name = isset($name[0]) ? $name[0] : microtime(); $target_file_med_name = $name . $size . '.' . $imageFileType; $target_file_med = $target_dir . $target_file_med_name; $width_sm = $width_orig * 0.5; $height_sm = $height_orig * 0.5; $image_sm = imagecreatetruecolor($width_sm, $height_sm); if ($imageFileType === 'png') { imagesavealpha($image_sm, true); $trans_colour = imagecolorallocatealpha($image_sm, 0, 0, 0, 127); imagefill($image_sm, 0, 0, $trans_colour); } imagecopyresampled($image_sm, $image, 0, 0, 0, 0, $width_sm, $height_sm, $width_orig, $height_orig); $size = '_' . round($width_sm) . 'x' . round($height_sm); $target_file_sm_name = $name . $size . '.' . $imageFileType; $target_file_sm = $target_dir . $target_file_sm_name; // Capture image data ob_start(); switch ($imageFileType) { case 'jpeg': imagejpeg($image_med); break; case 'jpg': imagejpeg($image_med); break; case 'png': imagepng($image_med); break; case 'gif': imagejpeg($image_med); break; default: die("Image not supported"); } $med = ob_get_contents(); ob_end_clean(); ob_start(); switch ($imageFileType) { case 'jpeg': imagejpeg($image_sm); break; case 'jpg': imagejpeg($image_sm); break; case 'png': imagepng($image_sm); break; case 'gif': imagejpeg($image_sm); break; default: die("Image not supported"); } $sm = ob_get_contents(); ob_end_clean(); // Write image data to local files //$bytesWrittenLrg = file_put_contents($target_file_lrg, $lrg); $bytesWrittenMed = file_put_contents($target_file_med, $med); $bytesWrittenSm = file_put_contents($target_file_sm, $sm); // JSON structure to store thumbnail data $thumbnails = array('med' => array('dimensions' => '', 'fileName' => ''), 'sm' => array('dimensions' => '', 'fileName' => '')); $thumbnails['med']['dimensions'] = $bytesWrittenMed > 0 ? $width_med . 'x' . $height_med : ''; $thumbnails['sm']['dimensions'] = $bytesWrittenSm > 0 ? $width_sm . 'x' . $height_sm : ''; $thumbnails['med']['fileName'] = $bytesWrittenMed > 0 ? $target_file_med_name : ''; $thumbnails['sm']['fileName'] = $bytesWrittenSm > 0 ? $target_file_sm_name : ''; $thumbnailsJSON = json_encode($thumbnails); //var_dump($json); //exit; $petName = isset($post['petName']) ? trim($post['petName']) : ''; $description = isset($post['petDescription']) ? trim($post['petDescription']) : ''; $petSpecialNeeds = isset($post['petSpecialNeeds']) ? trim($post['petSpecialNeeds']) : ''; $weight = isset($post['weight']) && $post['weight'] !== '' ? trim($post['weight']) : 'DEFAULT'; $species = isset($post['species']) ? $post['species'] : ''; $breed = isset($post['breed']) ? $post['breed'] : 'DEFAULT'; $age = isset($post['age']) && $post['age'] !== '' ? trim($post['age']) : "DEFAULT"; $sex = isset($post['sex']) && $post['sex'] !== '' ? $post['sex'] : 'none'; if (!isset($_SESSION['user'])) { throw new Exception("User must be logged in to post a pet for adoption"); } $userId = $_SESSION['user']; $adoptionId = ''; $created = time(); $updated = time(); $visibility = 'y'; $approved = 0; $pet = new Pet($petName, $description, $petSpecialNeeds, $weight, $species, $breed, $age, $sex, $userId, $adoptionId, $created, $updated, $visibility, $approved); $petTableRowId = $pet->save(); //exit; if ($petTableRowId === false) { // log errors $msg = Core\Db::getErrorMessage(); //error_log("\n" . date('Y-m-d H:i:s', time()) . ": " . $msg, 3, LOG_PATH . '/mysql_error_log'); throw new Exception($msg); } // Create Image object, which creates a record in the DB of its class members $petId = 'pet:' . $petTableRowId; $newImage = new Image('', '', $fileName, $imageType, $imageSize, $width_orig, $height_orig, $thumbnailsJSON, $petId); $imageTableRowId = $newImage->save(); if ($imageTableRowId === false) { // log errors $msg = Core\Db::getErrorMessage(); //error_log("\n" . date('Y-m-d H:i:s', time()) . ": " . $msg, 3, LOG_PATH . '/mysql_error_log'); throw new Exception($msg); } imagedestroy($image); // free up resources } else { $error['status'] = 1; $error['msg'] = "Sorry, there was an error uploading your file."; } } } } else { $msg = "The file {$fileName} already exists. "; $error['status'] = 1; $error['msg'] = $msg; } } else { $msg = "Failed to calculate image metadata"; $error['status'] = 1; $error['msg'] = $msg; } } if ($error['status'] === 1) { return self::index(array('error' => $error['msg'])); } return self::myPets(); }
$session->message("There was an issue: " . $database->last_error); redirect_head(current_url()); } //get the key, and associate it to the image record $default_image->image_wk = $database->insert_id(); //now we move the file and save $default_image->move_file(); //if the image changed, set it if ($default_image) { $new_pet->image_wk = $default_image->image_wk; } } else { $new_pet->image_wk = 0; } // insert the new pet into the database if ($new_pet->save()) { initiate_watch_list($database->insert_id(), "added"); $session->message($new_pet->name . " has been successfully added! "); $new_pet_wk = $database->insert_id(); } else { $session->message("The new pet cannot be added at this time. "); } //do the vaccinations if there are some being set if (count($_POST['vaccination']) > 0) { // add appropriate vaccinations to the pet $sql = "INSERT INTO `pet_to_vaccination` (`pet_to_vaccination_wk`, `pet_wk`, `vaccination_wk`, `create_dt`) VALUES "; $vacs = ""; foreach ($_POST["vaccination"] as $vac) { $vacs["{$vac}"] = "(NULL, '" . $new_pet_wk . "', '" . $vac . "', CURRENT_TIMESTAMP)"; } $all_vacs = implode(",", $vacs);
$ERRORS[] = 'Invalid color specified.'; } } // end pet exists if (sizeof($ERRORS) > 0) { draw_errors($ERRORS); } else { // Add pet. $pet = new Pet($db); $pet->setUserId($User->getUserId()); $pet->setPetSpecieId($specie->getPetSpecieId()); $pet->setPetSpecieColorId($color->getPetSpecieColorId()); $pet->setPetName($pet_name); $pet->setHunger($specie->getMaxHunger()); $pet->setHappiness($specie->getMaxHappiness()); $pet->setCreatedAt($pet->sysdate()); $pet->save(); // If the user has no other pets, make this the active one. if (sizeof($User->grabPets()) == 0) { $pet->makeActive(); } // Session mog $_SESSION['hilight_pet_id'] = $pet->getUserPetId(); // Redirect redirect('pets'); } // end no errors; DO IT break; // end spawn } // end state switch
public function run() { $pet2 = new Pet(); $pet2->name = 'Sheba'; $pet2->status = 'available'; $pet2->color = 'mixed'; $pet2->age = 'adult'; $pet2->description = 'Hello! My name is Sheba, & I\'m a 3 year old cattle dog/lab mix. My last humans didn\'t take very good care of me, so the city took me away from them. Since they didn\'t love me enough to keep me healthy, I am heart worm positive and have a slight kennel cough. But don\'t worry! My amazing foster parents have started me on medications, & soon I\'ll be good as new! I dream every night about my new family. I really need a human that loves to play fetch and play outdoors as much as I do! I am very good at going potty outside and have exceptional inside manners. Most of all, I have so much love to give! I am silly, energetic, and despite my past, have such a good heart. Will you please open up yours and give me a chance? -Sheba'; $pet2->gender = 'Female'; $pet2->breed = 'Australian Cattle Dog/Blue Heeler / Labrador Retriever / Mixed (short coat)'; $pet2->user_id = User::first()->id; $pet2->species_id = '1'; $pet2->size_id = '2'; $pet2->a_num = 'A364168'; $pet2->save(); $pet2_img1 = new Image(); $pet2_img1->img_path = 'img/petimg/sheba1.png'; $pet2_img1->pet_id = $pet2->id; $pet2_img1->save(); $pet2_img2 = new Image(); $pet2_img2->img_path = 'img/petimg/sheba2.jpg'; $pet2_img2->pet_id = $pet2->id; $pet2_img2->save(); $pet3 = new Pet(); $pet3->name = 'Maribel'; $pet3->status = 'available'; $pet3->color = 'Tan and White'; $pet3->age = 'adult'; $pet3->description = 'Maribel is a very sweet, and loving gentle giant. She loves to be the center of attention. Maribel loves to play fetch, knows sit and stay. She gets along great with other dogs and likes to play with kids. Her favorite time of the day is Dinnertime :) Sweet Maribel has been through a lot in her short life, but despite it all she\'s still very loving and happy. She will make a great addition to any family!'; $pet3->gender = 'Female'; $pet3->breed = 'American Pit Bull Terrier (short coat)'; $pet3->user_id = User::first()->id; $pet3->species_id = '1'; $pet3->size_id = '3'; $pet3->a_num = 'A364378'; $pet3->save(); $pet3_img1 = new Image(); $pet3_img1->img_path = 'img/petimg/maribel1.jpg'; $pet3_img1->pet_id = $pet3->id; $pet3_img1->save(); $pet3_img2 = new Image(); $pet3_img2->img_path = 'img/petimg/maribel2.jpg'; $pet3_img2->pet_id = $pet3->id; $pet3_img2->save(); $pet4 = new Pet(); $pet4->name = 'Max'; $pet4->status = 'available'; $pet4->color = 'tan'; $pet4->age = 'adult'; $pet4->description = 'Max is a 25lb mixed Chihuahua that is sweet as can be. He is house, crate, & leash trained. He loves, I mean LOVES to play fetch with his ball. Max would do best with an active family that would already have another dog in their home. He loves to play & snuggle with other dogs. Max is just now learning that cats are ok, but he does still try chasing them. Max does great with kids. Max loves being outside. If you have a doggy door he would put it to excellent use. If you are looking for a cutie to snuggle with than Max is your boy.'; $pet4->gender = 'Male'; $pet4->breed = 'Chihuahua / Mixed (short coat)'; $pet4->user_id = User::first()->id; $pet4->species_id = '1'; $pet4->size_id = '1'; $pet4->a_num = 'A310113'; $pet4->save(); $pet4_img1 = new Image(); $pet4_img1->img_path = 'img/petimg/max1.png'; $pet4_img1->pet_id = $pet4->id; $pet4_img1->save(); $pet4_img2 = new Image(); $pet4_img2->img_path = 'img/petimg/max2.jpg'; $pet4_img2->pet_id = $pet4->id; $pet4_img2->save(); $pet5 = new Pet(); $pet5->name = 'Nilla'; $pet5->status = 'available'; $pet5->color = 'white'; $pet5->age = 'adult'; $pet5->description = 'Nilla is filled with energy and gets along with all animals. She is very submissive and can be trusted with small children. She is looking for a loving forever home. She was scheduled to be euthanized, but San Antonio Pets Alive! saved her and now they are helping her find the forever, loving home that she has never known.'; $pet5->gender = 'Female'; $pet5->breed = 'Labrador Retriever / Mixed (short coat)'; $pet5->user_id = User::first()->id; $pet5->species_id = '1'; $pet5->size_id = '2'; $pet5->a_num = 'A346070'; $pet5->save(); $pet5_img1 = new Image(); $pet5_img1->img_path = 'img/petimg/nilla1.jpg'; $pet5_img1->pet_id = $pet5->id; $pet5_img1->save(); $pet5_img2 = new Image(); $pet5_img2->img_path = 'img/petimg/nilla2.jpg'; $pet5_img2->pet_id = $pet5->id; $pet5_img2->save(); $pet6 = new Pet(); $pet6->name = 'Sebastian'; $pet6->status = 'available'; $pet6->color = 'orange'; $pet6->age = 'baby'; $pet6->description = 'Sebastian is a super lovable little guy who is missing his freedom to run around. He and his siblings had to be returned to the shelter because we the fosters took in our grandmother which has been placed on hospice. Our furr babies were getting to be too much for us to handle with grandma in the house. Sebastian has grown up knowing how to sleep quietly in a crate and play with our sweet pup. He has been around a 2yo and has been fine with her picking him up kinda crazy like, but hasnt had prolonged contact with toddlers. he is fine with the litterbox and LOVES to stare out the window at the birds at the feeder. He is definitely a real lovebug. one wierd trait, he loves the smell of irish spring bar soap. Its like cat nip to him!! whenever my husband would get out of the shower he would attack his feet ;-P Please give sebastian a home he will love you for ever!!! '; $pet6->gender = 'Male'; $pet6->breed = 'Domestic Short Hair / Tabby (short coat)'; $pet6->user_id = User::first()->id; $pet6->species_id = '2'; $pet6->size_id = '1'; $pet6->a_num = 'A330726'; $pet6->save(); $pet6_img1 = new Image(); $pet6_img1->img_path = 'img/petimg/sebastian1.png'; $pet6_img1->pet_id = $pet6->id; $pet6_img1->save(); $pet6_img2 = new Image(); $pet6_img2->img_path = 'img/petimg/sebastian2.jpg'; $pet6_img2->pet_id = $pet6->id; $pet6_img2->save(); $pet7 = new Pet(); $pet7->name = 'Matty'; $pet7->status = 'available'; $pet7->color = 'white'; $pet7->age = 'young'; $pet7->description = ' I can fit perfectly on your lap! Matty ID#297703 is a male, one-year old Chihuahua & Rat Terrier blend. He is a completely ADORABLE and tiny little dog ... the quintessential little lap dog. He loves going for walks and he does well with other dogs. Please come meet him and fall in love! He is neutered, current on vaccinations, microchipped and his adoption comes with one free month of pet health insurance. '; $pet7->gender = 'Male'; $pet7->breed = 'Chihuahua / Rat Terrier / Mixed (short coat)'; $pet7->user_id = User::first()->id; $pet7->species_id = '1'; $pet7->size_id = '2'; $pet7->a_num = 'A297703'; $pet7->save(); $pet7_img1 = new Image(); $pet7_img1->img_path = 'img/petimg/matty1.jpg'; $pet7_img1->pet_id = $pet7->id; $pet7_img1->save(); $pet7_img2 = new Image(); $pet7_img2->img_path = 'img/petimg/matty2.jpg'; $pet7_img2->pet_id = $pet7->id; $pet7_img2->save(); $pet8 = new Pet(); $pet8->name = 'Alex AKA Jade'; $pet8->status = 'available'; $pet8->color = 'white and black'; $pet8->age = 'young'; $pet8->description = 'Jade is one of the most loyal dogs I\'ve had the pleasure of fostering. She is full of love and just wants it back in return. She has to be the only dog and absolutely NO cats. She\'s very dominant so would make someone\'s best friend if you can have her as your only pet. She is an INSIDE dog she sleeps with my 3 year old and I. She protects the children as well as myself and sister. Please only serious inquiries. She\'s so full of love and deserves a forever home that can reciprocate her love. '; $pet8->gender = 'Female'; $pet8->breed = 'Great Dane / American Staffordshire Terrier (short coat)'; $pet8->user_id = User::first()->id; $pet8->species_id = '1'; $pet8->size_id = '3'; $pet8->a_num = 'A303622'; $pet8->save(); $pet8_img1 = new Image(); $pet8_img1->img_path = 'img/petimg/jade1.jpg'; $pet8_img1->pet_id = $pet8->id; $pet8_img1->save(); $pet8_img2 = new Image(); $pet8_img2->img_path = 'img/petimg/jade2.jpg'; $pet8_img2->pet_id = $pet8->id; $pet8_img2->save(); $pet9 = new Pet(); $pet9->name = 'Patch'; $pet9->status = 'available'; $pet9->color = 'white'; $pet9->age = 'adult'; $pet9->description = 'Patch is Special Needs as he distrusts people and can be quite aggressive. He was severely abused and neglected as his intake photos clearly show. He is a lover once he attaches to his one person, though. It takes about an hour once he is out of his crate and lots of treats. Then he wants to cuddle in your lap. He loves gentle ear rubs and gives kisses all the time. Patch is very quiet, not a yappy guy. Loves to be held and with his person as much as possible. He shows some interest in balls and play, but is more interested in attention. He has NEVER been destructive when left alone nor has he ever had an accident while in my home. Patch does fine with small dogss, and would do best in a single person home with very little human traffic (or at least where he could be put in a room away from anyone other then his person). He has come a very long way, and now needs his own person and a loving place to call home. '; $pet9->gender = 'Male'; $pet9->breed = 'Chihuahua / Rat Terrier / Mixed (short coat)'; $pet9->user_id = User::first()->id; $pet9->species_id = '1'; $pet9->size_id = '1'; $pet9->a_num = 'A303587'; $pet9->save(); $pet9_img1 = new Image(); $pet9_img1->img_path = 'img/petimg/patch1.jpg'; $pet9_img1->pet_id = $pet9->id; $pet9_img1->save(); $pet9_img2 = new Image(); $pet9_img2->img_path = 'img/petimg/patch2.jpg'; $pet9_img2->pet_id = $pet9->id; $pet9_img2->save(); $pet10 = new Pet(); $pet10->name = 'Avery'; $pet10->status = 'available'; $pet10->color = 'calico'; $pet10->age = 'young'; $pet10->description = 'FeLV+ Special Needs. Avery ID# 22316659 is a beautiful female, young adult Calico. She is a very sweet, quiet and gentle kitty. Avery is special needs because she is FeLV+positive. She is currently healthy. FeLV+ cats typically live up to 4 years or so after receiving their diagnosis and for the remainder of their life, they can only live with dogs, other non-feline pets, or o ther cats who are also FeLV+positive. They need to remain indoors always, eat a nutritionally-balanced diet and have veterinary care if they ever show signs of illness. Because Avery is FeLV+, her adoption fee is waived. She is spayed, current on vaccinations, microchipped and her adoption comes with one free month of pet health insurance. You can meet her at PETCO Ingram Park, 6001 NW Loop 410, San Antonio, TX 78238. Hours are Mondays-Fridays 11 a.m. until 8 p.m.; Saturdays & Sundays 10 a.m. until 7 p.m. For additional information, please write to petco.ingram@sanantoniopetsalive.org AND to Adopt@sanantoniopetsalive.org or call 220-370-7612. When inquiring about this pet, please be sure to give the pet\'s ID#.'; $pet10->gender = 'Female'; $pet10->breed = 'Domestic Short Hair'; $pet10->user_id = User::first()->id; $pet10->species_id = '2'; $pet10->size_id = '1'; $pet10->a_num = '22316659'; $pet10->save(); $pet10_img1 = new Image(); $pet10_img1->img_path = 'img/petimg/avery1.jpg'; $pet10_img1->pet_id = $pet10->id; $pet10_img1->save(); $pet10_img2 = new Image(); $pet10_img2->img_path = 'img/petimg/avery2.jpg'; $pet10_img2->pet_id = $pet10->id; $pet10_img2->save(); $pet12 = new Pet(); $pet12->name = 'Angel'; $pet12->status = 'available'; $pet12->color = 'tan and white'; $pet12->age = 'baby'; $pet12->description = 'Angel is a female, 12-week old American Staffy blend. Angel weighs approximately 10 1/2 pounds. Once she is spayed she will be adoption ready! If interested please inquire and we can make arrangements for a meet and greet and possible adoption. Angel is a bundle of energy. She loves to romp and play with her toys. Angel is cuddle bug and loves to give lots of hugs and kisses. Angel can be a laid back kind of girl, but she can keep up with her siblings in the playful puppy department. She has never been around young kids or cat. I have a teenage son and they love to play and chase him all around the house. Angel will be spayed, microchipped, current on vaccinations, and her adoption comes with one free month of pet health insurance! Please email me to meet this little bundle of love and remember ... when you adopt a puppy you are making a lifetime commitment to that puppy!'; $pet12->gender = 'Female'; $pet12->breed = 'American Staffordshire Terrier (short coat)'; $pet12->user_id = User::first()->id; $pet12->species_id = '1'; $pet12->size_id = '2'; $pet12->a_num = 'A360560'; $pet12->save(); $pet12_img1 = new Image(); $pet12_img1->img_path = 'img/petimg/angel1.jpg'; $pet12_img1->pet_id = $pet12->id; $pet12_img1->save(); $pet12_img2 = new Image(); $pet12_img2->img_path = 'img/petimg/angel2.jpg'; $pet12_img2->pet_id = $pet12->id; $pet12_img2->save(); $pet14 = new Pet(); $pet14->name = 'Annie'; $pet14->status = 'available'; $pet14->color = 'Brown Tabby'; $pet14->age = 'young'; $pet14->description = 'Can you give this sweet girl a home?'; $pet14->gender = 'Female'; $pet14->breed = 'Domestic Short Hair (short coat)'; $pet14->user_id = User::first()->id; $pet14->species_id = '2'; $pet14->size_id = '1'; $pet14->a_num = 'A327383'; $pet14->save(); $pet14_img1 = new Image(); $pet14_img1->img_path = 'img/petimg/annie1.jpg'; $pet14_img1->pet_id = $pet14->id; $pet14_img1->save(); $pet15 = new Pet(); $pet15->name = 'Billie'; $pet15->status = 'available'; $pet15->color = 'White'; $pet15->age = 'young'; $pet15->description = 'Billie is a very happy boy! He loves people and does great with other dogs. In true terrier fashion, Billie has endless energy and very high prey drive. He likes to chase birds, rabbits, cats, and anything else that runs! Billie is a young terrier and, as such, needs a minimum of 2 hours of exercise every day. He would do best in a very active home, with an experienced owner, or with a home that will work/challenge him.'; $pet15->gender = 'Male'; $pet15->breed = 'Terrier / Mixed (short coat)'; $pet15->user_id = User::first()->id; $pet15->species_id = '1'; $pet15->size_id = '2'; $pet15->a_num = 'A359510'; $pet15->save(); $pet15_img1 = new Image(); $pet15_img1->img_path = 'img/petimg/billie1.jpg'; $pet15_img1->pet_id = $pet15->id; $pet15_img1->save(); $pet15_img2 = new Image(); $pet15_img2->img_path = 'img/petimg/billie2.jpg'; $pet15_img2->pet_id = $pet15->id; $pet15_img2->save(); $pet16 = new Pet(); $pet16->name = 'Maximus'; $pet16->status = 'available'; $pet16->color = 'White and Black'; $pet16->age = 'adult'; $pet16->description = 'Maximus is the sweetest most loving dog ever. He makes my own dog (who I absolutely adore and love) look like a grump. Max will do just about anything for a nice belly rub or pat on the head. Max has a severed toe that has heeled completely. Max is still a little afraid to put a lot of pressure on his left front leg but it doesn\'t stop him from anything. He is extremely playful and active. He can keep up with my 100lb pitbull on any given day. He can sit and shake on command, and can almost "lay" too!!! Max is about 90% house broken but he will have it down in no time :-) He is also crate trained. I ABSOLUTELY LOVE Maximus! He is one of the best dogs I\'ve fostered. If I could keep him, I most definitely would. Max has stolen my heart. he deserves the most loving home possible as he will only return the love! Fantastic dog!'; $pet16->gender = 'Male'; $pet16->breed = 'American Staffordshire Terrier / Mixed (short coat)'; $pet16->user_id = User::first()->id; $pet16->species_id = '1'; $pet16->size_id = '3'; $pet16->a_num = 'A326218'; $pet16->save(); $pet16_img1 = new Image(); $pet16_img1->img_path = 'img/petimg/maximus1.jpg'; $pet16_img1->pet_id = $pet16->id; $pet16_img1->save(); $pet16_img2 = new Image(); $pet16_img2->img_path = 'img/petimg/maximus2.jpg'; $pet16_img2->pet_id = $pet16->id; $pet16_img2->save(); $pet17 = new Pet(); $pet17->name = 'Lady'; $pet17->status = 'available'; $pet17->color = 'White and Black'; $pet17->age = 'senior'; $pet17->description = 'Lady is just that - a lady! She is super easy to get along with, gets along with my other dogs, crate trained, house trained. She walks well on a lead without pulling and tugging. She does well with children but I wouldn\'t recommend they try to pick her up or carry her - she doesn\'t like that kind of handling. She loves to be petted and brushed and will lay in your lap given the chance. She even sits up and begs! Very sweet dog.'; $pet17->gender = 'Female'; $pet17->breed = 'Terrier / Mixed (medium coat))'; $pet17->user_id = User::first()->id; $pet17->species_id = '1'; $pet17->size_id = '1'; $pet17->a_num = 'A339813'; $pet17->save(); $pet17_img1 = new Image(); $pet17_img1->img_path = 'img/petimg/lady1.jpg'; $pet17_img1->pet_id = $pet17->id; $pet17_img1->save(); $pet17_img2 = new Image(); $pet17_img2->img_path = 'img/petimg/lady2.jpg'; $pet17_img2->pet_id = $pet17->id; $pet17_img2->save(); $pet18 = new Pet(); $pet18->name = 'Queenie'; $pet18->status = 'available'; $pet18->color = 'tortoiseshell'; $pet18->age = 'baby'; $pet18->description = 'Lady is just that - a lady! She is super easy to get along with, gets along with my other pets, crate trained, house trained. She walks well on a lead without pulling and tugging. She does well with children but I wouldn\'t recommend they try to pick her up or carry her - she doesn\'t like that kind of handling. She loves to be petted and brushed and will lay in your lap given the chance. She even sits up and begs! Very sweet dog.'; $pet18->gender = 'Female'; $pet18->breed = 'Domestic Short Hair (short coat)'; $pet18->user_id = '2'; $pet18->species_id = '2'; $pet18->size_id = '1'; $pet18->a_num = 'A340004'; $pet18->save(); $pet18_img1 = new Image(); $pet18_img1->img_path = 'img/petimg/queenie1.jpg'; $pet18_img1->pet_id = $pet18->id; $pet18_img1->save(); $pet19 = new Pet(); $pet19->name = 'Zach'; $pet19->status = 'available'; $pet19->color = 'black'; $pet19->age = 'young'; $pet19->description = 'Zacky is the sweetest and calmest puppy that I have ever met. He plays well with my other dogs but he is so content and happy to find a fuzzy monkey or a tennis ball and just sit quietly in the corner by himself while the others run circles around him. He doesn\'t give overwhelming or sloppy kisses, he is shy but perfectly so. He warms up quickly and enjoys attention but doesn\'t demand it or jump all over me. He is great with kids and other dogs. He is also great with training! He is crate trained, almost potty trained and has so far learned how to sit. Additionally he just falls asleep when out in public like when I take him to Marshalls, Ross or Pet Smart! Zacky just wants to be happy. I honestly dont know if anything bothers this perfect pup. He is excited to meet his furever family and love a person or a family of five. Additionally he HAD ringworm and has completed treatment, now he is just waiting for his fur to grow back in a few spots! PS Zacky is giving another puppy a kiss! Here a couple of cute videos: https://www.facebook.com/HudsonHappiness/videos/1106347876059680/ https://www.facebook.com/HudsonHappiness/videos/1117773634917104/'; $pet19->gender = 'Male'; $pet19->breed = 'Labrador Retriever / Mixed (medium coat)'; $pet19->user_id = '2'; $pet19->species_id = '1'; $pet19->size_id = '2'; $pet19->a_num = 'A345133'; $pet19->save(); $pet19_img1 = new Image(); $pet19_img1->img_path = 'img/petimg/zach1.jpg'; $pet19_img1->pet_id = $pet19->id; $pet19_img1->save(); $pet19_img2 = new Image(); $pet19_img2->img_path = 'img/petimg/zach2.jpg'; $pet19_img2->pet_id = $pet19->id; $pet19_img2->save(); $pet19_img3 = new Image(); $pet19_img3->img_path = 'img/petimg/zach3.jpg'; $pet19_img3->pet_id = $pet19->id; $pet19_img3->save(); $pet20 = new Pet(); $pet20->name = 'Howard'; $pet20->status = 'available'; $pet20->color = 'white'; $pet20->age = 'young'; $pet20->description = 'Howard is a sweet, playful little guy who can be outgoing once he warms up to you. He loves to give kisses and will climb right into your lap for love! He is learning to walk on a leash currently and has been doing great. Crate-trained. (House-trained status and personality with other dogs unknown until we are past the 7 day quarantine period!) Howard is currently being treated for demodectic mange (NON contagious) with oral medication currently.'; $pet20->gender = 'Male'; $pet20->breed = 'Chihuahua / Terrier / Mixed (short coat)'; $pet20->user_id = '2'; $pet20->species_id = '1'; $pet20->size_id = '2'; $pet20->a_num = 'A364023'; $pet20->save(); $pet20_img1 = new Image(); $pet20_img1->img_path = 'img/petimg/howard1.jpg'; $pet20_img1->pet_id = $pet20->id; $pet20_img1->save(); $pet20_img2 = new Image(); $pet20_img2->img_path = 'img/petimg/howard2.jpg'; $pet20_img2->pet_id = $pet20->id; $pet20_img2->save(); $pet21 = new Pet(); $pet21->name = 'Lulu'; $pet21->status = 'available'; $pet21->color = 'black'; $pet21->age = 'young'; $pet21->description = 'Lulu is a lover of everyone and everything! She loves babies, young children, new dogs and walking on the leash. Lulu often accompanies me to work and meets handfuls of new people and pets every day, so she is incredibly well socialized and even knows a few tricks!'; $pet21->gender = 'Male'; $pet21->breed = 'American Staffordshire Terrier / Mixed (short coat)'; $pet21->user_id = '2'; $pet21->species_id = '1'; $pet21->size_id = '3'; $pet21->a_num = 'A'; $pet21->save(); $pet21_img1 = new Image(); $pet21_img1->img_path = 'img/petimg/lulu1.jpg'; $pet21_img1->pet_id = $pet21->id; $pet21_img1->save(); $pet21_img2 = new Image(); $pet21_img2->img_path = 'img/petimg/lulu2.jpg'; $pet21_img2->pet_id = $pet21->id; $pet21_img2->save(); $pet21_img3 = new Image(); $pet21_img3->img_path = 'img/petimg/lulu3.jpg'; $pet21_img3->pet_id = $pet21->id; $pet21_img3->save(); $pet21_img4 = new Image(); $pet21_img4->img_path = 'img/petimg/lulu4.jpg'; $pet21_img4->pet_id = $pet21->id; $pet21_img4->save(); $pet22 = new Pet(); $pet22->name = 'Cookie'; $pet22->status = 'available'; $pet22->color = 'red'; $pet22->age = 'young'; $pet22->description = 'Cookie ID#365961 a female 1-year old Shepherd & possible cattle dog blend. She is an adorable, friendly, lovable girl! She is a beautiful and unusual red-brindle with white. She is fun-loving and great with other dogs. You are guaranteed to love Cookie! She is spayed, current on vaccinations and microchipped and her adoption comes with one free month of pet health insurance.'; $pet22->gender = 'Female'; $pet22->breed = 'Shepherd / Cattle Dog / Mixed (short coat)'; $pet22->user_id = '3'; $pet22->species_id = '1'; $pet22->size_id = '3'; $pet22->a_num = 'A365961'; $pet22->save(); $pet22_img1 = new Image(); $pet22_img1->img_path = 'img/petimg/cookie1.jpg'; $pet22_img1->pet_id = $pet22->id; $pet22_img1->save(); $pet22_img2 = new Image(); $pet22_img2->img_path = 'img/petimg/cookie2.jpg'; $pet22_img2->pet_id = $pet22->id; $pet22_img2->save(); $pet22_img3 = new Image(); $pet23 = new Pet(); $pet23->name = 'Lisa'; $pet23->status = 'available'; $pet23->color = 'white and tan'; $pet23->age = 'young'; $pet23->description = 'Lisa is one of the sweetest and most lovable pups you would ever want to meet. Lisa is 14# of sweetness and loves everyone she meets, although she has yet to meet a cat. Lisa is approximately 9 months old, and is a basset mix. She did have a little problem with sarcoptic mange previously, but it is all cleared up at this time. Lisa is housebroken, but will use potty pads if provided. When it is cold, she is more reluctant to go out on her own as well. She is doing well learning the leash and responds well to encouragement. Lisa has bonded her best friend here, Sabella, who is a Blue Lacy/retriever mix, who was very shy at first but is coming out of shell very nicely. Lisa’s friendly and outgoing nature has made such a difference in Sabella, that it would be wonderful if they could be adopted together, but it is not mandatory. '; $pet23->gender = 'Female'; $pet23->breed = 'Basset Hound (short coat)'; $pet23->user_id = '2'; $pet23->species_id = '1'; $pet23->size_id = '1'; $pet23->a_num = 'A355435'; $pet23->save(); $pet23_img1 = new Image(); $pet23_img1->img_path = 'img/petimg/lisa1.jpg'; $pet23_img1->pet_id = $pet23->id; $pet23_img1->save(); $pet23_img2 = new Image(); $pet23_img2->img_path = 'img/petimg/lisa2.jpg'; $pet23_img2->pet_id = $pet23->id; $pet23_img2->save(); $pet24 = new Pet(); $pet24->name = 'Spot'; $pet24->status = 'available'; $pet24->color = 'White and Black'; $pet24->age = 'adult'; $pet24->description = ' a male 3-year old dalmation & cattle dog blend. He is friendly, well-mannered and a "total sweetheart"! He LOVES going for walks and exploring! Please come meet him. Spot is neutered, current on vaccinations and microchipped. His adoption comes with one free month of pet health insurance. '; $pet24->gender = 'Male'; $pet24->breed = 'Dalmatian / Cattle Dog / Mixed (short coat)'; $pet24->user_id = '2'; $pet24->species_id = '1'; $pet24->size_id = '3'; $pet24->a_num = 'A342417'; $pet24->save(); $pet24_img1 = new Image(); $pet24_img1->img_path = 'img/petimg/spot1.jpg'; $pet24_img1->pet_id = $pet24->id; $pet24_img1->save(); $pet24_img2 = new Image(); $pet24_img2->img_path = 'img/petimg/spot2.jpg'; $pet24_img2->pet_id = $pet24->id; $pet24_img2->save(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store() { $about = ""; $this->response['console'] = "SERVER[status]-> OK::200\n "; $this->response['console'] .= "\t" . Input::get('action') . "\n"; switch (Input::get('action')) { case 'new_admin': $this->response['console'] .= "Creating new admin...\n"; $mUser = new User(); $mUser->username = Input::get('username'); $mUser->password = Hash::make(Input::get('password')); $mUser->role = Input::get('role'); $mUser->save(); $this->response['message'] = ucfirst($mUser->username) . " was added to admins successfully"; break; case 'new_medicine_type': $this->response['console'] .= "Creating new medicine type...\n"; $mType = new Type(); $mType->type = Input::get('type'); $mType->save(); $this->response['message'] = ucfirst($mType->type) . " was added to medicine types successfully"; break; case 'new_medicine_breed': $this->response['console'] .= "Creating new medicine breed...\n"; $mBreed = new Breed(); $mBreed->breed = Input::get('breed'); $mBreed->type_id = Input::get('type'); $this->response['console'] = $mBreed->breed . " | " . $mBreed->type_id . "\n"; $mBreed->save(); $this->response['message'] = ucfirst($mBreed->breed) . " was added to medicine breeds successfully"; break; case 'new_medicines_tip': $_about = Input::get('about'); $this->response['console'] .= "Creating new medicine tip...\n"; $this->response['console'] .= "about :" + $_about + " \n"; if ($_about == "1") { $about = "Health"; } elseif ($_about == "2") { $about = "Food"; } else { $about = "Dosage"; } $mTip = new Tip(); $mTip->type_id = Input::get('type'); $mTip->breed_id = Input::get('breed'); $mTip->about = $about; $mTip->content = Input::get('content'); $this->response['console'] .= $mTip->type_id . " | " . $mTip->breed_id . " | " . $mTip->about . " | " . $mTip->content; $mTip->save(); $this->response['message'] = "New tip was successfully recorded"; break; case 'new_medicine': $this->response['console'] .= "Creating new medicine process has started\n"; $mPet = new Pet(); if (Input::hasFile('photo')) { $uploadDir = public_path() . "/img/uploads/"; $this->response['console'] .= "\tNew image process has started\n"; $fileName = sha1(Input::get('name')) . "." . Input::get('ext'); $_FILES['photo']['name'] = $fileName; $this->response['console'] .= "\ttmp_name: " . $_FILES['photo']['tmp_name'] . "\n"; $this->response['console'] .= "\tsaving to " . $uploadDir . "\n"; move_uploaded_file($_FILES["photo"]["tmp_name"], $uploadDir . $_FILES["photo"]["name"]); $mPet->image = $fileName; } $mPet->name = Input::get('name'); $mPet->breed_id = Input::get('breed'); $mPet->appearance_id = Input::get('appearance'); $mPet->type_id = Input::get('type'); $mPet->age = Input::get('age'); $mPet->price = Input::get('price'); $mPet->description = Input::get('description'); $mPet->care = Input::get('care'); $mPet->save(); $this->response['message'] = "{$mPet->name} was added to the list of medicines successfully"; } return json_encode($this->response); }