Konstruktionsplan

Konstruktionsplan

Member Since 11 Months Ago

Hamburg

Experience Points
12,570
Total
Experience

2,430 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
95
Lessons
Completed
Best Reply Awards
1
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 3
12,570 XP
Sep
14
5 days ago
Activity icon

Replied to Laravel 8 Password Reset

config('queue.batching.table', 'job_batches'),

One coma too much at the end.

Sep
10
1 week ago
Activity icon

Replied to Thanks Livewire...

It is strange that only the component does not work. With all others it works and although I have a layout file, it shows me the styles but without content.

Activity icon

Started a new Conversation Thanks Livewire...

Hello. Simple workflow not working in v2.

Component:

    /**
     * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function render()
    {
        return view('livewire.editjuice');
    }

Route:

Route::get('/saft-editieren/{juice:slug}', EditJuice::class)->name('edit');

View:

<div>
    Hello
</div>

Result: Empty site...

Sep
09
1 week ago
Activity icon

Replied to Controller?!?!

Thanks! It works, but do you know why it was done?

Activity icon

Started a new Conversation Controller?!?!

Hello!

(Laravel 8)

Controller:

<?php

namespace App\Http\Controllers;

class HomeController extends Controller
{
    public function index()
    {
     dd("drin");
    }
}

Route:

// Root
    Route::name('home.')->group(function () {
        Route::get('/', '[email protected]')->name('index');
});
Target class [HomeController] does not exist.

WTF?

Aug
27
3 weeks ago
Activity icon

Replied to Multi 🧵Bindings.

Fix it:

$subjuice = JuiceMix::with('mainJuice1', 'mainJuice2')->where('id', '=', $juiceMix->id)->get();
      #attributes: array:10 [▶]
      #original: array:10 [▼
        "id" => 4
        "title" => "Fantasy"
        "juice1" => 3
        "juice2" => 2
        "slug" => "fantasy"
        "favorite" => 0
        "description" => "Fantasy"
        "rating" => 2
        "created_at" => "2020-08-27 13:09:37"
        "updated_at" => "2020-08-27 13:09:37"
      ]
      #changes: []
      #casts: []
      #classCastCache: []
      #dates: []
      #dateFormat: null
      #appends: []
      #dispatchesEvents: []
      #observables: []
      #relations: array:2 [▼
        "mainJuice1" => App\Juice {#1283 ▶}
        "mainJuice2" => App\Juice {#1285 ▶}
Activity icon

Replied to Multi 🧵Bindings.

Model:

class JuiceMix extends Model
{
    public function mainJuice1()
    {
        return $this->belongsTo(Juice::class, 'juice1');
    }


    public function mainJuice2()
    {
        return $this->belongsTo(Juice::class, 'juice2');
    }

    public function mainJuices()
    {
        return collect([$this->mainJuice1, $this->mainJuice2]);
    }
}

Controller:

 $subjuice = JuiceMix::with('mainJuice1', 'mainJuice2')->first();
 dd($subjuice);

The first juice is unfortunately still at "null".

Activity icon

Replied to Multi 🧵Bindings.

  #relations: array:2 [▼
    "juice1" => null
    "juice2" => App\Juice {#1284 ▼
      #connection: "mysql"
      #table: "juices"
      #primaryKey: "id"
      #keyType: "int"
      +incrementing: true
      #with: []
      #withCount: []
      #perPage: 15
      +exists: true
      +wasRecentlyCreated: false
      #attributes: array:12 [▶]
      #original: array:12 [▼
        "id" => 2
        "title" => "s2"
        "brand_id" => 1
        "genre_id" => 1
        "slug" => "s2"
        "favorite" => 0
        "description" => "sfsdf"
        "alcohollevel" => null
        "rating" => 3
        "created_at" => "2020-08-25 19:37:20"
        "updated_at" => "2020-08-25 19:37:20"
        "deleted_at" => null
      ]

One Juice is here, but juice1 is null! 😭

Activity icon

Replied to Multi 🧵Bindings.

This is probably bewitched! ✨

[null,null]
Activity icon

Replied to Multi 🧵Bindings.

@silencebringer

First of all: Woow! Thanks for the great help! 👍🏻

Unfortunately I only get the IDs in the database column "juice1" and "juice2".

1

2

Is there something missing?

Activity icon

Started a new Conversation Multi 🧵Bindings.

Hello Friends! 👋🏻

The following situation:

I have a juice that has been mixed from two different juices. We call it the "main juice". What does the model have to look like if I want to show the „main juices" of the „sub juice"?

Databasestructure of "subjuices"

id, title, juice1, juice2, descriptions & the timestamps

Thanks and a juicy day! 🧃

Aug
26
3 weeks ago
Activity icon

Started a new Conversation Guzzle-Error?

Hey!

Client error: `GET http://dashboard.site/hook/kunde` resulted in a `404 Not Found` response: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width= (truncated...)

If i try

$client = new GuzzleHttp\Client();
$client->get('http://dashboard.site/hook/kunde');

But i can call http://dashboard.site/hook/kunde localy!

Aug
24
3 weeks ago
Activity icon

Replied to Recursive ♻️Factorial

Hey @sinnbeck

But only in Laravel, right? Plain PHP wouldn't catch that? 🤔

Activity icon

Replied to Recursive ♻️Factorial

@michaloravec

"I've heard about recursion many times, but until now I didn't call the function again and again, because the thing with the "Allowed memory size" without the if-block scared me!"

If I don't catch an error somewhere, it will crash on a live server, but it will not paralyze it. But if I start an "infinite call", it will crash much more, right?

Activity icon

Replied to Recursive ♻️Factorial

Hello friends!

The more code, the better, even if it is not the same code, right?

What @ravish posted seems to me to be a method in a class, while mine is a function. But of course the same in principle.

The question was whether the recursion itself is "clean code". :)

Aug
23
3 weeks ago
Activity icon

Started a new Conversation Recursive ♻️Factorial

Hello again! 👋🏻

This code I have written and understood. The idea came to me when I tried to solve it with a "for" loop.

Is that a "clean code"? I've heard about recursion many times, but until now I didn't call the function again and again, because the thing with the "Allowed memory size" without the if-block scared me! 👻

Thanks! 💜

function recursive_factorial($int) {
  	if ($int == 0) {
	   return 1;
	}
  
	return recursive_factorial($int-1) * $int;
}

print_r(recursive_factorial(5)); // 1 * 2 * 3 * 4 * 5
120
Activity icon

Replied to Crazy ✨Closure

While browsing for more examples of closures, i found "Variable functions".

I didn't know that was possible in PHP. Have you ever used it? 💥

function echoit($string)
{
    echo $string;
}

$func = 'echoit';
$func('Hello World');
Hello World
Activity icon

Replied to Crazy ✨Closure

Big thanks @sinnbeck

No, @martinbean. These are tasks of https://edabit.com/challenges which I go through to keep myself fit and clarify open questions. But I'm working on them without applying for a new job. :)

Activity icon

Replied to Crazy ✨Closure

Okay, I understand that example.

What is the practical purpose of a closure? It seems to me to be rather cumbersome, if I could pass two parameters to a function at once. 🤔

Activity icon

Replied to Crazy ✨Closure

$func = adds_n(3);
$result = $func(56);
print_r($result);
59

Okay. Now I have more questions! 🤯

Why does it work?

$func calls the function and gives it a 3. $result calls the function "$func", which calls the function adds_n with the 3, and gives it 56 by magic.

And at the end it goes...

Activity icon

Replied to Crazy ✨Closure

But I can't get a 4 in that output.

Somehow I don't understand how I could call this function if I didn't have a testcase.

Activity icon

Started a new Conversation Crazy ✨Closure

Hello Friends! 👋🏻

According to the task definition I should build an anonymous function that adds "10" to the passed number.

I did not manage to do this myself, but had to look into the solution. I have listed it below. But I don't understand it completely, so I have some questions.

❓Warum don't I see 4 somewhere when I try to give $x the number 3?

❓Was exactly does this output mean?

❓Laut the test case this code works, only I don't understand why.

Thanks for the help!

Code:

function adds_n($n) {
	return function ($x) use ($n) {
      return $x + $n;
    };
}

print_r(adds_n(3));

Output:

Closure Object
(
    [static] => Array
        (
            [n] => 3
        )

    [parameter] => Array
        (
            [$x] => <required>
        )

)

Testcase:

public function testAdd() 
{
  public function testAdd() {
  $adds1 = adds_n(1);
  $this->assertEquals($adds1(3), 4);
 }
}
Aug
22
4 weeks ago
Activity icon

Replied to Fun With Maps! 🗺

Hey @jlrdw

$arr = [1, 2, 3, 6, "Hello World", 12, null];
function upwardTrend($arr) {
  $trash = [];
  $items = [];
	 array_map(function($item) use (&$trash, &$items) {
    	if(!is_integer($item)) {
          	$trash[] = $item;
        	return "Is in Trash";
        }
       return $items[] = $item;
    }, array_filter($arr));
  
  return [
    'Numbers' => $items,
    'Trash' => $trash
  ];
}

print_r(upwardTrend($arr));
Array
(
    [Numbers] => Array
        (
            [0] => 1
            [1] => 2
            [2] => 3
            [3] => 6
            [4] => 12
        )

    [Trash] => Array
        (
            [0] => Hello World
        )

)

Like so? No zero values and the wrong values are stored in a separate array.

Would you do that in the big wide world? 🌏

Activity icon

Started a new Conversation Fun With Maps! 🗺

Hello!

Code:

$arr = [1, 2, 3, 6, "7"];

function upwardTrend($arr) {
	 return array_map(function($item){
    	if(is_string($item)) {
        	return "Strings not permitted!";
        }
       return $item;
    }, $arr);
}

print_r(upwardTrend($arr));

Output:

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 6
    [4] => Strings not permitted!
)

I wanted to ask if this is "the best way" to check an array, for example, to see if it might contain strings where there should only be numbers.

In the past I used imm "foreach", but now I try to use "array_map" more often.

Is this a good style?

Thanks! ✨

Activity icon

Replied to Deep Dark Forest 🌲

Hey @snapey

So it's become a little more understandable. I am looking for practical examples, but apart from examples that the numbers change a variable even outside a function, I don't find any practical use. Like:

function foo(&$var)
{
    $var++;
}

$a=5;
foo($a);
// $a is 6

When do you use it?

I think this is the better solution to the task I posted above:

function capMe($arr) {
  return array_map('ucfirst', array_map('strtolower', $arr));
}
Aug
21
4 weeks ago
Activity icon

Replied to Deep Dark Forest 🌲

First of all, thanks for the answer @snapey @automica !

$item = ucwords(strtolower($item));

Is the $item in the foreach then a reference? $item = is then an assignment of the variable...

It's pretty confusing. :(

Activity icon

Started a new Conversation Deep Dark Forest 🌲

function capMe($arr) {
  foreach ($arr as &$item) {
    $item = ucwords(strtolower($item));
  }
  return $arr;
}

This function transforms every first letter of the item in the array to a capital letter. (But it also makes them small in the first place).

I got that.

But I just do not understand what exactly makes:

&$item

"Parameter passing by reference" says Google. Could somebody explain it in a way that it also understands 🐒? Maybe with more, practical, examples? The more, the better!

Thanks! 💜

Aug
13
1 month ago
Activity icon

Replied to CollectionsTerror! ✨

Yeah! ✨

       $this->juices = $this->juices->push(JuiceMix::all())->flatten()->toArray();


        return view('livewire.juices-search', [
            'searchResults' => $searchResults,
            'juices' => $this->juices
        ]);

@michaloravec was right! The livewire was the Problem!

BIG THANKS to ALL Lara-Friends! 💜

Activity icon

Replied to CollectionsTerror! ✨

Illuminate\Database\Eloquent\Collection {#1261 ▼
  #items: array:2 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
  ]
}

Dont work in the View. Maybe i pass it wrong, again? 😭

 return view('livewire.juices-search', [
            'searchResults' => $searchResults,
            'juices' => $juices
        ]);
Activity icon

Replied to CollectionsTerror! ✨

The first one works in controller:

Illuminate\Support\Collection {#1112 ▼
  #items: array:6 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
    2 => App\JuiceMix {#1282 ▶}
    3 => App\JuiceMix {#1283 ▶}
    4 => App\JuiceMix {#1284 ▶}
    5 => App\JuiceMix {#1285 ▶}
  ]
}

But not in the view:

Illuminate\Database\Eloquent\Collection {#1261 ▼
  #items: array:3 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
    2 => Illuminate\Database\Eloquent\Collection {#1281 ▼
      #items: array:4 [▼
        0 => App\JuiceMix {#1282 ▶}
        1 => App\JuiceMix {#1283 ▶}
        2 => App\JuiceMix {#1284 ▶}
        3 => App\JuiceMix {#1285 ▶}
      ]
    }
  ]
}

Activity icon

Replied to CollectionsTerror! ✨

$juicesWhitoutMix = $this->juices;
        $juiceMix = JuiceMix::all();

        $juices = $juicesWhitoutMix->merge($juiceMix);
        $juices = $juices->flatten();

        

        return view('livewire.juices-search', [
            'searchResults' => $searchResults,
            'juices' => $juices
        ]);
    }
Activity icon

Replied to CollectionsTerror! ✨

Illuminate\Database\Eloquent\Collection {#1046 ▼
  #items: array:2 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
  ]
}
Illuminate\Database\Eloquent\Collection {#1275 ▼
  #items: array:4 [▼
    0 => App\JuiceMix {#1276 ▶}
    1 => App\JuiceMix {#1277 ▶}
    2 => App\JuiceMix {#1278 ▶}
    3 => App\JuiceMix {#1279 ▶}
  ]
}
Activity icon

Replied to CollectionsTerror! ✨

flatten works, but only in controller, not in view. :(

Illuminate\Support\Collection {#320 ▼
  #items: array:4 [▼
    0 => App\JuiceMix {#1276 ▶}
    1 => App\JuiceMix {#1277 ▶}
    2 => App\JuiceMix {#1278 ▶}
    3 => App\JuiceMix {#1279 ▶}
  ]
}

Edit: Wrong entries in Array. All now JuiceMix now. :C

Activity icon

Replied to CollectionsTerror! ✨

    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}

Somehow it gets lost in the view when I do dd($juices). :(

Activity icon

Replied to CollectionsTerror! ✨

  $juicesWhitoutMix = $this->juices;
  $juiceMix = JuiceMix::all();

  $juices = $juicesWhitoutMix->push($juiceMix);

Like so. :D

Activity icon

Started a new Conversation CollectionsTerror! ✨

Hallo

Illuminate\Database\Eloquent\Collection {#1261 ▼
  #items: array:3 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
    2 => Illuminate\Database\Eloquent\Collection {#1275 ▼
      #items: array:4 [▼
        0 => App\JuiceMix {#1276 ▶}
        1 => App\JuiceMix {#1277 ▶}
        2 => App\JuiceMix {#1278 ▶}
        3 => App\JuiceMix {#1279 ▶}
      ]
    }
  ]
}

Hello. I want it all to be an array of objects. Is that possible somehow? So for example

Illuminate\Database\Eloquent\Collection {#1261 ▼
  #items: array:3 [▼
    0 => App\Juice {#1048 ▶}
    1 => App\Juice {#1047 ▶}
    2 => App\JuiceMix {#1276 ▶}

Aug
12
1 month ago
Activity icon

Replied to Upload Pictures / Videos 💌

Hey @tisuchi

Yes, but its für Version 5.3. Maybe it's a "better" way in Laravel 7? 🙂

Activity icon

Started a new Conversation Upload Pictures / Videos 💌

Hello friends!

I would like to know what is the "best" way to give users the possibility to upload pictures and/or videos in Laravel. Is there a guide to what is the best solution?

Thanks! ✨

Jul
29
1 month ago
Activity icon

Replied to Best Place For Interfaces, Abstract-Class And So On.

I wonder about "Contracts"... 🤔 Why not "Interface"?

Activity icon

Started a new Conversation Best Place For Interfaces, Abstract-Class And So On.

Hello,

I'm looking for the best place for interfaces and so on. Does it go in the "app" folder now? In "Http"? In Controller even?

Activity icon

Started a new Conversation What Is This Spelling?

echo (new BasicInspection())->getCoast();

If I don't put the "new BasicInspection" in "(", before the echo, it won't work. Why?

Jul
06
2 months ago
Activity icon

Replied to Livewire - Show Slug.

Okay. The solution was that I used the "mount" method in the component, and in the controller, of course, gave the slug to the view. Thanks for the link!

Activity icon

Replied to Livewire - Show Slug.

I'll get my data from the API. Now I would like to address the show method with a slugs.

Of course it works, if I simply call the slug in the controller and start an API call. But I created a component and when I call the "show" method I would like to pass the given slug to this component.

Activity icon

Started a new Conversation Livewire - Show Slug.

Hall. I'd like to address a simple "show" method with Livewire. How do I get my slug into the "render" method? Thank you.

Jun
23
2 months ago
Activity icon

Replied to How To Add Laravel Install GLOBAL In Fish Terminal (Mac)

When I close my terminal, I always have to run "source ~/.zshrc". That can't be right...

Activity icon

Started a new Conversation How To Add Laravel Install GLOBAL In Fish Terminal (Mac)

I don't understand why there isn't a simple instruction to insert this garbage very easily. What exactly do I have to do?

Mar
31
5 months ago
Activity icon

Started a new Conversation Explain Code

Hello! Can someone explain this code to me? Why this Tilde?

return ~~(101 * lcg_value());

Thanks! 💖

Mar
21
5 months ago
Activity icon

Started a new Conversation Laravel 7 + MailHog

Hello! Since I started using Laravel 7, my local MailHog is not working anymore.

Swift_TransportException
Cannot send message without a sender address

My configs:

MAIL_DRIVER=smtp
MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
Mar
16
6 months ago
Activity icon

Started a new Conversation Out-of-the-box-Fail

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxx/.npm/_logs/2020-03-16T15_13_50_017Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/xxx/.npm/_logs/2020-03-16T15_13_50_031Z-debug.log

Install Laravel (7) and try the authentication...