Laravel app not saving data and not displaying any error - php

I am using controller store method to save data, I have the model,views and controllers in place. i m using Laravel resource routing and intend to use the controller to perform CRUD operation. However, nothing seems to work.
This is the Controller save method
public function store(Request $request)
{
//
$request->validate([
'adm'=>'required|unique:student',
'fullname'=>'required|alpha',
'dept'=>'required|alpha',
'course'=>'required|alpha',
'level'=>'required|alpha',
'feyear'=>'required|numeric',
'feser'=>'required|alpha',
'idnum'=>'unique:student|required|numeric|max:8',
'current_address'=>'required',
'permanent_address'=>'required',
'email'=>'unique:student|required|email',
'mobile'=>'unique:student|required|numeric',
'occupation'=>'nullable',
'occupation_place'=>'nullable',
'otherphone'=>'nullable:numeric|max:13',
'nextofkin'=>'nullable|alpha',
'nextofkinadd'=>'required',
'nextofkinphone'=>'required|numeric',
'placeofworkadd'=>'nullable',
'supervisoradd'=>'nullable'
]);
$std = new Student([
'adm'=> $request->get('adm'),
'fullname'=> $request->get('fullname'),
'dept'=> $request->get('dept'),
'course'=> $request->get('course'),
'level'=> $request->get('level'),
'feyear'=> $request->get('feyear'),
'feser'=> $request->get('feser'),
'idnum'=> $request->get('idnum'),
'current_address'=> $request->get('current_address'),
'permanent_address'=> $request->get('permanent_address'),
'email'=> $request->get('email'),
'mobile'=> $request->get('mobile'),
'occupation'=> $request->get('occupation'),
'occupation_place'=> $request->get('occupation_place'),
'otherphone'=> $request->get('otherphone'),
'nextofkin'=> $request->get('nextofkin'),
'nextofkinadd'=> $request->get('nextofkinadd'),
'nextofkinphone'=> $request->get('nextofkinphone'),
'placeofworkadd'=> $request->get('placeofworkadd'),
'supervisoradd'=> $request->get('supervisoradd')
]);
$std->save();
return redirect('/')->with('success', 'You have been added as an Student');
}
My Model
class Student extends Model
{
protected $fillable = [
'adm',
'fullname',
'dept',
'course',
'level',
'feyear',
'feser',
'idnum',
'current_address',
'permanent_address',
'email',
'mobile',
'occupation',
'occupation_place',
'otherphone',
'nextofkin',
'nextofkinadd',
'nextofkinphone',
'placeofworkadd',
'supervisoradd'
];
}
My form
<form name="frmRegistration" method="post" action="{{ route('student.store') }}">
#csrf
<br> <p class="text-white">Fill this form if you have not yet Registered as student</p>
<div class="form-group">
<label class="text-white" for="inputEmail">Enter Full Names</label>
<input type="text" class="form-control" name="fullname" id="inputName" placeholder="e.g. Miss. Jane Doe">
</div>
<div class="form-group">
<label class="text-white" for="inputEmail">Enter National ID/Passport Number</label>
<input type="text" class="form-control" name="idnum" id="inputID" placeholder="e.g. 21436587">
</div>
<div class="form-group">
<label class="text-white" for="no">Current Mobile Phone Number</label>
<input type="text" class="form-control" name="mobile" id="inputphone" placeholder="e.g. 0734567890">
</div>
<div class="form-group">
<label class="text-white" for="otherno">Other Mobile Phone Number</label>
<input type="text" class="form-control" name="othermobile" id="altmobile" placeholder="e.g. 0734567890">
</div>
<div class="form-group">
<label class="text-white" for="inputEmail">Enter email Address</label>
<input type="email" class="form-control" name="email" id="inputName" placeholder="e.g. janedoe#yahoo.com ">
</div>
<div class="form-group">
<label class="text-white" for="inputEmail">Enter Current Address</label>
<input type="text" class="form-control" name="current_address" id="inputName" placeholder="e.g. P.O. Box 123456789 -00200- Nairobi ">
</div>
<div class="form-group">
<label class="text-white" for="inputEmail">Enter Permanent Address (can be similar to the above) </label>
<input type="text" class="form-control" name="permanent_address" id="inputName" placeholder="e.g. P.O. Box 123456 -30108- Timboroa ">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Next of Kin</label>
<input type="text" class="form-control" id="nextofkin" name ="nextofkin" placeholder="e.g. Jane Doe">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Next of Kin Address</label>
<input type="text" class="form-control" id="nextofkinadd" name ="nextofkinadd" placeholder="e.g. P.O. Box 234 -00100- Nairobi">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Next of Kin Mobile Phone</label>
<input type="text" class="form-control" id="nextofkinphone" name ="nextofkinphone" placeholder="e.g. 0734567890">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Current Occupation (if None use N/A) </label>
<input type="text" class="form-control" id="inputAdmissionnumber" name ="occupation" placeholder="e.g. Network Administrator">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Place of Current Occupation ( if None use N/A)</label>
<input type="text" class="form-control" id="inputAdmissionnumber" name ="occupation_place" placeholder="e.g. Nairobi">
</div>
<div class="form-group">
<label class="text-white" for="inputsupname">Supervisor Telephone Number ( if None use N/A)</label>
<input type="text" class="form-control" name="supervisoradd" id="supphone" placeholder="e.g. 0734567890">
</div>
<div class="form-group">
<label class="text-white" for="inputsupname">Address of Current Place of Work ( if None use N/A)</label>
<input type="text" class="form-control" name="placeofworkadd" id="occuadd" placeholder="e.g. Rift Valley Technical Training Institute, P.O. Box 244 -30100-,Eldoret">
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Your Student Registration Number</label>
<input type="text" class="form-control" id="inputAdmissionnumber" name ="adm" placeholder="e.g. 117R0008">
</div>
<div class="form-group">
<label class="text-white" for="department">Select your Course's Department</label>
<select class="form-control" id="dept" name="dept">
<option>Automotive Engineering</option>
<option>Building & Civil Engineering</option>
<option>Business and Development Studies</option>
<option>Electrical & Electronic Engineering</option>
<option>Hospitality & Dietetics Management</option>
<option>Information Communication Technology</option>
<option>Mechanical and Automotive Engineering</option>
<option>Pharmacy & Chemical Science</option>
<option>Medical & Biological Sciences</option>
</select>
</div>
<div class="form-group">
<label class="text-white" for="admissionnumber">Course (in full as per registration)</label>
<input type="text" class="form-control" id="inputcourse" name="course" placeholder="e.g. Diploma in Information Communication Technology">
</div>
<div class="form-group">
<label class="text-white" for="courselevel">Select your current Course's Level</label>
<select class="form-control" id="select" name="level">
<option>Artisan</option>
<option>Craft</option>
<option>Diploma</option>
<option>Higher Diploma</option>
</select>
</div>
<div class="form-group">
<label class="text-white" for="year"> Final Examination Year</label>
<input type="number" class="form-control" id="datepicker" name="feyear" placeholder="e.g. 1994" min="1980" max="2018" value="2018">
</div>
<div class="form-group">
<label class="text-white" for="year"> Series</label>
<Select class="form-control" id="selectSeries" name="feser">
<option>July</option>
<option>November</option>
</select>
</div>
<div class="form-group">
<!--<a class="btn btn-primary btnNext" >Next Tab</a> --> <button type="submit" class="btn bg-primary btn-outline btn-xl js-scroll-trigger">Add</button></div>
</form>

Maybe, you could try with fill method to be more specific
try:
$std = new Student;
$std->fill($request->all());
$std->save();

Have you checked the Request data you are receiving? Try dumping it and checking if it's correct dd($request->all())
Check your logs too, laravel.log, php-errors.log, etc.
Also, your validator should return the validated data, like:
$validatedData = $request->validate([
'adm'=>'required|unique:student',
'fullname'=>'required|alpha',
etc....
]);
Then, if all the fields are in your fillable array, you can just do: Student::create($validatedData)
Any way, I would recommend you use Form Requests for validation, so your controller isn't so bloated.

try doing
$std = Student::create([
'adm'=> $request->get('adm'),
'fullname'=> $request->get('fullname'),
'dept'=> $request->get('dept'),
'course'=> $request->get('course'),
'level'=> $request->get('level'),
'feyear'=> $request->get('feyear'),
'feser'=> $request->get('feser'),
'idnum'=> $request->get('idnum'),
'current_address'=> $request->get('current_address'),
'permanent_address'=> $request->get('permanent_address'),
'email'=> $request->get('email'),
'mobile'=> $request->get('mobile'),
'occupation'=> $request->get('occupation'),
'occupation_place'=> $request->get('occupation_place'),
'otherphone'=> $request->get('otherphone'),
'nextofkin'=> $request->get('nextofkin'),
'nextofkinadd'=> $request->get('nextofkinadd'),
'nextofkinphone'=> $request->get('nextofkinphone'),
'placeofworkadd'=> $request->get('placeofworkadd'),
'supervisoradd'=> $request->get('supervisoradd')
]);
or the easier way if your $request fields are same as in fillable
$input=$request->all();
$std = Student::create($input);

Related

I want to update the recorded in data base. I want to send the "employee_id" on clicking save button. so that corresponding 'id' recorded is updated

I want to update the record of the corresponding id that is sent on clicking save button. I tried button tage, input tage and link tage but there is some mistake that I am making, but I don't know where?
This is my form
<form method="POST" action="handle_update.php">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">First name</label>
<input type="text" name="fname" value="'.$first_name.'" class="form-control" >
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Last name</label>
<input type="text" name="last_name" value="'.$last_name.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Email</label>
<input type="email" name="email" value="'.$email.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Designation</label>
<input type="text" name="designation" value="'.$designation.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Address</label>
<input type="address" name="address" value="'.$address.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Date of Joining</label>
<input type="date" name="joining_date" value="'.$joining_date.'" class="form-control">
</div>
<a name="update" role = "button" type="submit" href="handle_update.php?ployee_id='.$id2.'">Save</a>
</form>
Add a hidden input field that holds the value you want to submit. Change your <a> to a <button> that can submit your form. Change your code to:
<form method="POST" action="handle_update.php">
<input type="hidden" name="ployee_id" value="' . $id2 . '">
<div class="mb-3">
<label for="exampleInputEmail1" class="form-label">First name</label>
<input type="text" name="fname" value="'.$first_name.'" class="form-control" >
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Last name</label>
<input type="text" name="last_name" value="'.$last_name.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Email</label>
<input type="email" name="email" value="'.$email.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Designation</label>
<input type="text" name="designation" value="'.$designation.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Address</label>
<input type="address" name="address" value="'.$address.'" class="form-control">
</div>
<div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Date of Joining</label>
<input type="date" name="joining_date" value="'.$joining_date.'" class="form-control">
</div>
<button type="submit" name="update">Save</button>
</form>
More on forms: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form
More on hidden inputs: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/hidden

Old data not displayed in edit.blade.php

This is my edit method:
public function edit(User $user)
{
// ...
return view('admin.biodata.edit',
[
'title' => 'Edit Biodata',
'active' => 'biodata',
'majors' => Major::all(),
'biodata' => $user
]
);
}
edit.blade.php
#extends('admin.adminDashboard.layouts.main')
#section('container')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2"></div>
<h1>Edit Student</h1>
<div class="container">
<form action="{{url('admin/biodata')}}" method="POST">
#csrf
<input type="hidden" name="id" value="{{ $biodata->id }}">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name" name="name" placeholder="Enter name" value="{{$biodata->name}}">
</div>
<div class="form-group">
<label for="nrp">NRP</label>
<input type="text" class="form-control" id="nrp" name="nrp" placeholder="Enter NRP" value="{{$biodata->nrp}}">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Enter email" value="{{$biodata->email}}">
</div>
<div class="form-group">
<label for="address">Address</label>
<input type="text" class="form-control" id="address" name="address" placeholder="Enter address" value="{{$biodata->address}}">
</div>
<div class="form-group">
<label for="generation">Generation</label>
<input type="text" class="form-control" id="generation" name="generation" placeholder="Enter generation" value="{{$biodata->generation}}">
</div>
<div class="form-group">
<label for="major">Major</label>
<select class="form-control" id="major" name="major_id">
#foreach ($majors as $major)
<option value="{{$major->id}}">{{$major->nama_jurusan}}</option>
#endforeach
</select>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
#endsection
When I press the edit button from the index view, the old data is not displayed in the view admin.biodata.edit. I thought I have already passed the user data through the biodata variable.
Replace the value in the template with
value="{{old('name',$biodata->name)}}"

send email selecting checkbox html

I trying my cients select what services they want on email. I recevied the email but services are empty, mybe my php file is wrong. Thank you in advance
<h3>Tell us your inquiries</h3>
<hr>
<form id="contact-form" action="mailto:info#dosaladesign.com" method="post" onsubmit="return checkform(this);">
<div class="form-group">
<label for="firstname">First Name <span class="form-required" title="This field is required.">*</span></label>
<input type="text" name="firstname" class="form-control half" id="firstname" required>
</div>
<div class="form-group">
<label for="lastname">Last Name <span class="form-required" title="This field is required.">*</span></label>
<input type="text" name="lastname" class="form-control half" id="lastname" required>
</div>
<div class="form-group">
<label for="email">E-mail <span class="form-required" title="This field is required.">*</span></label>
<input type="email" name="email" class="form-control half" id="email" required>
</div>
<div class="form-group">
<label for="subject">Zip Code <span class="form-required" title="This field is required.">*</span></label>
<input type="text" name="zipcode" class="form-control half" id="zipcode" required>
</div>
<div class="form-group" >
<label for="email">Select Services</label>
<div class="row1">
<div class="col1"><input id="chk1" type="checkbox"><label>As-Built</label></div>
<div class="col1"><input id="chk2" type="checkbox" onclick="myFunction('New Construction Design','chk2')"/><label>New Construction Design</label></div>
<div class="col1"><input id="chk3" type="checkbox" onclick="myFunction('Residential Remodels','chk3')"/><label>Residential Remodels</label></div>
<div class="col1"><input id="chk4" type="checkbox" onclick="myFunction('Residential Additions','chk4')"/><label>Residential Additions</label></div>
<div class="col1"><input id="chk5" type="checkbox" onclick="myFunction('3D Modeling and Renderings','chk5')"/><label>3D Modeling and Renderings</label></div>
<div class="col1"><input id="chk6" type="checkbox" onclick="myFunction('Interior Design','chk6')"/><label>Interior Design</label></div>
<div class="col1"><input id="chk7" type="checkbox" onclick="myFunction('Space Planning and Furniture Layouts','chk7')"/><label>Space Planning and Furniture Layouts</label></div>
<div class="col1"><input id="chk8" type="checkbox" onclick="myFunction('Custom Furniture Design','chk8')"/><label>Custom Furniture Design</label></div>
<div class="col1"><input id="chk9" type="checkbox" onclick="myFunction('Landscape Design','chk9')"/><label>Landscape Design</label></div>
</div>
</div>
<div class="form-group">
<label for="message">Message <span class="form-required" title="This field is required.">*</span></label>
<textarea name="message" class="form-control" rows="4" id="message" required></textarea>
Ensure that your input elements contain a name attribute and value. According to the specs: If no name is specified, or name is empty, the input's value is not submitted with the form.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name

How to correctly fetch String values from the database in Laravel

For my website, when this particular page is clicked I want the form to be populated with data from the database. Here is the code for the form:
<form class="form-horizontal" role="form" method="post" action="{{url('/company-profile/update')}}">
{{ csrf_field() }}
#foreach($getAllDetails as $list)
<div class="form-group">
<div class="col-sm-10">
<label for="companyname" class="control-label">Company Name</label>
<input type="text" class="form-control" id="companyname" name="companyname" placeholder="Enter Company Name" value={{$list->companyName}}>
</div>
</div>
<div class="form-group">
<div class="col-xs-5 col-sm-4 col-md-3">
<label for="shortCode" class="control-label">Short Code</label>
<input class="form-control" id="shortCode" name="shortCode" placeholder="Short Code" value={{$list->shortCode}}>
</div>
<div class="col-xs-7 col-sm-6 col-md-7">
<label for="telnum" class="control-label">Telephone Number</label>
<input type="tel" class="form-control" id="telnum" name="telnum" placeholder="Tel. number" value={{$list->phoneNo}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="emailid" class="control-label">Email</label>
<input type="email" class="form-control" id="emailid" name="emailid" placeholder="Email" value={{$list->emailAddress}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="logoPath" class="control-label">Logo Path</label>
<input type="" class="form-control" id="logoPath" name="logoPath" placeholder="Enter Logo Path" value={{$list->logoPath}}>
</div>
</div>
<div class="form-group">
<div class="col-sm-10">
<label for="feedback" class="control-label">Contact Address</label>
<textarea class="form-control" id="address" name="address" rows="2" value={{$list->contactAddress}}></textarea>
</div>
</div>
#endforeach
<div class="form-group">
<div class="col-sm-10">
<button type="submit" class="btn btn-success">Submit</button>
</div>
</div>
</form>
This issue is:
For example, if I want to fetch the company name {{$list->companyName}} only the first word gets displayed. For example, If the company's name is National Film Institute, only National gets displayed.
Here is code the for my index function in the controller:
public function index()
{
$data['getAllDetails']= DB::table('tblcompany')->get();
return view('companyProfile.companyProfile', $data);
}
Change
value={{$list->your_field}}
to
value="{{$list->your_field}}"

Only created_at and Updated_at column accepting data in my newly Created voyager laravel Database table

i add a new table using the voyager database menu. the problem is that i can't create new data with my newly created database... anytime i try to insert a new data, its only the created_at and Updated_at column that is populated
and the code:
<form clas[s="form-edit-add" role="form"][1]
action="#if(isset($dataTypeContent->id)){{
route('voyager.'.$dataType->slug.'.update', $dataTypeContent->id) }}#else{{
route('voyager.'.$dataType->slug.'.store') }}#endif"
method="POST" enctype="multipart/form-data">
<!-- PUT Method if we are editing -->
#if(isset($dataTypeContent->id))
{{ method_field("PUT") }}
#endif
<!-- CSRF TOKEN -->
{{ csrf_field() }}
<div class="panel-body">
<div class="form-group">
<label for="name">Staff_id</label>
<input type="text" class="form-control"
name="Staff_id"
placeholder="Staff_id" id="Staff_id"
value="#if(isset($dataTypeContent-
>Staff_id)){{ old('Staff_id', $dataTypeContent->Staff_id)
}}#else{{old('Staff_id')}}#endif">
</div>
<div class="form-group">
<label for="name">Title</label>
<input type="text" class="form-control"
name="title"
placeholder="title" id="title"
value="#if(isset($dataTypeContent-
>title)){{ old('title', $dataTypeContent->title)
}}#else{{old('title')}}#endif">
</div>
div class="form-group">
<label for="name">First_Name</label>
<input type="text" class="form-control"
name="first_name"
placeholder="first_name" id="first_name"
value="#if(isset($dataTypeContent-
>first_name)){{ old('first_name', $dataTypeContent->first_name)
}}#else{{old('first_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Middle_Name</label>
<input type="text" class="form-control"
name="middle_name"
placeholder="middle_Name"
id="middle_name"
value="#if(isset($dataTypeContent-
>middle_name)){{ old('middle_name', $dataTypeContent->middle_name)
}}#else{{old('middle_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Last_Name</label>
<input type="text" class="form-control"
name="last_name"
placeholder="Last_Name" id="last_name"
value="#if(isset($dataTypeContent-
>last_name)){{ old('last_name', $dataTypeContent->last_name)
}}#else{{old('last_name')}}#endif">
</div>
<div class="form-group">
<label for="name">Gender</label>
<input type="text" class="form-control"
name="gender"
placeholder="gender" id="gender"
value="#if(isset($dataTypeContent-
>gender)){{ old('gender', $dataTypeContent->gender)
}}#else{{old('gender')}}#endif">
</div>
<div class="form-group">
<label for="name">DOB</label>
<input type="text" class="form-control"
name="dob"
placeholder="dob" id="dob"
value="#if(isset($dataTypeContent->dob))
{{ old('dob', $dataTypeContent->dob) }}#else{{old('dob')}}#endif">
</div>
<div class="form-group">
<label for="name">Phone_Number</label>
<input type="text" class="form-control"
name="phone_number"
placeholder="phone_number"
id="phone_number"
value="#if(isset($dataTypeContent-
>phone_number)){{ old('phone_number', $dataTypeContent->phone_number)
}}#else{{old('phone_number')}}#endif">
</div>
<div class="form-group">
<label for="name">Unit</label>
<input type="text" class="form-control"
name="unit"
placeholder="unit" id="unit"
value="#if(isset($dataTypeContent->unit))
{{ old('unit', $dataTypeContent->unit)
}}#else{{old('unit')}}#endif">
</div>
<div class="form-group">
<label for="name">Department</label>
<input type="text" class="form-control"
name="department"
placeholder="department" id="department"
value="#if(isset($dataTypeContent-
>department)){{ old('department', $dataTypeContent->department)
}}#else{{old('department')}}#endif">
</div>
<div class="form-group">
<label for="name">Company</label>
<input type="text" class="form-control"
name="company"
placeholder="company" id="company"
value="#if(isset($dataTypeContent-
>company)){{ old('company', $dataTypeContent->company)
}}#else{{old('company')}}#endif">
</div>
<div class="form-group">
<label for="name">Employment_status</label>
<input type="text" class="form-control"
name="employment_status"
placeholder="employment_status"
id="employment_status"
value="#if(isset($dataTypeContent-
>employment_status)){{ old('employment_status', $dataTypeContent-
>employment_status) }}#else{{old('employment_status')}}#endif">
</div>
<div class="form-group">
<label for="name">Guarantor1</label>
<input type="text" class="form-control"
name="guarantor1"
placeholder="guarantor1" id="guarantor1"
value="#if(isset($dataTypeContent-
>guarantor1)){{ old('guarantor1', $dataTypeContent->guarantor1)
}}#else{{old('guarantor1')}}#endif">
</div>
<div class="form-group">
<label for="name">Guarantor2</label>
<input type="text" class="form-control"
name="guarantor2"
placeholder="guarantor2" id="guarantor2"
value="#if(isset($dataTypeContent-
>guarantor2)){{ old('guarantor2', $dataTypeContent->guarantor2)
}}#else{{old('guarantor2')}}#endif">
</div>
<div class="form-group">
<label for="name">Academic_record</label>
<input type="text" class="form-control"
name="academic_record"
placeholder="academic_record"
id="academic_record"
value="#if(isset($dataTypeContent-
>academic_record)){{ old('academic_record', $dataTypeContent-
>academic_record) }}#else{{old('academic_record')}}#endif">
</div>
<div class="form-group">
<label for="name">Work Experience</label>
<input type="text" class="form-control"
name="work_experience"
placeholder="work_experience"
id="work_experience"
value="#if(isset($dataTypeContent-
>work_experience)){{ old('work_experience', $dataTypeContent-
>work_experience) }}#else{{old('work_experience')}}#endif">
</div>
<div class="form-group">
<label for="name">Note</label>
<input type="text" class="form-control"
name="notes"
placeholder="notes" id="notes"
value="#if(isset($dataTypeContent-
>notes)){{ old('notes', $dataTypeContent->notes)
}}#else{{old('notes')}}#endif">
</div>
</div><!-- panel-body -->
<div class="panel-footer">
<button type="submit" class="btn btn-
primary">Submit</button>
</div>
</form>
<iframe id="form_target" name="form_target"
style="display:none"></iframe>
<form id="my_form" action="{{ route('voyager.upload') }}"
target="form_target" method="post"
enctype="multipart/form-data"
style="width:0;height:0;overflow:hidden">
{{ csrf_field() }}
<input name="image" id="upload_file" type="file"
onchange="$('#my_form').submit();this.value='';">
<input type="hidden" name="type_slug" id="type_slug"
value="{{ $dataType->slug }}">
</form>
this is my Model code for the Profiles table:
<?php
namespace TCG\Voyager\Models;
use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Facades\Voyager;
class Profile extends Model
{
protected $table = 'profiles';
protected $fillable = [
'Staff_id',
'Title',
'First_name',
'Middle_name',
'last_name',
'Gender',
'DOB',
'Phone_number',
'Company',
'Department',
'Unit',
'Date_employed',
'Date_of_exit',
'Mode_of_exit',
'Employment_Status',
'Guarantor1_Details',
'Guarantor2_Details',
'Academic_Record',
'Work_Experience',
'Notes',
];
}
Add this line to the model to allow the remaining data to enter the database
protected $fillable = ['name_of_column', 'name_of_thenextcolumn'];

Categories