How to fix this controller so that it can insert data using this if else condition into the database?

|
AlgorithmeTakam 2022-08-02 12:33:40
get ??
cintya_nainggolan 2022-08-02 12:35:25
laravel_discuss-131770.jpg
how to fix this controller so that it can insert data using this if else condition into the database?
mdmx7 2022-08-02 13:03:16
I’m looking for freelance work.
If you have any project available kindly dm me thanks
Al_quranu_dusturuna 2022-08-02 13:09:41
Thank you ❤️
linux9921 2022-08-02 13:09:44
what you are doing is not interesting. I suggest you put what you want to test in a variable and then do a test before trying to insert the data into the database. when you do $request->name_of_input_in_the_fom it is indeed in the form of a key-value array. but for your case, I don’t believe if what you are doing can be done. well I’ve never tried it and logically, it’s wrong
h_254 2022-08-02 13:11:56
You can still use it for apps
linux9921 2022-08-02 13:20:36
show us the controller ClassController … it may be that you have committed $id in the function destroy($id)
AlgorithmeTakam 2022-08-02 13:22:44
laravel_discuss-131777.jpg
classController (destroy function)
beadsea888 2022-08-02 13:59:47
Try to change the parameter name to $class and make sure you including the parameter in the url.
You used resource route.
AlgorithmeTakam 2022-08-02 14:00:45
classes instead
beadsea888 2022-08-02 14:01:25
what is the request url?
AlgorithmeTakam 2022-08-02 14:01:26
becauses that is the name of the table name and view
beadsea888 2022-08-02 14:02:07
The error message shows you what the problem is explicitly.
beadsea888 2022-08-02 14:02:23
You are missing the parameter in the url.
AlgorithmeTakam 2022-08-02 14:03:07
talking of that from from the route ??
beadsea888 2022-08-02 14:03:43
post the request url where you are getting the error.
AlgorithmeTakam 2022-08-02 14:03:50
laravel_discuss-131789.jpg
or just my request page that needs some modifications
beadsea888 2022-08-02 14:04:05
It is not form request issue.
beadsea888 2022-08-02 14:04:35
what is the request url?
beadsea888 2022-08-02 14:04:45
full url.
AlgorithmeTakam 2022-08-02 14:05:44
laravel_discuss-131793.jpg

AlgorithmeTakam 2022-08-02 14:08:22
laravel_discuss-131794.jpg
classes model might help
beadsea888 2022-08-02 14:12:07
the error is in route(‘classes.destroy, [‘id’ => ….)
beadsea888 2022-08-02 14:12:21
Change ‘id’ to ‘class’
beadsea888 2022-08-02 14:12:44
route(‘classes.destroy’, [‘class’ => ….)
AlgorithmeTakam 2022-08-02 14:13:15
{!! Form::open(route(‘classes.destroy’, [‘classes’ => $classes->id]) ) !!}

so i will get that??

AlgorithmeTakam 2022-08-02 14:13:29
class or classes ??
beadsea888 2022-08-02 14:14:02
yes, you used the resource route and parameter name should match to the model name.
beadsea888 2022-08-02 14:14:14
classes.destroy
AlgorithmeTakam 2022-08-02 14:16:50
not working
beadsea888 2022-08-02 14:22:45
still getting same issue?
AlgorithmeTakam 2022-08-02 14:24:52
yes yes
AlgorithmeTakam 2022-08-02 14:27:01
i am trying a different approach
cintya_nainggolan 2022-08-02 15:26:41
I still don’t understand, can you give me an example or reference?
linux9921 2022-08-02 15:44:11
send us this code in text format. I will change for you…quickly because I don’t have a reference
|