Тэги:
#PHP #Laravel #Laravel_from_scratch #Laravel_from_basic #Learn_Laravel #Laravel_resource_controller #Laravel_resource_controller_to_edit #Laravel_resource_controller_to_delete #kodiary #kodiary_technologies #Anwar_AliКомментарии:
thank you so much . these tutorials are like a gems, . i learned a lot , I
Ответитьhi sir, thanks for the tutorial I'm currently facing 2 issue's if you could resolve them it would be grateful.
So the first one is the most disturbing is that when ever i refresh the page (A) logo appears and some time it gives me a dialogue box saying local host says you are using admin lte for testing purpose this is so disturbing me.
Secondly I'm disturbed at when i delete a category and after that if i create new one it comes with an increment in id it does not continue with the last id for example if i delete the 3rd id category and if i add new category the id to the new one becomes 4 and its disturbing me.
if you could solve these two it will be most grateful of you.
Update function not working
Ответитьthese tutorials are gold!!! Thank you sooo much sir!!!
ОтветитьThanks for the tutorial. Working fine when added @method('PUT')
ОтветитьThanks for the Video... But i encountered a problem while trying to edit a record in the database..I am getting an error that Laravel doesnt support Post method for edit and Update and i dont know how to go about this
Ответитьcan I edit the category in the same view file as in your case admin.categories.create instead of admin.categories.edit ??
ОтветитьExcelente video, very usefull! I have a question: how can I do to show a message or modal to confirm action when I press the delete button? I cant find any solution for this anywhere and I'm stuck because I'm a begginer.
ОтветитьThanks working
ОтветитьInstead of using eloquent model for edit & update, is there a way to use query builder instead? I can't seem to find a way online on how to use query builder for the edit and update, especially for the edit method. The reason I use query builder as I am joining two tables, Category and Author.
This is what I have for edit method, but doesn't seem to work.
public function edit($category)
{
$categories = DB::table('category')
-> join('author', 'category.ID', '=', 'author.ID')
-> where($category->category.ID)
-> get;
return view ('editcategory', compact('categories'));
}
Is there a way to edit everything in the table without the need to click the edit button row by row? Like with just one edit button when clicked, we can edit for the entire table
ОтветитьHello getting when i click edit and save new edit it saves as new entry and delete not working. anyone please help
ОтветитьCode working fine no error was there but when i update there is no change in the values in the database
ОтветитьSo when i press save on edit it redirect to this link admin/angajati/1/route('admin.angajati.update',$angajati-id)
The field doesn t update
1. IF the POST method is not supported.
Use method=“post” in your form tag’s opening
But inside your form tag us something like:
@method(“PUT”)
2. IF DELETE is not working.
Put the form inside <td>< /td>
Both fix the problem for me. Thanks! Kodiary Technologies
Sir i following your videos and it help me a lot, i am a beginner, but sir i think in a form if we want to delete something, firstly it warn a massage we really want to delete or not
ОтветитьGood work brother, But i have a confusion, When we works on live project we have to pass encript id's so the question is that how we would get data after decript we mention Categories table in Parameter. Thanks in advance
Ответитьcan someone help plz...
The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE.
@kodiary Technologies ,iam getting this error, Missing required parameters for [Route: categoriesample.update] [URI: categoriesample/{categoriesample}]. (View: C:\xampp7.2\htdocs\laravel\resources\views\admin\categories\edit.blade.php).
edit.blade.php:
<section class="content">
<div class="container-fluid">
<form method="POST" action="{{route('categoriesample.update', $categorie->id)}}">
@method('PUT')
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="form-group">
<div class="row">
<label class="col-md-3">TITLE</label>
<div class="col-md-4"><input type="text" name="tittle" value="{{$categorie->tittle}}" class="form-control"></div>
<div class="clearfix"></div>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="save">
</div>
</form>
</div>
</section>
CategoriesController.php:
public function edit(Categorie $categorie)
{
$arr['categorie']=$categorie;
return view('admin.categories.edit')->with($arr);
}
web.php:
Route::resource('categoriesample', 'CategoriesController');
model:
Categorie .php:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Categorie extends Model
{
//
}
Now the problem is that when i submit the edit form it says "the Post method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE...
plz solve this also
You are a genius
Ответитьi got an error while making edit, it says: syntax error, unexpected '->' (T_OBJECT_OPERATOR)
ОтветитьHi sir, just to tell you that I'm still waiting for your reply. Please it's about my defend
Ответитьthis is my edit.blade.php
<form method="post" action="{{ route('admin.categories.update', $categories->id) }}" align="center" ><input type="hidden" name="_token" value="{{ csrf_token() }}" ><input type="hidden" name="_method" value="PUT">
<div class="form-group" align="center">
<label class="col-md-3">Name</label>
<div class="col-md-3"><input type="text" name="name" class="form-control" placeholder="Change name" value="{{ $categories->name }}"></div>
<div class="clearfix"></div>
</div>
<div class="form-group"><input type="submit" class="btn btn-info " style="width: 40%" value="save"></div>
Hi how about if i wanna let the old value of text area and drop down button be there when i click edit just like basic input type. Hope u can help
ОтветитьThank sir so much . Hope Sir can teach about security account admin
ОтветитьMy code is same as yours but delete function is not working. while I pressed delete nothing is happening.
pls help me bro...
hey! the post method is not supported in update form and update function giving error too
Ответить<a href="javascript:void(0)" onclick="$(this).parent().find('form').submit()" class="btn btn-danger">Delete</a>
<form action="{{ route('admin.categories.destroy',$c->id) }}" method="post">
@method('DELETE')
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
this code not working for me add,edit all working nice but delete not working
Warning: require(C:\xampp\htdocs\project-master\project-master/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project-master\project-master\index.php on line 24
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\project-master\project-master/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project-master\project-master\index.php on line 24
how to use source code from github
i am facing following error plz Help me out to use your code plz sir
Warning: require(C:\xampp\htdocs\project-master\project-master/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\project-master\project-master\index.php on line 24
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\project-master\project-master/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\project-master\project-master\index.php on line 24
hello again, I have a problem. When I edit a particular person then save it. It will create a new person in the database.
Ответитьhi, sorry to bother but I got an error in the update function. Please help thanks
Missing required parameters for [Route: admin.venueandevent.update] [URI: admin/venueandevent/{venueandevent}].
you help me a lot . Thanks
ОтветитьYou are such a good trainer.. No confusion
Ответить<form action="{{route('admin.categories.update',$category->id)}}" there we use $category->id and
<form action="{{route('admin.categories.store',$c->id)}}" there use $c->id .why we do this ???? plz explain
we can be used id method in edit portion.
Ответитьany other method Besides that in edit parameter (Category $category) this Do not understand
Ответитьcsrf hidden input could be replaced with @csrf
Ответить