Import data into database and show it on html table in laravel - laravel

I want to create a view in laravel that has a function to import an excel file into the database and show it in a table inside a view.
I created a controller and it imports the excel data in database but fails to show it in view.
Please Help solve my issue.
Many Thanks in advance.
Best Regards,
Dian
I am using laravel 5.5 and maatwebsite excel
public function importFileIntoDB(Request $request){
if($request->hasFile('sample_file')){
$path = $request->file('sample_file')->getRealPath();
$data = Excel::load($path, function($reader) {})->get();
if($data->count()){
foreach ($data as $key => $value) {
$arr[] = ['name' => $value->name, 'details' => $value->details];
}
if(!empty($arr)){
\DB::table('products')->insert($arr);
dd('Insert Record successfully.');
}
}
}
return back()->with($arr);
}
this is my view
#extends('frontpage')
#section('title', 'Dashboard')
#section('content_header')
<h1>Upload File From Excel Into Database</h1>
#stop
#section('content')
<div class="panel panel-primary">
<div class="container">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title" style="padding:12px 0px;font-size:25px;"><strong>Test - import export csv or excel file into database example</strong></h3>
</div>
<div class="panel-body">
#if ($message = Session::get('success'))
<div class="alert alert-success" role="alert">
{{ Session::get('success') }}
</div>
#endif
#if ($message = Session::get('error'))
<div class="alert alert-danger" role="alert">
{{ Session::get('error') }}
</div>
#endif
<h3>Import File Form:</h3>
<form style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 20px;" action="{{ URL::to('importExcel') }}" class="form-horizontal" method="post" enctype="multipart/form-data">
<input type="file" name="import_file" />
{{ csrf_field() }}
<br/>
<button class="btn btn-primary">Import CSV or Excel File</button>
</form>
<br/>
<h3>Import File From Database:</h3>
<div style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 20px;">
<button class="btn btn-success btn-lg">Download Excel xls</button>
<button class="btn btn-success btn-lg">Download Excel xlsx</button>
<button class="btn btn-success btn-lg">Download CSV</button>
</div>
<h3>Table Import List </h3>
<div style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 20px;" >
print_r($arr->count());
#if(!empty($arr))
<table class="table table-striped table-hover table-reflow">
#foreach($arr as $key=>$value)
<tr>
<th ><strong> {{ $key }}: </strong></th>
<td> {{ $value }} <td>
</tr>
#endforeach
</table>
#endif
</div>
</div>
</div>
</div>
#stop
#section('css')
<link rel="stylesheet" href="/css/admin_custom.css">
#stop
#section('js')
<script> console.log('Hi! this is frontpage'); </script>
#stop

As conveyed by #gbalduzzi you need to return the data to the view as
return back()->with(['arr' => $arr]);
and access in your view as
#if(session()->has('arr'))
<table class="table table-striped table-hover table-reflow">
#php $arr = session('arr'); #endphp
#foreach($arr as $key => $value)
<tr>
<th ><strong> {{ $value['name'] }}: </strong></th>
<td>{{ $value['details'] }} <td>
</tr>
#endforeach
</table>
#endif
Docs

Change
return back()->with($arr);
with
return back()->with(['arr' => $arr]);
return back()->with('arr', $arr); // Should be equivalent
return back()->compact($arr); // Should be equivalent
The with method doesn't accept only a single value: you need to specify an array, a key and a value or use the compact method

Related

ErrorException Attempt to read property "category_name" on int

To update the added categories, I encounter errors that are returned to me. I think there are functions missing or I wrote badly at the level of my controller
I got this error
ErrorException
Attempt to read property "category_name" on int
How to solve that ?
Here is my controller CategorieController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Categorie;
class CategorieController extends Controller
{
//
public function ajoutercategorie(){
return view('admin.ajoutercategorie');
}
public function sauvercategorie(Request $request){
$validatedData = $request->validate([
'category_name' => 'required | max:255',
]);
$categorie = Categorie::create($validatedData);
return redirect('/ajoutercategorie')->with('status', 'La catégorie '
.$categorie->category_name.' a été ajoutée avec succès');
}
public function categorie(){
$categories = Categorie::get();
return view('admin.categorie')->with('categories', $categories);
}
public function edit_categorie($id){
$categorie = Categorie::find($id);
return view('admin.editcategorie')->with('categorie', $categorie);
}
public function modifiercategorie(Request $request, Categorie $id){
$validatedData = $request->validate([
'category_name' => 'required | max:255',
]);
$categorie = Categorie::whereId($id)->update($validatedData);
return redirect('/categorie')->with('status', 'La catégorie'
.$categorie->category_name. 'a été modifiée avec succès');
}
}
Here my editcategorie.blade.php
#extends('layouts.appadmin')
#section('title')
Modifier la catégorie
#endsection
#section('contenu')
<div class="row grid-margin">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<h4 class="card-title">Modifier la catégorie</h4>
#if (Session::has('status'))
<div class="alert alert-success">
{{Session::get('status')}}
</div>
#endif
#if ($errors->any())
<div class="alert alert-danger">
<ul>
#foreach($errors->all() as $error)
<li>{{ $error }}</li>
#endforeach
</ul>
</div>
#endif
<form class="cmxform" id="commentForm" method="POST" action="{{ route('categories.modifiercategorie') }}">
#csrf
<fieldset>
<div class="form-group">
<label for="cemail">Nom de la catégorie</label>
<input id="cemail" class="form-control" type="text" name="category_name" value="{{$categorie->category_name}}">
</div>
<input class="btn btn-primary" type="submit" value="Modifier">
</fieldset>
</form>
</div>
</div>
</div>
</div>
#endsection
#section('scripts')
{{--<script src="Administrateur/js/form-validation.js"></script>
<script src="Administrateur/js/bt-maxLength.js"></script>--}}
#endsection
My categorie.blade.php
#extends('layouts.appadmin')
#section('title')
Catégorie
#endsection
#section('contenu')
<div class="card">
<div class="card-body">
<h4 class="card-title">Catégorie</h4>
#if (Session::has('status'))
<div class="alert alert-success">
{{Session::get('status')}}
</div>
#endif
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table id="order-listing" class="table">
<thead>
<tr>
<th>Order #</th>
<th>Nom de la catégorie</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
#foreach ($categories as $categorie)
<tr>
<td>{{$categorie->id}}</td>
<td>{{$categorie->category_name}}</td>
<td>
<button class="btn btn-outline-primary" onclick="window.location ='{{url('/edit_categorie/' .$categorie->id)}}'">Modifier</button>
<button class="btn btn-outline-danger">Supprimer</button>
</td>
</tr>
#endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
#endsection
#section('scripts')
<script src="Administrateur/js/data-table.js"></script>
#endsection
</body>
</html>
How can I solve this ?
I think the error comes from my function modifiercategorie in my CategorieController
Your problem is here $categorie = Categorie::whereId($id)->update($validatedData); because update method returns count of updated columns. You should find a category.
Try to do this
...
$categorie = Categorie::whereId($id)->first()
$categorie->update($validatedData);
...
in the method that you mentioned(modifiercategorie):
$categorie = Categorie::whereId($id)->update($validatedData);
here you are doing wrong you cannot update it's data by Validate method.
you need to put data like this :
$categorie = Categorie::whereId($id)->update(['category_name'=>$request->category_name]);

live.ERROR: Trying to get property 'title' of non-object (View: C:\xampp\htdocs\core\resources\views\user\signal-all.blade.php)

ERROR: Trying to get property 'title' of non-object (View: C:\xampp\htdocs\core\resources\views\user\signal-all.blade.php)
Dear, help me please, I can't find the error, it was working fine.
signal-all.blade.php
#extends('layouts.user')
#section('content')
<div class="page-body">
<div class="row">
<div class="col-sm-12">
<div class="card">
<div class="card-header">
<h5>Historial - Ideas de Trading</h5>
<div class="card-header-right">
<ul class="list-unstyled card-option">
<li><i class="fa fa-chevron-left"></i></li>
<li><i class="fa fa-window-maximize full-card"></i></li>
<li><i class="fa fa-minus minimize-card"></i></li>
<li><i class="fa fa-times close-card"></i></li>
</ul>
</div>
</div>
<div class="card-block">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="sample_1">
<thead>
<tr>
<th>#</th>
<th>Fecha</th>
<th>Titulo</th>
<th>Mercado - Par - Tipo</th>
<th>TF - Estado</th>
<th>Acción</th>
</tr>
</thead>
<tbody>
#php $p = 0 #endphp
#if (\Illuminate\Support\Facades\Auth::user()->expire_time != 1 and \Carbon\Carbon::parse(\Illuminate\Support\Facades\Auth::user()->expire_time)->isPast())
<tr>
<td colspan="7"><h6 class="text-center">Su plan esta expirado, actualice su plan Actualizar Plan</h6></td>
</tr>
#elseif (\Illuminate\Support\Facades\Auth::user()->plan_status == 0)
<tr>
<td colspan="7"><h6 class="text-center">Tablero de señales desactivado. PAGO PENDIENTE</h6></td>
</tr>
#else
#php $p = 0 #endphp
#foreach($signal as $k => $p)
<tr>
<td>{{ $k + $signal->firstItem() }}</td>
<td>{{\Carbon\Carbon::parse($p->created_at)->format('d/m/Y - h:i:s A')}}</td>
<td>{{ $p->signal->title }}</td>
<td>{{ $p->signal->asset->name }} - {{ $p->signal->symbol->name }} - {{ $p->signal->type->name }}</td>
<td>{{ $p->signal->frame->name }} - {{ $p->signal->status->name }}</td>
<td>
<i class="fa fa-eye"></i> Ver
</td>
</tr>
#endforeach
#endif
</tbody>
</table>
</div>
#if ($p)
{{$signal->links('basic.pagination')}}
#endif
</div>
</div>
</div>
</div>
</div>
#endsection
I also add layouts.user.php
#php
$planId = Auth::user()->plan_id;
$allSignal = App\SignalPlan::wherePlan_id($planId)->count();
#endphp
<div class="pcoded-main-container">
<div class="pcoded-wrapper">
<nav class="pcoded-navbar">
<div class="sidebar_toggle"><i class="icon-close icons"></i></div>
<div class="pcoded-inner-navbar main-menu">
<div class="pcoded-navigation-label">Panel de Control</div>
<ul class="pcoded-item pcoded-left-item">
<li class="{{ Request::is('user-dashboard') ? 'active' : '' }}">
<a href="{{ route('user-dashboard') }}">
<span class="pcoded-micon"><i class="ti-home"></i><b>D</b></span>
<span class="pcoded-mtext">Inicio</span>
<span class="pcoded-mcaret"></span>
</a>
</li>
</ul>
<div class="pcoded-navigation-label">Ideas de Comercio</div>
<ul class="pcoded-item pcoded-left-item">
<li class="{{ Request::is('user/all-signal') ? 'active' : '' }}">
<a href="{{ route('user-all-signal') }}">
<span class="pcoded-micon"><i class="ti-stats-up"></i><b>D</b></span>
<span class="pcoded-mtext">Señales</span>
<span class="pcoded-badge label label-primary ">{{ $allSignal }}</span>
<span class="pcoded-mcaret"></span>
</a>
</li>
</ul>
<div class="pcoded-navigation-label">Administrar Ganancias</div>
<ul class="pcoded-item pcoded-left-item">
<li class="">
<a href="{!! route('logout') !!}" onclick="event.preventDefault();document.getElementById('logout-form').submit();">
<span class="pcoded-micon"><i class="ti-share-alt"></i><b>D</b></span>
<span class="pcoded-mtext">Salir</span>
<span class="pcoded-mcaret"></span>
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
{{ csrf_field() }}
</form>
</li>
</ul>
</div>
</nav>
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
#if($errors->any())
#foreach ($errors->all() as $error)
<div class="alert alert-warning icons-alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<i class="icofont icofont-close-line-circled"></i>
</button>
<p>{!! $error !!}</p>
</div>
#endforeach
#endif
#yield('content')
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
#if(Auth::user()->plan_status == 1 and Auth::user()->plan->telegram_status == 1)
{!! $basic->chat !!}
#endif
<script>
#if(Session::has('message'))
var type = "{{ Session::get('type', 'info') }}";
switch(type){
case 'info':
toastr.info("{{ Session::get('message') }}");
break;
case 'warning':
toastr.warning("{{ Session::get('message') }}");
break;
case 'success':
toastr.success("{{ Session::get('message') }}");
break;
case 'error':
toastr.error("{{ Session::get('message') }}");
break;
}
#endif
</script>
#yield('scripts')
Controller
public function AllSignal()
{
$data['page_title'] = 'All Signal';
$data['signal'] = SignalPlan::wherePlan_id(Auth::user()->plan_id)->orderBy('id','desc')->paginate(10);
return view('user.signal-all',$data);
}
when I try to execute it throws ERROR: Trying to get property 'title' of non-object
and use plan_status == 1 It works perfect
The syntax of foreach($signal as $k => $p) means, for each element in the array of $signal as a key value pair, which means $p already represents a single $signal object from the array, and $k is the array index. Within a single object of $singal, you have the property title. In order to refer to that attribute, you just need to do $p->title. If you are unsure, you could perform a dd($signal) or a dd($p) somewhere on your blade to verify what it contains

search function for laravel 5.8

guys somehow this search function not working.i been following a tutorial for search function in laravel 5.8 can you help me im still a total beginner at this. if i ask this question wrong please forgive me.. this is my first time asking... and if im being rude im truly sorry...
pegawaicontroller.php
public function search(Request $request)
{
// menangkap data pencarian
$search = $request->search;
// mengambil data dari table pegawai sesuai pencarian data
$pegawai = DB::table('pegawais')
->where('nama_pegawai','LIKE',"%".$search."%")
->paginate();
// mengirim data pegawai ke view index
return view('pegawai.index',['pegawais' => $pegawai]);
}
pegawai.php (Model)
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Pegawai extends Model
{
protected $fillable = ['kategori', 'jabatan', 'nama_pegawai', 'alamat', 'gambar_pegawai', ];
}
index.blade.php
#extends('template.adminlte')
#section('content')
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">Menu Pegawai</h1>
</div><!-- /.col -->
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item active">pegawai</li>
</ol>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<form action="/pegawai/search" method="GET">
<input type="text" name="search" placeholder="Cari Pegawai .." value="{{ old('search') }}">
<input type="submit" value="Search">
</form>
<section class="content">
<div class="container-fluid">
<a href="{{ route('pegawai.create') }}" class="btn btn-info btnsm float-right">
<i class="fas fa-plus-circle"> Tambah Menu</i>
</a><br><br>
#if ($message = Session::get('message'))
<div class="alert alert-success martop-sm">
<p>{{ $message }}</p>
</div>
#endif
<table class="table martop-sm">
<thead>
<th>No</th>
<!-- <th>ID</th> -->
<th>Kategori</th>
<th>Jabatan Pegawai</th>
<th>Nama pegawai</th>
<th>Alamat</th>
<th>Foto Pegawai</th>
<th>Aksi</th>
</thead>
<tbody>
#foreach ($pegawais as $key => $pegawai)
<tr>
<td>{{ $pegawais->firstItem() + $key }}</td>
<!-- <td>{{ $pegawai->id }}</td> -->
<td>{{ $pegawai->kategori }}</td>
<td>{{ $pegawai->jabatan }}</td>
<td>{{ $pegawai->nama_pegawai }}</td>
<td>{{ $pegawai->alamat }}</td>
<td><img src="{{ asset('storage/images/' . $pegawai->gambar_pegawai) }}" alt="" width="100"></td>
<td>
<form action="{{ route('pegawai.destroy', $pegawai->id) }}" method="post">
{{csrf_field()}} {{ method_field('DELETE') }}
Ubah
<button type="submit" class="btn btn-danger btn-sm" onclick="return confirm('Apakah anda yakin ingin menghapusnya?');">Hapus</button>
</form>
</td>
</tr>
#endforeach
</tbody>
</table>
{{ $pegawais -> links() }}
</div>
</section>
</div>
#endsection
web.php (my route)
Route::get('/pegawai')->name('pegawai.index')->uses('pegawaicontroller#index');
Route::get('/pegawai/search')->uses('pegawaicontroller#search');
Expectation:
Function Working As Intended
Reality:
404 PAGE NOT FOUND

Undefined variable: title (View: C:\xampp\htdocs\myproject\resources\views\categories\index.blade.php)

I try to make a page index.blade, but i getting error
Undefined variable: title (View: C:\xampp\htdocs\myproject\resources\views\categories\index.blade.php)
I am using laravel 5.4 PHP 7.0.33
Is there anything wrong with the code?
My Controller
<?php
namespace App\Http\Controllers;
use App\Category;
use Illuminate\Http\Request;
class CategoryController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$categories = Category::orderBy('created_at', 'DESC')->paginate(10);
return view('categories.index', compact('categories'));//
}
My index.blade
this is my view/categories/index.blade.php
#extends('layout.master')
​
#section('title')
<title>Manajemen Kategori</title>
#endsection
​
#section('content')
<div class="content-wrapper">
<div class="content-header">
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0 text-dark">Manajemen Kategori</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item">Home</li>
<li class="breadcrumb-item active">Kategori</li>
</ol>
</div>
</div>
</div>
</div>
​
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
#card
#slot('title')
<div class="card">
<div class="card-header with-border">
<h3 class="card-title">{{ $title }}</h3>
</div>
<div class="card-body">
{{ $slot }}
</div>
{{ $footer }}
</div>
#endslot
#if (session('error'))
#alert
<div class="alert alert-{{ $type }} alert-dismissible">
{{ $slot }}
</div>
#endalert
#endif
​
<form role="form" action="{{ route('kategori.store') }}" method="POST">
#csrf
<div class="form-group">
<label for="name">Kategori</label>
<input type="text"
name="name"
class="form-control {{ $errors->has('name') ? 'is-invalid':'' }}" id="name" required>
</div>
<div class="form-group">
<label for="description">Deskripsi</label>
<textarea name="description" id="description" cols="5" rows="5" class="form-control {{ $errors->has('description') ? 'is-invalid':'' }}"></textarea>
</div>
#slot('footer')
<div class="card-footer">
<button class="btn btn-primary">Simpan</button>
</div>
</form>
#endslot
#endcard
</div>
<div class="col-md-8">
#card
#slot('title')
List Kategori
#endslot
#if (session('success'))
#alert(['type' => 'success'])
{!! session('success') !!}
#endalert
#endif
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<td>#</td>
<td>Kategori</td>
<td>Deskripsi</td>
<td>Aksi</td>
</tr>
</thead>
<tbody>
#php $no = 1; #endphp
#forelse ($categories as $row)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $row->name }}</td>
<td>{{ $row->description }}</td>
<td>
<form action="{{ route('kategori.destroy', $row->id) }}" method="POST">
#csrf
<input type="hidden" name="_method" value="DELETE">
<i class="fa fa-edit"></i>
<button class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></button>
</form>
</td>
</tr>
#empty
<tr>
<td colspan="4" class="text-center">Tidak ada data</td>
</tr>
#endforelse
</tbody>
</table>
</div>
#slot('footer')
​
#endslot
#endcard
</div>
</div>
</div>
</section>
</div>
#endsection
My route web.php
Route::resource('/kategori', 'CategoryController',
['except' => ['create', 'show']]);
It should be like this
public function index()
{
$categories = Category::orderBy('created_at', 'DESC')->paginate(10);
$title = ''; //your title
return view('categories.index', compact('categories','title'));
}
because title not getting value from controller.
You dont pass variable title to view
Add some like this:
$title = 'Your title';
return view('categories.index', compact('categories','title'));
If title is a field of Category
If title is a field/member of Category model, then you would do {{ $category->title }}. I think this is the real error.
Otherwise
You need to define and send the variable as other have said.
$tile='Your Title';
return view('categories.index', compact('categories','title'));

Getting error while clicking on edit function button in laravel

I need to edit by data from database via my admin panel. So i created table with clickable button for edit function.
Now when I click on edit button, I am seeing ID number at bottom but getting sorry page couldn't found error ! I have double checked all controller, route and everything. It seems all good, but I don't know what's the error!
Route Code:
Route::get('/admin/baseFare',[
'uses' => 'ExtraBaseFareController#basefare',
'as' => 'base.fare'
]);
Route::get('/admin/baseFare/edit/{$id}',[
'uses' => 'ExtraBaseFareController#editBaseFare',
'as' => 'editbase.fare'
]);
Route::post('/admin/baseFare/update/{id}', [
'uses' => 'ExtraBaseFareController#baseFareUpdate',
'as' => 'base.fareupdate'
]);`
Controller Code:
public function basefare()
{
$base = BaseFare::all();
return view('Admin.BaseFare.index')->With('base', $base);
}
public function editBaseFare($id)
{
$base = BaseFare::find($id);
return view('Admin.BaseFare.editBaseFare')->with('base', $base);
}
public function baseFareUpdate(Request $request, $id)
{
$base = BaseFare::find($id);
$base->fareinpercentage = $request->fareinpercentage;
$base->fareinrupees = $request->fareinrupees;
$base->save();
Session::flash('success','Base fare successfully updated');
return redirect()->route('base.fare');
}
Index Page code:
<table class="table display nowrap table-striped table-bordered bootstrap-3 scroll-horizontal">
<thead>
<tr>
<th>S.No</th>
<th>Fare in Percentage (%)</th>
<th>Fare in Rupees (Rs)</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
#php $number = 1; #endphp
#foreach($base as $base)
<tr>
<td>
{{ $number.'.' }}
#php $number++; #endphp
</td>
<td>{{ $base->fareinpercentage }}</td>
<td>{{ $base->fareinrupees }}</td>
<td>
<a href="{{ route('editbase.fare',['id' => $base->basefareid ]) }}" class="m-portlet__nav-link btn m-btn m-btn--hover-accent m-btn--icon m-btn--icon-only m-btn--pill" title="Edit ">
<i class="la la-edit"></i>
</a>
</td>
</tr>
#endforeach
</tbody>
</table>`
Edit Page Code:
<form class="form" method="post" action="{{ route('base.fareupdate',['id' => $base->basefareid ]) }}">
<div class="form-body">
<h4 class="form-section"><i class="la la-eye"></i>Base Fare Controller</h4>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="userinput2">Fare in Percentage (%)</label>
<input type="text" id="fareinpercentage" value="{{ $base->fareinpercentage }}" class="form-control border-primary" name="fareinpercentage">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label for="userinput3">Fare in Rupee (Rs)</label>
<input type="text" id="fareinrupees" value="{{ $base->fareinrupees }}" class="form-control border-primary" name="fareinrupees">
</div>
</div>
</div>
</div>
<div class="form-actions right">
<button type="button" class="btn btn-warning mr-1">
<i class="ft-x"></i> Cancel
</button>
<button type="submit" name="submit" class="btn btn-primary">
<i class="la la-check-square-o"></i> Save
</button>
</div>
</form>`
These are the codes, the kindly help me to find our the error, The main function is to edit the field from database!
If I understand the question correctly you can't go to the edit page.
Run 'php artisan route:list' and compare the routes.
And I can't figure out why you have dollar sign before the id in the route.

Resources