To get help faster, always post the code, and not just a partial of the code, any code shared should be written between three backticks ```
That makes the code look like this
function myFunction()
{
return myValue;
}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
HI, I have justa stupid issue when using the fn shortcut as in : Arr::first(static::all(),fn ($job)=>$job['id']=$id); $id is always marked as undentied variable and of course the function only return the first job , whatever id is given in the url... My IDE (PHPStorm...) marks $id as undentified, which is not a good sign , and I am using PHP8.3... I have : use Illuminate\Support\Arr; at the top of my class definition of course ; and even when wrinting this script in the web.php as described, it won't work either...
Don't see what can be wrong !!! Many tyhanks for getting me on the right path !
You need to use comparison == not assignment =
public static function find(int $id) : array {
return Arr::first(static::all(),fn ($job)=>$job['id']==$id);
}
Please or to participate in this conversation.