My form is as follow
{{ Form::open(array( 'enctype' => 'multipart/form-data'))}}
<div class="vendor-box-wrap">
<div class="page3-suggested-cat-wrap" style="float: left;width: 100%;border-bottom: 1px dotted;padding-bottom: 10px;margin-left: 20px;">
<label style="width:9%;" for="9009" class="page3-suggested-cat-label" >BoQ</label>
<div class="input-group" style="margin-top: 10px;
width: 70%;">
<span class="form-control"></span>
<span class="input-group-btn">
<span class="btn btn-primary" onclick="$(this).parent().find('input[type=file]').click();">Browse</span>
<input name="file|90009|107" id="file|9009"
value="" onchange="$(this).parent().parent().find('.form-control').html($(this).val().split(/[\\|/]/).pop());"
style="display: none;" type="file">
</span>
</div>
</br> <center><h2><strong>OR</strong></h2></center>
</div>
</div>
<div class="next-btn-wrap"><div class="cf"></div>
<div class="back-btn-wrap">
{{ Form::submit('Back',array('class' => 'back-btn', 'name' => 'back'))}}
</div>
<div class="save-btn-wrap">
{{ Form::submit('Save',array('class' => 'save-btn','name' => 'save'))}}
</div>
{{ Form::submit('Next',array('class' => 'next-btn','name' => 'next'))}}
</div>
{{ Form::close()}}
and in my controller I am using following code to get the data
$aa = Input::except(array('_token','back','save','next'));
//dd($aa);
foreach ($aa as $key=>$value){
$ids = explode("|",$key);
if(isset($ids[0]) && $ids[0]=="file" ){
$userid = Session::get('userid');
$event = Session::get('event');
$fileTblObj = new fileHandler();
$ans = Answer::find($ids[2]);
if(isset($aa[$key])){
//dd($aa[$key]);
if(Input::file($key)->isValid()) {
$destinationPath = 'app/uploads/'.$event.'/'.$userid.'/'.$pageNo ; // upload path
$extension = Input::file($key)->getClientOriginalExtension(); // getting image extension
$name = Input::file($key)->getClientOriginalName();
$curFilesize = Input::file($key)->getClientSize();
$mime =Input::file($key)->getMimeType();
if (!File::exists($destinationPath."/boq-".$name)){
//creating details for saving inthe file_handler Table
$fileTblObj->user_id = $userid;
$fileTblObj->eventName = $event ;
$fileTblObj->fileName = "boq-".$name;
$fileTblObj->formPage =$pageNo ;
$fileTblObj->filePath = $destinationPath."/";
$fileTblObj->mime= $mime;
$ans->answer_text = 'Yes';
Input::file($key)->move($destinationPath, "boq-".$name); // uploading file to given path
//Input::file($key)->move($boqPath, $boqname); // uploading file to given path
//Save filedetails
$fileTblObj->save();
$ans->save();
Session::flash('success', 'Upload successfully');
}else if(File::size($destinationPath."/".$name) != $curFilesize){
$fileDtls = $fileTblObj->where('uid',$userid)->where('fileName',$name)->where('formPage',$pageNo)->first();
Input::file($key)->move($destinationPath, $name);
$ans->answer_text = 'Yes';
$ans->save();
$fileTblObj->where('id',$fileDtls->id)->update(array('updated_at'=>date("Y-m-d h:m:s",time())));
}
//return Redirect::to('upload');
}
}
else
{
if($ans->answer_text =='')
{
$ans->answer_text = 'No';
$ans->save();
}
}
}
My problem is I am not able to get the file details on the back-end
the if statement
if(isset($ids[0]) && $ids[0]=="file" ){
}
is always false .
Any Idea How I can fix this. I also tried changing the The FOrm function to
{{ Form::open(array('files' => true)) }}
Still its not showing the file details
To send a file, I personally use this methods.
View:
{!! Form::open(array('action' => 'TestController#store', 'method' => 'POST', 'files'=>true)) !!}
{!! Form::file('thefile') !!}
{!! Form::submit('Save', array('class' => 'btn')) !!}
{!! Form::close() !!}
Controller:
$thefile = Input::file('thefile');
Hope this helps!
Related
i just have made a new app in laravel. i am trying to update my blog posts with tags. here is my form.
{{ Form::model($blog, array('route' => array('admin.blog.update', $blog->slug), 'method' => 'PUT', 'files' => true)) }} <!-- text input -->
<div class="form-group">
{!! Form::label('title', 'Title') !!}
{!! Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'Title']) !!}
</div>
<div class="form-group">
{!! Form::label('description', 'Please Type Here Content') !!}
{!! Form::textarea('content', null, ['class'=>'ckeditor', 'id'=>'my-editor']) !!}
</div>
<div class="form-group">
<label>Category</label>
<select name="tag[]" class="form-control select2" multiple="multiple" data-placeholder="Select Categories"
style="width: 100%;">
#forelse($tags as $tag)
<option>{{ $tag->name }}</option>
#empty
#endforelse
</select>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
{!! Form::label('published_at', 'Publish On') !!}
{!! Form::input('date', 'published_at', date('Y-m-d'), ['class'=>'form-control']) !!}
</div>
</div>
</div>
<div class="form-group">
{!! Form::label('image', 'Choose Image') !!}
{!! Form::file('image') !!}
</div>
#push('scripts')
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<script>
var options = {
filebrowserImageBrowseUrl: '{{ url('filemanager')}}?type=Images',
filebrowserImageUploadUrl: '{{ url('upload')}}?type=Images&_token={{csrf_token()}}',
filebrowserBrowseUrl: '{{ url('filemanager')}}?type=Files',
filebrowserUploadUrl: '{{ url('upload')}}?type=Files&_token={{csrf_token()}}'
};
CKEDITOR.replace('my-editor', options);
</script>
<script>
$(function () {
//Initialize Select2 Elements
$('.select2').select2()
//Timepicker
$('.timepicker').timepicker({
showInputs: false
})
})
</script>
#endpush
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button>
{!! Form::submit('Submit', array( 'class'=>'btn btn-info' )) !!}
{!! Form::close() !!}
here is my controller
> public function blogeditupdate($blog, Request $request){
> $blog = Blog::where('slug', $blog)->firstorfail();$blog = new Blog;
> $blog->title = $request->title;
> $blog->content = $request->content;
> $blog->slug = str_slug($blog->title, '-');
> $blog->user_id = Auth::user()->id;
> $blog->published_at = Carbon::now();
> if($request->hasFile('image')) {
> $file = Input::file('image');
> //getting timestamp
> $timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
> $name = $timestamp. '-' .$file->getClientOriginalName();
> $file->move(public_path().'/images/blog/', $name);
> $blog->image = $name;
> $thumb = Image::make(public_path().'/images/blog/' . $name)->resize(640,420)->save(public_path().'/images/blog/thumb/' .
> $name, 90);
> }
> $blog_id = $blog->id;
> $tags = $request['tag'];
> if (isset($tags)) {
> $blog->tags()->sync($tags); //If one or more tags is selected associate blog to tagblog
> }
> else {
> $blog->tags()->detach(); //If no tags is selected remove exisiting role associated to a blogs
> }
> return redirect()->route('admin.blog.index')->with('status', 'Edit Success');
> }
here is my error
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'blog_id' cannot be null (SQL: insert into blog_tagblog (blog_id, created_at, tagblog_id, updated_at) values (, 2017-09-10 15:17:11, ghanta, 2017-09-10 15:17:11)) ◀"
i am missing something but i don't know what i am doing wrong.please help me!!
At the end of the very first line in your controller, you have this:
$blog = new Blog;
This means that $blog will not have an id, and when you attempt to set the relationship, the blog_id field will be null, which violates your integrity constraints.
If this line is a mistake, delete it.
If not, you need to call $blog->save() before you attempt to sync your tags.
I'm trying to update some data with image. The other data is updated but the image still not updated. here's my code
route
Route::get('film/{idFilm}/edit', array('as' => 'film.edit', 'uses' => 'FilmController#edit'));
Route::post('film/{idFilm}/update', array('as' => 'film.update', 'uses' => 'FilmController#update'));
controller
public function edit($idFilm)
{
$film = Film::findOrFail($idFilm);
$genre = Genre::lists('namaGenre', 'idGenre');
if (is_null($film))
{
return Redirect::to('film');
}
return View::make('pengelolaan.film.editfilm', compact('film','genre'));
}
/**
* Update the specified resource in storage.
*
* #param int $id
* #return Response
*/
public function update($idFilm)
{
$rules = array(
'judulFilm' => 'required',
'durasi' => 'required|numeric',
'keterangan' => 'required',
'idGenre' => 'required'
);
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails())
{
return Redirect::to('film/' . $idFilm . '/edit')
->withErrors($validation)
->withInput()
->with('message', 'There were validation errors.');
}
else
{
$films = Film::find($idFilm);
$films->judulFilm=Input::get('judulFilm');
$films->durasi=Input::get('durasi');
$films->keterangan= Input::get('keterangan');
$films->idGenre= Input::get('idGenre');
if(Input::hasFile('foto'))
{
$file=Input::file('foto');
$file->move('img',$file->getClientOriginalName());
$filename=$file->getClientOriginalName();
$films->foto = $filename;
$films->save();
}
else
{
$films->save();
}
Session::flash('message', 'Data Berhasil Diubah');
return Redirect::to('film');
}
}
view
{{Form::model($film, array('route'=>array('film.update', $film->idFilm,'files' => TRUE)))}}
<div class="form-group">
<div class="col-lg-6">
{{ Form::label('judulFilm', 'Judul Film') }}
{{ Form::text('judulFilm', Input::old('judulFilm'), array('class' => 'form-control')) }}
</div>
</div>
<div class="form-group">
<div class="col-lg-6">
{{ Form::label('durasi', 'Durasi Film') }}
{{ Form::text('durasi', Input::old('durasi'), array('class' => 'form-control')) }}
</div>
</div>
<div class="form-group">
<div class="col-lg-6">
{{ Form::label('keterangan', 'Sinopsis Film') }}
{{ Form::textarea('keterangan', Input::old('keterangan'), array('class' => 'form-control')) }}
</div>
</div>
<div class="form-group">
<div class="col-lg-6">
{{ Form::label('idGenre', 'Genre') }}
{{ Form::select('idGenre', $genre,'',array('class'=>'form-control')) }}
</div>
</div>
<div class="form-group">
<div class="col-lg-6">
{{ Form::label('foto', 'Poster') }}
{{ Form::file('foto') }}
</div>
</div>
</br>
<div class="form-group">
<div class="col-lg-6">
<a class="btn btn-default " href="{{ url('film') }}">Batal</a>
{{Form::submit('Simpan', array('type'=>'submit', 'class'=>'btn btn-default'))}}
{{Form::close()}}
There's no error so i don't know whats wrong with it.
Can someone please tell me what's wrong? Thanks in advance
There are few possibilities to face this issue :
Check for have enctype="multipart/form-data" attribute
Check your file size. If your file size is too high increase upload_max_filesize
May be permission dined for your tmp folder. Provide permission for your tem folder. ini_get('upload_tmp_dir');
I have a form, I have troubles in Upload an Image :(
I am trying to upload some image and I don't know what I am doing bad :(
{{ Form::open (['route' => 'titulos.store', 'class'=> 'form', 'files'=> 'true']) }}
{{ Form::label('title', "Titulo:", ['class' => 'col-sm-2 control-label']) }}
{{ Form::text('title') }}
{{ $errors->first('title') }}
<div class="form-group">
{{ Form::label('date', "Fecha:", ['class' => 'col-sm-2 control-label']) }}
<input type="date" name="date" >
</div>
{{ Form::label('description', "Description:", ['class' => 'col-sm-2 control-label']) }}
{{ Form::textarea('description') }}
{{ $errors->first('description') }}
<div class="form-group">
{{ Form::file('image') }}
</div>
{{ Form::label('category_id', 'Category:', ['class' => 'col-sm-2 control-label']) }}
<div class="col-sm-10">
{{ Form::select('category_id', array('1' => 'TBLeaks', '2' => 'Quejas', '3' => 'Denuncias', '4' => 'Ideas'), null, array('class' => 'form-control')) }}
</div>
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
{{ Form::submit('Submit', ['class' => "btn btn-primary"]) }}
</div>
</div>
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
<a class="btn btn-success" href="{{ URL::to('admin') }}">Back to Admin</a>
</div>
</div>
{{ Form::close() }}
</div>
#if(Session::has('message'))
<div class="alert alert-{{ Session::get('class') }}">{{ Session::get('message')}}</div>
#endif
#stop
In my store function I have:
class TitulosController extends BaseController {
public function store(){
$rules = array(
'title' => 'required',
'description' => 'required',
'category_id' => 'required'
);
$validator = Validator::make(Input::all(), $rules);
// proceso de valicion
if ($validator->fails()) {
return Redirect::to('titulos/create')
->withErrors($validator)
->withInput()->withErrors($validator);
} else {
//store
$image = Input::file('image');
$filename = $image->getClientOriginalName();
if(Input::hasFile('image')){
Input::file('image')->move(public_path().'/assets/img/', $filename);
}
$titulo = new Titulo();
$titulo->id = Input::get('id');
$titulo->title = Input::get('title');
$titulo->description = Input::get('description');
$titulo->date = Input::get('date');
$titulo->image = Input::$filename('image');
$titulo->category_id = Input::get('category_id');
$titulo->save();
return Redirect::to('titulos');
}
I have this model for the Titulo table:
class Titulo extends Eloquent {
use SoftDeletingTrait; // for soft delete
protected $dates = ['deleted_at']; // for soft delete
protected $table = 'titulos';
protected $primaryKey = 'id';
protected $fillable = array('image');
public $timestamps = true;
public function __construct() {
parent::__construct();
}
public function category(){
return $this->belongsTo('Category');
}
}
I have this for Image model:
class Image extends Eloquent {
public $timestamps = false;
protected $fillable = array('image');
}
At this line where your store to public path should be no problem
if(Input::hasFile('image')){
Input::file('image')->move(public_path().'/assets/img/', $filename);
}
Only your save Tutilo object looks not good. I think you have mistakenly add $ on Input::filename at this line. which will call the image
$titulo->image = Input::$filename('image');
change your code to this
$titulo = new Titulo();
$titulo->id = Input::get('id');
$titulo->title = Input::get('title');
$titulo->description = Input::get('description');
$titulo->date = Input::get('date');
$titulo->image = $filename; // I change this line. assuming you want to store the file name
$titulo->category_id = Input::get('category_id');
I'm new to Laravel. I have a form with a File upload function on it. How can I validate image file? . when i execute my code the images are getting uploaded but URL is not saved to the MySQL database, and it shows validation errors on the form as follows.
The thumbnail must be an image.
The large image must be an image.
Here's my input and validation code .
{{ Form::open(array('url' => 'admin/templates/save', 'files' => true, 'method' => 'post')) }}
#if($errors->has())
#foreach($errors->all() as $error)
<div data-alert class="alert-box warning round">
{{$error}}
×
</div>
#endforeach
#endif
<div class="row">
<div class="small-5 large-5 column">
{{ Form::label('title','Title:') }}
{{ Form::text('title',Input::old('title')) }}
</div>
</div>
<div class="row">
<div class="small-7 large-7 column">
{{ Form::label('description','Description:') }}
{{ Form::textarea('description',Input::old('description'),['rows'=>5]) }}
</div>
</div>
<div class="row">
<div class="small-7 large-7 column">
{{ Form::label('detailed_description','Detailed description:') }}
{{ Form::textarea('detailed_description',Input::old('detailed_description'),['rows'=>5]) }}
</div>
</div>
<div class="row">
<div class="small-5 large-5 column">
{{ Form::label('thumbnail','Choose thumbnail image:') }}
{{ Form::file('thumbnail') }}
</div>
</div>
<div class="row">
<div class="small-5 large-5 column">
{{ Form::label('large_image','Choose large image:') }}
{{ Form::file('large_image') }}
</div>
</div>
<div class="row">
<div class="small-5 large-5 column">
{{ Form::label('targeturl','Target URL:') }}
{{ Form::text('targeturl',Input::old('Target URL')) }}
</div>
</div>
{{ Form::submit('Save',['class'=>'button tiny radius']) }}
{{ Form::close() }}
Controller code
<?php
class TemplateController extends BaseController
{
public function newTemplate()
{
$this->layout->title = 'New Template';
$this->layout->main = View::make('dash')->nest('content', 'templates.new');
}
public function saveTemplate() {
//TODO - Validation
$destinationPath = '';
$filename = '';
$destinationThumb = '';
$thumbname = '';
$thumb = Input::file('thumbnail');
$destinationThumb = public_path().'/thumb/';
$thumbname = str_random(6) . '_' . $thumb->getClientOriginalName();
$uploadSuccess = $thumb->move($destinationThumb, $thumbname);
$file = Input::file('large_image');
$destinationPath = public_path().'/img/';
$filename = str_random(6) . '_' . $file->getClientOriginalName();
$uploadSuccess = $file->move($destinationPath, $filename);
$rules = [
'title' => 'required',
'description' => 'required',
'detailed_description' => 'required',
'targeturl' => 'required',
'thumbnail' => 'required|image',
'large_image' => 'required|image'
];
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$template = new Template();
$template->title = Input::get('title');
$template->description = Input::get('description');
$template->thunbnailURL = $destinationThumb . $thumbname;
$template->detailedDescription = Input::get('detailed_description');
$template->targetURL = Input::get('targeturl');
$template->detailImageURL = $destinationPath . $filename;
//$user->created_at = DB::raw('NOW()');
//$user->updated_at = DB::raw('NOW()');
$template->save();
return Redirect::back()->with('success', 'Template added!');
} else
return Redirect::back()->withErrors($validator)->withInput();
}
}
Please help me.
Move your upload code inside validation passes
public function saveTemplate() {
//TODO - Validation
$rules = [
'title' => 'required',
'description' => 'required',
'detailed_description' => 'required',
'targeturl' => 'required',
'thumbnail' => 'required|image',
'large_image' => 'required|image'
];
$validator = Validator::make(Input::all(), $rules);
if ($validator->passes()) {
$thumb = Input::file('thumbnail');
$destinationThumb = public_path().'/thumb/';
$thumbname = str_random(6) . '_' . $thumb->getClientOriginalName();
$uploadSuccess = $thumb->move($destinationThumb, $thumbname);
$file = Input::file('large_image');
$destinationPath = public_path().'/img/';
$filename = str_random(6) . '_' . $file->getClientOriginalName();
$uploadSuccess = $file->move($destinationPath, $filename);
$template = new Template();
$template->title = Input::get('title');
$template->description = Input::get('description');
$template->thunbnailURL = $destinationThumb . $thumbname;
$template->detailedDescription = Input::get('detailed_description');
$template->targetURL = Input::get('targeturl');
$template->detailImageURL = $destinationPath . $filename;
//$user->created_at = DB::raw('NOW()');
//$user->updated_at = DB::raw('NOW()');
$template->save();
return Redirect::back()->with('success', 'Template added!');
} else
return Redirect::back()->withErrors($validator)->withInput();
}
I've implemented an option for uploading pictures of employees. It is optional. However, if I try to upload a file that is not valid, it just seems to skip to the show-method, which first of all does not exist, and secondly is never called.
If I edit the form without a file, everything works fine, and the validation also works. If I upload a valid file, it works aswell.
I just don't get why this is happening
Controller:
`public function update($id){
// get the POST data
$new = Input::all();
// get the user
$u = User::find($id);
$picturevalid = true;
if (Input::get('slett') === 'slett') {
$del = $u->employeePicture;
$del->forceDelete();
}
if(Input::hasFile('picture')) {
if ($u->employeePicture) {
$e = $u->employeePicture;
}
else { $e = new Employeepicture(); }
$image = array(Input::file('picture'));
$picturevalid= $e->validate($image);
}
$new['password'] = $u->password;
// attempt validation
if ($u->validate($new, $u->uid) && $picturevalid && (Input::get('groups') || $new['usertype'] == 2))
{
if (Input::hasFile('picture')) {
$imagein = Input::file('picture');
$kid = Session::get('kid');
$uid = $u->uid;
// We should make an url-friendly version of the file
$newname = $uid.'_'.$u->lastname.'_'.$u->firstname.'.'. // newname:kindergarden+kidnr
$imagein->getClientOriginalExtension(); // punktum + filendelse
$thumb_w = 250; // thumbnail size (area cropped in middle of image)
$thumb_h = 300; // thumbnail size (area cropped in middle of image)
$this->resize_then_crop($imagein,$newname,$thumb_w,$thumb_h,/*rgb*/"255","255","255");
//url to be stored in the database
$urlpath = '/Hovedprosjekt/app/storage/upload/'.$kid.'/images/thumbs/';
$url = $urlpath.$newname;
$e->uid = $uid;
$e->url = $url;
$e->updated_at = date('Y-m-d H:i:s');
if(!$e->save())
{
//save unsuccessful
return Redirect::to('employee/'.$id.'/edit')
->with('register_message', 'Endring feilet.');
}
}
$u->firstname = $new['firstname'];
$u->lastname = $new['lastname'];
$u->phone = $new['phone'];
$u->address = $new['address'];
$u->email = $new['email'];
$u->zipcode = $new['zipcode'];
$u->updated_at = date('Y-m-d H:i:s');
$usertype = Usertype::find($new['utid']);
$u = $usertype->user()->save($u);
//saves user to db
if($u->save())
{
if($new['utid'] == 2){
//Styrer
$kid = Session::get('kid');
$kindergarden = Kindergarden::find($kid);
$u->group()->sync(array($kindergarden->leaderGroup()->gid));
}
else {
$groups = Input::get('groups');
if(is_array($groups))
{
$u->group()->sync($groups);
}
}
return Redirect::to('employee')
->with('message', 'Ansatt endret!');
}
else
{
//save unsuccessful
return Redirect::to('employee/' . $id . '/edit')
->with('register_message', 'Endring feilet.');
}
}
else
{
//validation unsuccessful
//Get validadtion errors
$errors = $u->errors();
if(Input::hasFile('picture')) {
$perrors = $e->errors();
if(isset($perrors)){
foreach($perrors->all() as $perror){
$errors->add($perror);
}
}
}
return Redirect::to('employee/'.$id.'/edit')
->withErrors($errors) // send back all errors to the login form
->withInput(Input::all()); // send back the input (not the password) so that we can repopulate the form
}
}`
Models:
Employeepicture.php
`private $rules = array(
'picture' => 'mimes:jpg,png,gif'
);
private $errors;
/**
* Validation method
*
* #return boolean
*/
public function validate($data) {
// make a new validator object
$v = Validator::make($data, $this->rules);
// check for failure
if ($v->fails()) { // set errors and return false
$this->errors = $v->errors();
return false;
}
// validation pass
return true;
}`
User.php
`private $rules = array(
'firstname' => 'required|max:40',
'lastname' => 'required|max:40',
'email' => 'required|email|unique:user', // make sure the email is an actual email
'phone' => 'required|numeric|digits_between:7,20',
'address' => 'required|min:3',
'picture' => 'mimes:jpg,jpeg,png,gif|max:2046',
'zipcode' => 'required|numeric|digits_between:1,4'
//'password' => 'required|min:3',
//'password_confirmation' => 'same:password'//required?
);
/**
* Valditation errors
*/
private $errors;
/**
* Validation method
*
* #return boolean
*/
public function validate($data, $update)
{
if (isset($update)) {
$this->rules['email'] = 'required|email|unique:user,email,' . $update . ',uid';
}
// make a new validator object
$v = Validator::make($data, $this->rules);
// check for failure
if ($v->fails())
{
// set errors and return false
$this->errors = $v->errors();
return false;
}
// validation pass
return true;
}
/**
* Validation errors
*/
public function errors()
{
return $this->errors;
}`
The edit view:
`#extends('employee.employeelayout')
#section('title', 'Endre ansatt')
#section('employeecontent')
<h3>Endre ansatt</h3>
#if (Session::has('register_message'))
<div id="register_message"><p>{{ Session::get('register_message') }}</p></div>
#endif
<ul>
#foreach($errors->all() as $error)
<li>{{ str_replace($eng, $nor, $error) }}</li>
#endforeach
</ul>
{{ Form::model($employee, array('route' => array('employee.update', $employee->uid), 'method' => 'PUT', 'files'=>true)) }}
<div class="form-group">
{{ Form::label('firstname', 'Fornavn', array('class'=>'control-label')) }}
{{ Form::text('firstname', null, array('class'=>'form-control', 'placeholder'=>'Fornavn')) }}
</div>
<div class="form-group">
{{ Form::label('lastname', 'Etternavn', array('class'=>'control-label')) }}
{{ Form::text('lastname', null, array('class'=>'form-control', 'placeholder'=>'Etternavn')) }}
</div>
<div class="form-group">
{{ Form::label('email', 'E-post', array('class'=>'control-label')) }}
{{ Form::text('email', null, array('class'=>'form-control', 'placeholder'=>'E-post')) }}
</div>
<div class="form-group">
{{ Form::label('phone', 'Telefonnummer', array('class'=>'control-label')) }}
{{ Form::text('phone', null, array('class'=>'form-control', 'placeholder'=>'Telefonnummer')) }}
</div>
<div class="form-group">
{{ Form::label('address', 'Adresse', array('class'=>'control-label')) }}
{{ Form::text('address', null, array('class'=>'form-control', 'placeholder'=>'Adresse')) }}
</div>
<div class="form-group">
{{ Form::text('zipcode', null, array('class'=>'form-control', 'placeholder'=>'Postnummer')) }}
</div>
<div class="form-group">
{{ Form::label('image', 'Bilde av ansatt(valgfritt): ') }}
{{ Form::file('picture', null, array('class'=>'input-block-level', 'placeholder'=>'Picture')) }}
#if($employee->employeePicture)
<h5>Nåværende bilde</h5>
<img class="small-pic" src="{{$employee->employeePicture->url}}"/><br>
{{ Form::checkbox('slett', 'slett'); }} Fjern
#endif
</div>
<div class="form-group">
{{ Form::label('utid', 'Brukertype', array('class'=>'control-label')) }}
{{ Form::select('utid', $usertypes, $employee->utid, array('class'=>'form-control','id'=>"select_usertype")) }}
</div>
<div class="form-group" id="group">
{{ Form::label('group', 'Avdeling', array('class'=>'control-label')) }}
#foreach($groups as $group)
#if ($employee->group->contains($group->gid))
<div class='checkbox'>{{ Form::checkbox('groups[]', $group->gid, true) }} {{ $group->name }}</div>
#else
<div class='checkbox'>{{ Form::checkbox('groups[]', $group->gid) }} {{ $group->name }}</div>
#endif
#endforeach
</div>
<div class="pull-right">
{{ Form::submit('Endre', array('class'=>'btn btn-primary'))}}
</div>
{{ Form::close() }}
<a class="btn btn-primary" href="{{ URL::to('employee') }}"><span class="glyphicon glyphicon-arrow-left"></span> Tilbake</a>`