I am currently doing a project called Doctor Management System.In this project I am stuck at from a option value i want to get the id that are submitted by the user & update my the id into my databases .But I cannot do it. Please help me MY EDIT FILE IS
<?php $active="profile"; ?>
@extends('admin.dashboard')
@section('content')
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
User Profile
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
<li class="active">User profile</li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-10">
<!-- general form elements -->
<div class="box box-primary">
<div class="box-header with-border">
<h3 class="box-title">Quick Example</h3>
</div>
<!-- /.box-header -->
<!-- form start -->
<form action="" role="form" method="post" enctype="multipart/form-data">
<div class="box-body">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" id="name" value="">
</div>
<div class="form-group">
<label for="institute">Institute Name</label>
<input type="text" class="form-control" name="institute" id="institute" value="">
</div>
<div class="form-group">
<label for="education">Degree</label>
<input type="text" class="form-control" name="education" id="education" value="">
</div>
<div class="form-group">
<label for="specialty">Specialty</label>
<input type="text" class="form-control" name="specialty" id="specialty" value="">
</div>
<div class="form-group">
<label for="phone">Mobile No.</label>
<input type="number" class="form-control" name="phone" id="phone" value="">
</div>
<div class="form-group">
<label for="time">Visiting Time</label>
<input type="text" class="form-control" name="time" id="time" value="">
</div>
<div class="form-group">
<label for="fee">Fee</label>
<input type="number" class="form-control" name="fee" id="fee" value="">
</div>
<div class="form-group">
<label for="division">Division</label>
<select id="division_id">
@foreach($divisions as $division)
<option value=""></option>
@endforeach
</select>
</div>
<div >
<p>
{!! Form::label('Chose the picture:') !!}
{!! Form::file('pic') !!}
</p>
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button type="submit" class="btn btn-primary">Submit</button>
<input type="hidden" name="_token" value="">
<input type="hidden" name="id" value="">
</div>
</form>
</div>
<!-- /.box -->
</div>
<!--/.col (left) -->
</div>
<!-- /.row -->
</section>
<!-- /.content -->
@endsection
My Controller is
public function getUpdate($id) {
$divisions = Division::all();
$profile = Auth::user();
$doctor=Doctor::find($id);
// $post = Post::find($post_id);
// if(!$post) {
// return redirect()->route('blog.index')->with(['fail' => 'Post Not Found']);
// }
return view('admin.article.edit')
->with('divisions',$divisions)
->with('profile',$profile)
->with('doctor',$doctor);
}
public function postUpdate(Request $request ) {
$this->validate($request, [
'name' => 'required|max:120',
'fee' => 'required|max:5',
'division_id' => '',
'district_id' => '',
'dcategory_id' => '',
'education' => '',
'institute' => '',
'specialty' => '',
'hospital' => '',
'time' => '',
'phone' => ''
]);
$doctor = Doctor::find($request['id']);
$doctor->name = $request['name'];
$doctor->division_id = $request['division_id'];
$doctor->district_id = $request['district_id'];
$doctor->dcategory_id = $request['dcategory_id'];
$doctor->institute = $request['institute'];
$doctor->education = $request['education'];
$doctor->specialty = $request['specialty'];
$doctor->hospital = $request['hospital'];
$doctor->phone = $request['phone'];
$doctor->time = $request['time'];
$doctor->fee = $request['fee'];
// $file = Input::file('pic');
// $img = Image::make($request->file('pic')->getRealPath());
// //$img = Image::make($file);
// Response::make($img->encode('jpeg'));
// $doctor->pic = $img;
$doctor->update();
return redirect()->route('profile')->with(['success' => 'Profile Successfully Updated']);
}
Please help me solving this. Thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire