Working on Tour Form
This commit is contained in:
parent
00de35ba03
commit
3239f8767b
6 changed files with 236 additions and 111 deletions
|
|
@ -6,6 +6,7 @@ use App\Tour;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Intervention\Image\Facades\Image;
|
||||
|
||||
|
||||
class TourController extends Controller
|
||||
|
|
@ -73,7 +74,47 @@ class TourController extends Controller
|
|||
*/
|
||||
public function update(Request $request, Tour $tour)
|
||||
{
|
||||
//
|
||||
$tour=Tour::find($request->input('id'));
|
||||
|
||||
$request->validate(
|
||||
[
|
||||
'name'=>'required|min:3',
|
||||
'beschreibung'=>'required',
|
||||
'user_id'=>'required',
|
||||
'bild'=>'mimes:jpg,jpeg,bmp,png,gif'
|
||||
]
|
||||
);
|
||||
|
||||
if ($request->bild){
|
||||
$bild = Image::make($request->bild);
|
||||
$breite = $bild->width();
|
||||
$hoehe = $bild->height();
|
||||
if ($breite>$hoehe) {
|
||||
Image::make($request->bild)
|
||||
->widen(1200)
|
||||
->save(public_path().'/img/tour/'.$tour->id.'_gross.jpg');
|
||||
Image::make($request->bild)
|
||||
->widen(64)
|
||||
->save(public_path().'/img/tour/'.$tour->id.'.jpg');
|
||||
}else {
|
||||
Image::make($request->bild)
|
||||
->heighten(900)
|
||||
->save(public_path().'/img/tour/'.$tour->id.'_gross.jpg');
|
||||
Image::make($request->bild)
|
||||
->widen(96)
|
||||
->save(public_path().'/img/tour/'.$tour->id.'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
$tour->name=$request->input('name');
|
||||
$tour->beschreibung=$request->input('beschreibung');
|
||||
$tour->is_cancelled=$request->input('is_cancelled');
|
||||
$tour->start=$request->input('start');
|
||||
$tour->deadline=$request->input('deadline');
|
||||
$tour->save();
|
||||
|
||||
return redirect('/member/');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue