Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

JeffreyWay's avatar

Lary "Quickdraw" A.I. Example Thread

If I want to submit a form that destroys a Post record, what markup and route should I create to allow for that?

0 likes
35 replies
LaryAI's avatar
Level 58

To create a route for a form that destroys a Post record, you can use the following route definition:

Route::delete('/posts/{post}', 'PostController@destroy')->name('posts.destroy');

Then, you can create the form markup like this:

<form action="{{ route('posts.destroy', $post) }}" method="POST">
    @csrf
    @method('DELETE')
    <button type="submit">Delete Post</button>
</form>

In the controller, you can define the destroy method like this:

public function destroy(Post $post)
{
    $post->delete();

    return redirect()->route('posts.index');
}
3 likes
JeffreyWay's avatar

Hi, everyone. This thread was just an example question to demonstrate our new "Lary "Quickdraw" A.I." feature. 👍

We're going to test this out for a few months. At least initially, Lary A.I. will only respond one time to the original poster. It will not interact with you further (though that might change in the future.)

Also, this feature is limited to existing subscribers and guest/forum users whose accounts are at least one month old.

As many of you may know, sometimes you get...interesting, or downright wrong replies from OpenAI. So please keep that in mind.

6 likes
PovilasKorop's avatar

@JeffreyWay great idea about limiting to a month old. Should bump up the quality of the questions "automagically" :)

2 likes
MichalOravec's avatar

@JeffreyWay There is one more issue with readability (light theme).

For instance in this thread or here.

This only happens when the best answer is moved to the top of the thread.

1 like
webrobert's avatar

nice... will the user see suggestions as they format the question? or Lary replies only after?

JeffreyWay's avatar

@webrobert Nah, this is just a small convenience for new threads. You'll only see a reply after publishing the thread.

martinbean's avatar

@jeffreyway I don’t enjoy typing out in-depth replies only for the best answer to be given to someone posting a link to a blog post, or a snippet to copy-and-paste instead of the O.P. actually understanding their problem and the solution. Now having to compete with AI-generated first replies just makes me want to contribute even less.

2 likes
webrobert's avatar

@martinbean, his nickname is "Quickdraw" and he isn't even real. How good can [he/him/her/it/AI] be? ;)

kokoshneta's avatar

@martinbean I don’t think there’ll be much real competition. The AI replies are posted less than a minute after the question, so you won’t have time to start a proper reply without seeing it. If the question is easy enough that the bot can answer it, fine; if it’s more complex, knowledgeable humans are needed anyway.

@jeffreyway I definitely don’t think the current behaviour of only posting once should be changed. The more you interact with ChatGPT-based entities, the more likely things are to go ridiculously wrong, and given how poorly most askers here are able to express their issue (both in terms of knowing what to say and in terms of knowing English well enough to say it an understandable way), the chances of complete derailment are high.

1 like
JeffreyWay's avatar

@martinbean well, we’re gonna test it out for a few months and see how it goes.

What you’ve referenced is one component that I will be tracking.

3 likes
jlrdw's avatar

I agree with @martinbean I have seen answers with the why included, even deep theory involved, in other words a great answer.

Now another poster gives copy and paste code (even if not secure code or correct safe code), but OP copies it and gives best answer.

Two main types here, folks that want to learn correctly, and the I need it now copy pasters.

One user, (and I am sure all of you know who) had pasted various answers together and wondered why nothing worked. Some of the answers were mere examples.

Sorry for long answer, just my thoughts on it. But I think this AI would at least give safe / secure answers.

3 likes
Snapey's avatar

Interesting that Larry seems familiar with pre Laravel 8 code, and obviously he does not warn the OP about adding some authorisation which most of the experienced members would do

JeffreyWay's avatar

@Sinnbeck Not a bug, but failed jobs due to an OpenAI outage. It retried those jobs just now.

1 like
Sinnbeck's avatar

@JeffreyWay Ah ok fair enough :) Maybe a check should be added that the thread isnt already going then

1 like
anjanesh's avatar

How do I integrate this kind of "Lary "Quickdraw" A.I." into my own forum ?

webrobert's avatar

@anjanesh

its the openai everyone is talking about...

Http::withToken(config('services.openai.api_key'))
            ->post('https://api.openai.com/v1/completions',[
                'model' => 'text-davinci-003',
                'prompt' => $forum_question,
                'max_tokens' => 60,
            ])
            ->collect();

Check out https://platform.openai.com/examples

I'm not sure of the settings Jeffrey is using (or what he is adding to the prompt besides the message) but its super fast to learn and setup. I had the api working in about 3 minutes.

You could even ask the chat 'model' how to set it up. just ask a good question...

me: where can I find your api docs?

ChatAi: I'm sorry, but as an AI language model, I do not have a public API that you can access.

However, OpenAI offers several APIs for developers to access various machine learning models and tools. You can find the documentation for these APIs on the OpenAI website: https://beta.openai.com/docs/.

Additionally, many other companies and services offer APIs that you may be interested in. If you have a specific service or platform in mind, I suggest checking their documentation or developer resources to learn more about their API.

click's avatar

@JeffreyWay the consequence of this implementation is that threads will not show up in the No Replies Yet filter which I use quite often. Would it be possible to not count LaryAI's as an actual answer?

1 like
JeffreyWay's avatar

@click I fixed that this morning. If @laryai is the only one who responds to a thread, it will still show up in the "No Replies Yet" filter.

jlrdw's avatar

@JeffreyWay could you do something like:

Where it says "Posted automagically Make the div a wee bit larger and add "I only can answer once, I'm an AI"

Or something like that. I imagine this is already in work anyway.

Please or to participate in this conversation.