irankhosravi

So what should I do?

Cronix
Cronix
1 month ago (727,800 XP)

Read the comments in code of my post - I said exactly what needed to be done!

irankhosravi

We are now in the form of activities. I see at the console { school_id: 2 }

Console

Cronix
Cronix
1 month ago (727,800 XP)

Great, but did you do what I said to do?

from what I posted...

// add `school_id: data_school.id` to the above data you are sending like all of the others...

Did you do that? If so, post your updated code... This is why people get frustrated with you man... They take time to explain and show things, and then you don't do it/ignore it/don't answer their questions...

irankhosravi

This is also a Controller

public function store(Request $request, SchoolsList $schoolsList)
{
    if($request->ajax()) {
        $activity = new Activity();
        $activity->school_id = intval($request->school_id);
        $activity->cluster_id = $request->cluster_id;
        $activity->group_id = $request->group_id;
        $activity->save();
        return response()->json(['data_activity' => $request->all(), 'id' => $activity->id]);
    }
}

Take a look at whether it's right or not. If not, I'll change the codes.

$activity->school_id = intval($request->school_id);
irankhosravi

When I click on save button I see this error.

error

Cronix
Cronix
1 month ago (727,800 XP)

Still waiting to see if you've changed what I said... and to show the updated code...

shez1983

@irankhosravi you are making people angry @Cronix has been kind enough to leave comments on how to implement what you need and asked you repeatedly if you have followed the comment and you keep ignoring instead you give him more code so he can read and give you the correct version

if you want someone to help you with your project go to a freelancer site and HIRE someone.. or LEARN THE BASICS of vue/laravel/php/programming...

Snapey
Snapey
1 month ago (993,535 XP)

When I click on save button I see this error.

error

Classic

(whoops, I'm supposed to be ignoring him, but I couldn't help myself)

irankhosravi

I do not understand what you say and what is in your mind?

I'm asking what I do not know, Did my questions make people anger?

So you have no morals.

@jlrdw DO NOT INTERFERE

jlrdw
jlrdw
1 month ago (244,950 XP)

@irankhosravi no problem. But just to say people have given answers and you ignore.

Is school_id an int in you database?

If it is and you post "23" a string even, then mysql will still store as an int.

So maybe it's time to check, double check, then triple check your code.

And re-read other answers where folks have tried to help.

I deleted my other POST.

newbie360

may be just like this ?

<script type="text/javascript">
    $("#schools").submit(function (event) {
        event.preventDefault();
        province_id = $('#province_id').val();
        city_id = $('#city_id').val();
        center_id = $('#center_id').val();
        school_id = $('#school_id').val(); // you need modify this, how to assign the value
        
        $.post("{{ route('schools-list.store') }}", {
            province_id:province_id, 
            city_id:city_id, 
            center_id:center_id, 
            school_id:school_id
        });
    });
</script>

Please sign in or create an account to participate in this conversation.