/** * Show the form for creating a new resource. * * @return Response */ public function postCreate() { $validator = Validator::make(Input::all(), Signature::$rules); if ($validator->passes()) { $signature = new Signature(); $signature->name = Request::input('name'); $signature->jobtitle = Input::get('jobtitle'); $signature->email = Input::get('email'); $signature->company = Input::get('company'); $signature->phone = Input::get('phone'); $signature->website = Input::get('website'); $signature->officephone = Input::get('officephone'); $signature->fax = Input::get('fax'); $signature->address = Input::get('address'); $signature->address2 = Input::get('address2'); $signature->facebook = Input::get('facebook'); $signature->twitter = Input::get('twitter'); $signature->youtube = Input::get('youtube'); $signature->skype = Input::get('skype'); $signature->googleplus = Input::get('googleplus'); $signature->linkedin = Input::get('linkedin'); $signature->stackoverflow = Input::get('stackoverflow'); $signature->github = Input::get('github'); $signature->instagram = Input::get('instagram'); if (Input::file()) { $image = Input::file('image'); // $fileextension = Input::file('image')->getClientOriginalExtension(); $filename = Input::file('image')->getClientOriginalName(); $path = public_path('img/' . $filename); // $img->resize(intval($size), null, function($constraint) { // $constraint->aspectRatio(); // Image::make($image->getRealPath())->resize(468, 249)->save($path); $size = '200,200'; Image::make($image->getRealPath())->resize(intval($size), null, function ($contstraint) { $contstraint->aspectRatio(); })->save($path); $signature->image = 'img/' . $filename; } $signature->save(); $name = $signature->name; $jobtitle = $signature->jobtitle; $email = $signature->email; $company = $signature->company; $phone = $signature->phone; $website = $signature->website; $officephone = $signature->officephone; $fax = $signature->fax; $address = $signature->address; $address2 = $signature->address2; $facebook = $signature->facebook; $twitter = $signature->twitter; $youtube = $signature->youtube; $skype = $signature->skype; $googleplus = $signature->googleplus; $linkedin = $signature->linkedin; $stackoverflow = $signature->stackoverflow; $github = $signature->github; $instagram = $signature->instagram; $image2 = $signature->image; return view('signatures.result')->with('signatures', $signature)->with('name', $name)->with('image', $image2)->with('jobtitle', $jobtitle)->with('email', $email)->with('company', $company)->with('phone', $phone)->with('website', $website)->with('officephone', $officephone)->with('fax', $fax)->with('address', $address)->with('address2', $address2)->with('facebook', $facebook)->with('twitter', $twitter)->with('youtube', $youtube)->with('skype', $skype)->with('googleplus', $googleplus)->with('linkedin', $linkedin)->with('stackoverflow', $stackoverflow)->with('github', $github)->with('instagram', $instagram); } return view('signatures.index')->withErrors($validator)->with('signatures', Signature::all()); }
/** * Update the specified resource in storage. * * @param $id * @param LibraryRequest $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function update($id, LibraryRequest $request) { $books = Book::findOrFail($id); $bindings = Binding::with('id'); $categories = Categories::with('id'); $conditions = Condition::with('id'); $editions = Edition::with('id'); $publishers = Publisher::with('id'); $rarities = Rarity::with('id'); $signatures = Signature::with('id'); // Availability option switch (on = 1; off = 0) $available = Input::all(); // Special Collection option switch (on = 1; off = 0) $special_collection = Input::all(); // Handle With Care option switch (on = 1; off = 0) $handle_with_care = Input::all(); $books->update($request->all()); Auth::user()->books()->save($books, $bindings, $categories, $conditions, $editions, $publishers, $rarities, $signatures, $available, $special_collection, $handle_with_care); return redirect('admin/library'); }