Laravel - Day 10 - Editing and deleting entries from database using Resource controller

Laravel - Day 10 - Editing and deleting entries from database using Resource controller

Kodiary Technologies

6 лет назад

8,439 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@MuhammadAli-bi5tr
@MuhammadAli-bi5tr - 16.11.2021 08:24

thank you so much . these tutorials are like a gems, . i learned a lot , I

Ответить
@ashhadahmed6026
@ashhadahmed6026 - 04.10.2021 22:47

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.

Ответить
@surjitatom9389
@surjitatom9389 - 25.06.2021 13:35

Update function not working

Ответить
@elkhanhamet2561
@elkhanhamet2561 - 31.05.2021 02:38

these tutorials are gold!!! Thank you sooo much sir!!!

Ответить
@ancyea
@ancyea - 03.07.2020 10:46

Thanks for the tutorial. Working fine when added @method('PUT')

Ответить
@ndukelex9167
@ndukelex9167 - 07.06.2020 04:53

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

Ответить
@RohitRana-zc2oq
@RohitRana-zc2oq - 04.06.2020 15:04

can I edit the category in the same view file as in your case admin.categories.create instead of admin.categories.edit ??

Ответить
@lautaroalonso9006
@lautaroalonso9006 - 28.05.2020 07:50

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.

Ответить
@maniamthavam851
@maniamthavam851 - 20.05.2020 21:16

Thanks working

Ответить
@irfannian1502
@irfannian1502 - 20.05.2020 12:51

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'));

}

Ответить
@irfannian1502
@irfannian1502 - 19.05.2020 08:14

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

Ответить
@philipben-addy2142
@philipben-addy2142 - 17.05.2020 06:31

Hello getting when i click edit and save new edit it saves as new entry and delete not working. anyone please help

Ответить
@eshiksha6399
@eshiksha6399 - 10.05.2020 14:50

Code working fine no error was there but when i update there is no change in the values in the database

Ответить
@sergiupostei2018
@sergiupostei2018 - 05.05.2020 22:52

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

Ответить
@FerdzGaming
@FerdzGaming - 05.05.2020 11:54

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

Ответить
@md.kabirhossan3597
@md.kabirhossan3597 - 28.04.2020 23:50

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

Ответить
@anshusalaria8652
@anshusalaria8652 - 28.04.2020 19:40

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

Ответить
@syedm.hharis3009
@syedm.hharis3009 - 22.01.2020 02:21

can someone help plz...
The POST method is not supported for this route. Supported methods: GET, HEAD, PUT, PATCH, DELETE.

Ответить
@manjubhargavi7901
@manjubhargavi7901 - 30.12.2019 10:19

@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
{
//
}

Ответить
@engineersmusic1784
@engineersmusic1784 - 25.12.2019 06:02

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

Ответить
@tmbentertainment2611
@tmbentertainment2611 - 03.12.2019 17:08

You are a genius

Ответить
@jezreel4868
@jezreel4868 - 01.12.2019 14:16

i got an error while making edit, it says: syntax error, unexpected '->' (T_OBJECT_OPERATOR)

Ответить
@gracembendang5997
@gracembendang5997 - 08.11.2019 01:33

Hi sir, just to tell you that I'm still waiting for your reply. Please it's about my defend

Ответить
@gracembendang5997
@gracembendang5997 - 07.11.2019 16:31

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>

Ответить
@noraneesasyiqinmddisa2587
@noraneesasyiqinmddisa2587 - 19.10.2019 17:43

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

Ответить
@newdaymoney1280
@newdaymoney1280 - 03.10.2019 18:11

Thank sir so much . Hope Sir can teach about security account admin

Ответить
@hirenpatel7259
@hirenpatel7259 - 20.09.2019 14:05

My code is same as yours but delete function is not working. while I pressed delete nothing is happening.
pls help me bro...

Ответить
@ahmedsheikh7553
@ahmedsheikh7553 - 18.09.2019 19:23

hey! the post method is not supported in update form and update function giving error too

Ответить
@tusharchaudhari1324
@tusharchaudhari1324 - 22.08.2019 14:41

<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

Ответить
@ziakhan9611
@ziakhan9611 - 04.08.2019 08:47

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

Ответить
@ziakhan9611
@ziakhan9611 - 04.08.2019 08:47

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

Ответить
@YudzJBR
@YudzJBR - 10.07.2019 04:20

hello again, I have a problem. When I edit a particular person then save it. It will create a new person in the database.

Ответить
@YudzJBR
@YudzJBR - 09.07.2019 18:54

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}].

Ответить
@anahitpetrosyan7652
@anahitpetrosyan7652 - 13.03.2019 20:25

you help me a lot . Thanks

Ответить
@zoukhan
@zoukhan - 24.10.2018 03:17

You are such a good trainer.. No confusion

Ответить
@muhammadkalim
@muhammadkalim - 17.08.2018 18:40

<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

Ответить
@muhammadkalim
@muhammadkalim - 17.08.2018 18:23

we can be used id method in edit portion.

Ответить
@muhammadkalim
@muhammadkalim - 17.08.2018 18:21

any other method Besides that in edit parameter (Category $category) this Do not understand

Ответить
@Ali.Alsabah
@Ali.Alsabah - 16.08.2018 01:40

csrf hidden input could be replaced with @csrf

Ответить