laravel The PUT method is not supported for this route. Supported methods: GET, HEAD - laravel

I have a problem. i want to create an annnouncements from my post table
by making 2 combined forms but i don't if this works cause I'm new to the laravel and this is what i have
the blade
<form action="{{route('superadminpage.admin_announce.admin_view_announce',$announces->id)}}" method="POST" enctype="multipart/form-data">
<div class="container">
<div class="jumnbotron">
<h1> </h1>
<br>
<div class="container">
<div class="jumnbotron">
<h1> Notification Announcement </h1>
<br>
<form method="POST" action="{{action('AdminController#store',$announces->id)}}">
{{csrf_field() }}
<div class="card">
<div class="card-body">
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{$announces->departments->department}} "> <h3> </h3>
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{ $announces->Title}}"> <br>
<input type="hidden" name="_method" value="PUT" />
<input type="text" name="title" class="form-control" value="{{ $announces->Content}}"> <br>
</div>
<input type="submit" name="submit" class="btn btn-primary" value="notify"/>
</div>
</form>
edit
</div>
</div>
</form>
the Controller
public function view($id)
{
$announces = Post::find($id);
return view('superadminpage.admin_announce.admin_view_announce',compact('announces', 'id'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$data = request()->validate([
'department_id' => ['required', 'string', 'max:255'],
'Title' => ['required', 'string', 'max:255'],
'Content' => ['required', 'string', 'max:255'],
]);
$data = Announcement::create([
'department_id' => $data['department_id'],
'Title' => $data['Title'],
'Content' => $data['Content'],
]);
return redirect('admin_update')->with('success', 'Events has been added');
}
and the Route
Route::get('/admin_update', 'AdminController#index');
Route::get('/admin_view_announce/{id}', 'AdminController#view')->name('superadminpage.admin_announce.admin_view_announce');
Route::put('/admin_view_announce', 'AdminController#store');
Route::get('/admin_announce_create/{id}', 'AdminController#show');
Route::get('/admin_announce_editform/{id}', 'AdminController#edit')->name('superadminpage.admin_announce.admin_announce_editform');
Route::put('/admin_announce_editform/{id}', 'AdminController#update')->name('superadminpage.admin_announce.admin_announce_editform');
NOTE:(I'm not using an eloquent here i just fetch the data from the Post to the Announcement that showed in the blade)

Related

ArgumentCountError Too few arguments

I want to add data in database in Laravel, but I get error.
This is my Error:
ArgumentCountError
Too few arguments to function App\Http\Requests\Admin\Categories\StoreRequest::Illuminate\Foundation\Providers{closure}(), 0 passed in E:\xampp\htdocs\cylinders\cylinders\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php on line 124 and exactly 1 expected
Here is my Route:
Route::post('', [CategoriesController::class, 'store'])->name('admin.categories.store');
my page:
<form action="{{ route('admin.categories.store') }}" method="post">
#csrf
<div class="card-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Slug</label>
<input type="text" class="form-control" name="slug">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Title</label>
<input type="text" class="form-control" name="title">
</div>
</div>
</div>
</div>
<!-- /.card-body -->
<div class="card-footer">
<button type="submit" class="btn btn-primary float-left">Save</button>
</div>
</form>
my Contoller:
public function store(StoreRequest $request)
{
$validatedData = $request->validate();
$createdCategory = Category::create([
'title' => $validatedData['title'],
'slug' => $validatedData['slug'],
]);
if(!$createdCategory){
return back()->with('failed', 'Failed to Create Category.');
}
return back()->with('success', 'Success to Create Category.');
}
my Request:
<?php
namespace App\Http\Requests\Admin\Categories;
use Illuminate\Foundation\Http\FormRequest;
class StoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* #return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* #return array
*/
public function rules()
{
return [
'title' => 'required|min:3|max:128|unique:categories,title',
'slug' => 'required|min:3|max:128|unique:categories,slug',
];
}
}

Laravel: Display of validation errors not shown

I'm having a problem viewing validation errors in the blade view; this is the code below.
Controller (ClientController)
public function store(Request $request) {
$request->validate([
'name' => 'required',
'surname' => 'required',
'diagnosis' => 'required',
]);
Client::create([
'name'=>$request->name,
'surname'=>$request->surname,
'city'=>$request->city,
'diagnosis'=>$request->diagnosis,
]);
return redirect(route('client.index'))->with('message','The customer was successfully saved');
}
View (client.create)
<x-layout>
<div class="container">
#if ($errors->any())
<div class="alert alert-danger">
<ul>
#foreach ($errors->all() as $error)
<li>{{ $error }}</li>
#endforeach
</ul>
</div>
#endif
<form action="{{route('client.store')}}" method="post">
#csrf
<div class="row mt-3">
<div class="col-12 col-md-6">
<div class="mb-3">
<label for="name" class="form-label">Nome</label>
<input type="text" class="form-control p-3" name="name" required>
</div>
<div class="mb-3">
<label for="surname" class="form-label">Cognome</label>
<input type="text" class="form-control p-3" name="surname" required>
</div>
<div class="col-12">
<div class="mb-3">
<label for="diagnosis" class="form-label">Diagnosi</label>
<input type="text" class="form-control p-3" name="diagnosis" required>
</div>
</div>
<button type="submit" class="btn btn-primary mb-5 py-3 px-5 mt-3 ms-3">Add</button>
</div>
</div>
</form>
</div>
</x-layout>
I have followed the documentation but am unable to understand where the problem is.
Laravel documentation
Thanks to those who will help me
CONTROLLER UPDATE:
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('client.create');
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required',
'surname' => 'required',
'diagnosis' => 'required',
]);
//dd($request->all());
Client::create([
'name'=>$request->name,
'surname'=>$request->surname,
'city'=>$request->city,
'diagnosis'=>$request->diagnosis,
'stay'=>$request->stay
]);
return redirect(route('client.index'))->with('message','The customer was successfully saved');
}
Index is a blade view that contains the customer table (this works fine).
The problem is the error messages I would like to see in the create view if an input is required and not compiled
So after checking all components, it has been under our nose the whole time.
All your inputs have the required attribute:
<div class="mb-3">
<label for="name" class="form-label">Nome</label>
<input type="text" class="form-control p-3" name="name" required>
</div>
<div class="mb-3">
<label for="surname" class="form-label">Cognome</label>
<input type="text" class="form-control p-3" name="surname" required>
</div>
<div class="col-12">
<div class="mb-3">
<label for="diagnosis" class="form-label">Diagnosi</label>
<input type="text" class="form-control p-3" name="diagnosis" required>
</div>
</div>
This way the request is not sent, because the browser actively needs to fulfil all requirements to start the request to client.create
If you would remove one of these attributes and then not fill it in and submit, it will cause the errors to show.
However, we concluded that it is better to keep the required attribute in, as it is better to prevent a call to the webserver than to only let laravel do the work of validation.
The laravel validation is more useful for ajax/api calls, where there is no frontend to prevent you from making the request, like this:
//required jquery
$.ajax({
url: '/your/url/here',
method: 'POST',
data: [
name: 'somename',
surname: 'somesurname',
],
success(response) {
console.log('Yay, it succeeded')
},
error(error) {
//I havent worked with jquery in a while, the error should be in error object
console.log(error);
}
})
Or how I like to do it in vue, with axios:
//requires axios
axios
.post('/url/here', {
surname: 'somesurname',
diagnosis: 'somediagnosis',
})
.then(response => {
console.log('Yay, it succeeded')
})
.catch(error => {
console.log('Error', error)
})
You can see in the last two examples, as there is no frontend to prevent this request from being made, you now at least make sure laravel is not going to run it's logic with missing variables, which would cause a crash.

How can I solve 404 errors in Laravel 7?

I'm making a registration form using Laravel 7, my form has a "preview" step where users first check the details and either submit the details as they are or edit. The actual submission of the details happens in the blade file named preview.blade.php and this is where I have placed the form action for posting the data. This part works well, the edit part is the one with the problem as it gives 404 error. Please help.
In my register.blade.php:
<form method="post" action="{{ url('/preview-details') }}" id="regForm">
{{ csrf_field() }}
<div class="form-group">
<label for="region">Your Region</label><span class="text-danger">*</span>
<input type="text" class="form-control" name="region" id="region" placeholder="e.g Westlands" required>
</div>
<label for="start_date">Date</label><span class="required">*</span>
<input type="date" class="form-control" id="start_date" name="start_date"
value="{{ old('start_date') }}" required>
<!--Other fields here-->
</form>
In my preview.blade.php:
<div>
<a href="{{route('edit_preview')}}">
<button type="button" class="btn btn-primary btn-sm"
style="float:right;"><i class="fas fa-edit"> </i>Edit</button>
</a>
</div>
<form method="post" action="{{ url('/client-registration') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="region">Your Region</label><span class="text-danger">*</span>
<input type="text" class="form-control" name="region" id="region" placeholder="e.g Westlands" required>
</div>
<label for="start_date">Date</label><span class="required">*</span>
<input type="date" class="form-control" id="start_date" name="start_date"
value="{{ old('start_date') }}" required>
<!--Other fields here-->
</form>
In my edit_preview.php (this one shows 404 error):
<form method="post" action="{{ url('/client-registration') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="region">Your Region</label><span class="text-danger">*</span>
<input type="text" class="form-control" name="region" id="region" placeholder="e.g Westlands" required>
</div>
<label for="start_date">Date</label><span class="required">*</span>
<input type="date" class="form-control" id="start_date" name="start_date"
value="{{ old('start_date') }}" required>
<!--Other fields here-->
</form>
In my Routes file:
Route::get('/client-registration', 'Auth\Client\RegisterController#create')->name('client-registration');
Route::post('/client-registration', 'Auth\Client\RegisterController#store');
Route::post('/preview-details', 'Auth\Client\PreviewRegisterDetailsController#confirmation')->name('preview-details');
Route::post('/preview-details-existing', 'Auth\Client\PreviewDetailsExistingClientController#confirmation')->name('preview-existing');
Route::post('/edit_preview', 'Auth\Client\EditRegisterDetailsController#editDetails')->name('edit_preview');
In my Preview Controller (It works well):
class PreviewRegisterDetailsController extends Controller
{
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('guest');
}
// Validating the User
public function confirmation(Request $request)
{
$categories = Category::all();
$request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'telephone_number' => 'required|digits:10',
'email' => 'required|string|email|max:255|unique:users','regex:/^[\w\-\.\+]+\#[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/',
'password' => 'required|string|min:6|confirmed',
'password_confirmation' => 'required',
'region' => 'required|string',
'description' => 'required|string|max:2500',
'start_date' => 'required|date',
'client_region' => 'string|max:500',
'client_category' => 'integer|max:255',
]);
$data = $request->all();
return view('auth.client.preview', compact('categories', 'data'));
}
}
In my edit details controller:
class EditRegisterDetailsController extends Controller
{
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('guest');
}
// Validating the User
public function editDetails(Request $request)
{
$categories = Category::all();
$request->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'telephone_number' => 'required|digits:10',
'email' => 'required|string|email|max:255|unique:users','regex:/^[\w\-\.\+]+\#[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,6}$/',
'password' => 'required|string|min:6|confirmed',
'password_confirmation' => 'required',
'region' => 'required|string',
'description' => 'required|string|max:2500',
'start_date' => 'required|date',
'client_region' => 'string|max:500',
'client_category' => 'integer|max:255',
]);
$data = $request->all();
return view('auth.client.edit_preview', compact('categories', 'data'));
}
}

How to insert a row in Laravel given that one field does not have a default value?

I try to insert the session user id in form but it was show me error this:
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value (SQL: insert into stocks (product_name, product_code, details, price, cost, quntity, updated_at, created_at) values (basmati Rice, 23432, dskljsdlkks;lk; ;ks;lvk, 40, 75, 100kg, 2019-09-09 08:43:12, 2019-09-09 08:43:12))
I think error on this line of code which I used for store the session id
<input type="hidden" name="user_id"
value="{{ $request->session()->put('user',$request->input('id')) }}"
> class="form-control">
This is my create blade page, which I make a form and try to insert the form fields.
#extends('layouts.app')
#section('content')
<div class="row">
<div class="col-md-12">
#if(count($errors) > 0)
<div class="alert alert-danger">
<ul>
#foreach($errors->all() as $error)
<li>{{$error}}</li>
#endforeach
</ul>
</div>
#endif
#if(\Session::has('success'))
<div class="alert alert-success">
<p>{{ \Session::get('success') }}</p>
</div>
#endif
<div class="card">
<div class="card-header">
<h5 class="title">Add New Product on Stock</h5>
</div>
<div class="card-body">
<form method="post" action="{{url('stock')}}">
{{csrf_field()}}
<div class="row">
<div class="col-md-6 pr-1">
<div class="form-group">
<label>Product Name</label>
<input type="text" name="user_id"
value="{{Auth::user()->id }}" class="form-control">
<input type="text" name="product_name" class="form-control" placeholder="Enter Product Name" />
</div>
</div>
<div class="col-md-6 pl-1">
<div class="form-group">
<label>Product Code</label>
<input type="text" name="product_code" class="form-control" placeholder="Enter product_code" />
</div>
</div>
</div>
</br>
<div class="row">
<div class="col-md-4 pr-1">
<div class="form-group">
<label>Price</label>
<input type="text" name="price" class="form-control" placeholder="Enter price" />
</div>
</div>
<div class="col-md-4 px-1">
<div class="form-group">
<label>Cost</label>
<input type="text" name="cost" class="form-control" placeholder="Enter cost" />
</div>
</div>
<div class="col-md-4 pl-1">
<div class="form-group">
<label>Quantity</label>
<input type="text" name="quntity" class="form-control" placeholder="Enter quntity" />
</div>
</div>
</div>
</br>
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label>Details</label>
<input type="text" name="details" class="form-control" placeholder="Enter details" />
</div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" />
</div>
</form>
</div>
</div>
#endsection
this is my controller file of stock
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Stock;
use Auth;
class StockController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$stocks = Stock::all()->toArray();
return view('stock.index', compact('stocks'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('stock.create');
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'user_id' =>'required',
'product_name' => 'required',
'product_code' => 'required',
'details' => 'required',
'price' => 'required',
'cost' => 'required',
'quntity' => 'required'
]);
$stock = new Stock([
'user_id' => Auth::user()->user_id,
'product_name' => $request->get('product_name'),
'product_code' => $request->get('product_code'),
'details' => $request->get('details'),
'price' => $request->get('price'),
'cost' => $request->get('cost'),
'quntity' => $request->get('quntity')
]);
$stock->save();
return redirect()->route('stock.index')->with('success', 'Data Added');
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
$stock = Stock::find($id);
return view('stock.edit', compact('stock', 'id'));
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, [
'product_name' => 'required',
'product_code' => 'required',
'details' => 'required',
'price' => 'required',
'cost' => 'required',
'quntity' => 'required'
]);
$stock = Stock::find($id);
$stock->product_name = $request->get('product_name');
$stock->product_code = $request->get('product_code');
$stock->details = $request->get('details');
$stock->price = $request->get('price');
$stock->cost = $request->get('cost');
$stock->quntity = $request->get('quntity');
$stock->save();
return redirect()->route('stock.index')->with('success', 'Data Updated');
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$stock = Stock::find($id);
$stock->delete();
return redirect()->route('stock.index')->with('success', 'Data Deleted');
}
}
You don't have to use the $request->input('id') to get the user id .
Simply use
Session::flash(Auth::user()->id);
For your code ,
<input type="hidden" name="user_id"
value="{{Auth::user()->id, Session::flash(auth::user()->id) }}"
> class="form-control">
And in your controller ,
when you are trying to save the user_id variable ,
EDIT ::::
$stock = new Stock([
'user_id' => Auth::user()->id,
'product_name' => $request->get('product_name'),
'product_code' => $request->get('product_code'),
'details' => $request->get('details'),
'price' => $request->get('price'),
'cost' => $request->get('cost'),
'quntity' => $request->get('quntity')
]);
Use the session variable to store ,.
Or you can directly store the user_id using Auth::user()->id in that line ,
'user_id' => Auth::user()->user_id,
change this:
$request->session()->put('user',$request->input('id'))
to like this:
Session::set('user',$request->input('id'));
Make attention, you need pass the $request to your view, so you can use the request data. Otherwise create a variable $user_id and pass it to your view blade. in this case you can do:
Session::set('user',$user_id);

Laravel View Error

public function index()
{
$students = Student::all()->toArray();
return view('student.index', compact('students'));
}
/**
* Show the form for creating a new resource.
*
* #return \Illuminate\Http\Response
*/
public function create()
{
return view('student.create');//
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required',
'mothers_first_name' => 'required',
'mothers_last_name' => 'required',
'mothers_age' => 'required',
'fathers_first_name' => 'required',
'fathers_last_name' => 'required',
'fathers_age' => 'required'
]);
$student = new Student([
'first_name' => $request->get('first_name'),
'last_name' => $request->get('last_name'),
'Age' => $request->get('Age'),
'Address' => $request->get('Address'),
'Grade_Level' => $request->get('Grade_Level'),
'mothers_first_name' => $request->get('mothers_first_name'),
'mothers_last_name' => $request->get('mothers_last_name'),
'mothers_age' => $request->get('mothers_age'),
'fathers_first_name' => $request->get('fathers_first_name'),
'fathers_last_name' => $request->get('fathers_last_name'),
'fathers_age' => $request->get('fathers_age')
]);
$student->save();
return redirect()->route('student.index')->with('success', 'New teacher data successfully added');
}
/**
* Display the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function edit($id)
{
$student = Student::find($id);
return view('student.edit', compact('student', 'id'));
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param int $id
* #return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$this->validate($request, [
'first_name' => 'required',
'last_name' => 'required',
'Age' => 'required',
'Address' => 'required',
'Grade_Level' => 'required'
]);
$student = Student::find($id);
$student->first_name = $request->get('first_name');
$student->last_name = $request->get('last_name');
$student->Age = $request->get('Age');
$student->Address = $request->get('Address');
$student->Grade_Level = $request->get('Grade_Level');
$student->save();
return redirect()->route('student.index')->with('success', 'Student data successfully updated');
}
/**
* Remove the specified resource from storage.
*
* #param int $id
* #return \Illuminate\Http\Response
*/
public function destroy($id)
{
$student = Student::find($id);
$student->delete();
return redirect()->route('student.index')->with('success', 'Data successfully deleted');
}
This is my Controller
<div class="container student-create">
<div class="students-info">
<h3>Student's Personal Info</h3>
<form method="post" action="{{url('student')}}">
{{csrf_field()}}
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">First Name</label>
<input type="text" class="form-control" name="first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Last Name</label>
<input type="text" class="form-control" name="last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputlastname">Age</label>
<input type="number" class="form-control" name="Age" placeholder="Enter Last Name">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="InputAddress">Address</label>
<input type="text" class="form-control" name="Address" placeholder="Enter Address">
</div>
<div class="col-sm">
<label for="InputAddress">Grade Level/College Level</label>
<select class="custom-select" name="Grade_Level">
<option selected="">Select Grade Level</option>
<option>Day Care 1</option>
<option>Day Care 2</option>
<option>Kinder Garten 1</option>
<option>Kinder Garten 2</option>
<option>Elementary 1</option>
<option>Elementary 2</option>
<option>Elementary 3</option>
<option>Elementary 4</option>
<option>Elementary 5</option>
<option>Elementary 6</option>
<option>Junior Highschool 1</option>
<option>Junior Highschool 2</option>
<option>Junior Highschool 3</option>
<option>Junior Highschool 4</option>
<option>Senior Highschool 1</option>
<option>Senior Highschool 2</option>
<option>College Level Information Technology 1</option>
<option>College Level Information Technology 2</option>
<option>College Level Information Technology 3</option>
<option>College Level Information Technology 4</option>
</select>
</div>
</div>
<h3>Student's Parents Info</h3>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Mothers First Name</label>
<input type="text" class="form-control" name="mothers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Last Name</label>
<input type="text" class="form-control" name="mothers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Mothers Age</label>
<input type="number" class="form-control" name="mothers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group">
<div class="col-sm">
<label for="Inputfirstname">Fathers First Name</label>
<input type="text" class="form-control" name="fathers_first_name" placeholder="Enter First Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Last Name</label>
<input type="text" class="form-control" name="fathers_last_name" placeholder="Enter Last Name">
</div>
<div class="col-sm">
<label for="Inputfirstname">Fathers Age</label>
<input type="number" class="form-control" name="fathers_age" placeholder="Enter Age">
</div>
</div>
<div class="form-group submit">
<button type="button submit" class="btn btn-success">
<i class="fas fa-check"></i> Submit Data
</button>
</div>
</form>
</div>
This is my html code
so the function is like , if i create a data then after that it should redirected to an index or a view page but in my case after submitting/creating data it gives me this error i dont know why
View Page
i have the same page with the same function as this one but it turns out to be okay thats why im wondering why and also this create page that i posted here i started to get this error after i change the style of it and i added some fillable area's like the mother's age, name and etc
I think you can try this.
Change the APP_DEBUG=false to APP_DEBUG=true in .env file and run the following command
php artisan config:clear
It will show the proper error on page
If not work proper, let me know

Resources