Harings Rob
11/30/2022, 6:38 PMamargoCactus
11/30/2022, 6:38 PMifox
11/30/2022, 10:14 PMHip-Hop
12/29/2022, 9:26 AMifox
01/09/2023, 3:33 PMifox
01/09/2023, 3:34 PMHarings Rob
01/09/2023, 3:38 PMifox
01/09/2023, 3:39 PMifox
01/09/2023, 3:40 PMcomposer install
from the terminal or PhpStorm, and the rest would be configured for you.Harings Rob
01/09/2023, 3:45 PMHarings Rob
01/09/2023, 3:45 PMamargoCactus
01/28/2023, 3:10 AMamargoCactus
01/28/2023, 3:23 AMphp artisan serve
ifox
04/22/2023, 9:48 AMdevtutorum
05/10/2023, 1:46 PMhttps://cdn.discordapp.com/attachments/811986493245227028/1105853338559455262/image.png▾
ifox
05/10/2023, 1:49 PMifox
05/10/2023, 1:51 PMkalle
05/10/2023, 1:56 PMvendor
dir. So its best to exclude that dir via argument. --exclude vendor
devtutorum
05/10/2023, 2:10 PMJeanSilva
05/12/2023, 7:48 PMname
. Name must not be null, but the user can update its value. I'm trying to set up a way to validate when this field exists in the request, but if it is null, the validator catches it and throws an error. Is this possible?pboivin
05/12/2023, 8:20 PM'name' => 'sometimes|required'
?pboivin
05/12/2023, 8:21 PMsometimes
will trigger the rest of the validation only when the field is present in the requestJeanSilva
05/12/2023, 8:55 PMpboivin
05/25/2023, 1:08 PMifox
05/25/2023, 1:12 PMScottnj
05/26/2023, 2:55 PMphp
protected static function booted()
{
static::created(function ($project) {
$project->links()->create([
'published' => true,
'title' => 'auto generated',
'url' => 'https://google.com',
]);
});
}
When this code is run, the new link database entry has the correct project_id set, but it also has a deleted_at value set.
Why is deleted_at getting set?
Is this the correct way to automatically generate a child on creation of a parent?Scottnj
05/26/2023, 2:56 PMLink::make()
and include the project_id, it behaves exactly as $project->links()->create()
. If I comment out the project_id line, the project_id will obviously be null, but now the deleted_at is also null (as it should be).
php
$link = Link::make();
$link->published = true;
$link->title = 'generated title';
$link->url = 'https://google.com';
// $link->project_id = $project->id;
$link->save();
Here is a git repo showing this behavior.
https://github.com/scottnj/example-app/blob/main/app/Models/Project.php
How can I set the project_id, without setting deleted_at?agnonym
05/26/2023, 3:02 PMagnonym
05/26/2023, 3:03 PMScottnj
05/26/2023, 3:06 PM