Konstruktionsplan

Member Since 1 Year Ago

Hamburg

Experience Points
14,120
Total
Experience

880 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
97
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.

  • Community Pillar

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

Level 3
14,120 XP
Mar
30
2 weeks ago
Activity icon

Replied to Upload 🆙Image

Aww. Now it works!

I did read the documentation on the "public disk" but was kind of expecting it to all happen in the "public" folder. Which it doesn't. The magic happens in the storage folder and is linked with a symbolic link.

Thanks for the help!

Activity icon

Replied to Upload 🆙Image

If I removed these lines, then it no longer uploads the image.

$newImageName = time() . '-' . $request->title . '.' . $request->image->extension();
	$request->image->move(public_path('img'), $newImageName);
Activity icon

Replied to Upload 🆙Image

    $request->validated();

        $newImageName = time() . '-' . $request->title . '.' . $request->image->extension();
        $request->image->move(public_path('img'), $newImageName);

        Platform::create($request->except('image') + [
                'image' => $request->image->storeAs('img', time() . '-' . $request->title . '.' . $request->image->extension(), 'public')
        ]);

        return redirect()->route('dashboard');

Now this error:

The "/tmp/php3yUmFF" file does not exist or is not readable.

Quite strange, since I never told it to save it to the "tmp" directory.

Activity icon

Replied to Upload 🆙Image

That's what I thought at first too!

But then what comes from the view is not validated, so I discarded that.

Activity icon

Started a new Conversation Upload 🆙Image

Hello friends.

I want to build a simple upload.

First I create a request file. There I define the rules.

   public function rules()
    {
        return [
            'title' => 'required',
            'link' => 'required',
            'image' => 'required',
        ];
    }

Now the controller...

public function store(StorePlatformRequest $request)
    {
        Platform::create($request->validated());

        $newImageName = time() . '-' . $request->title . '.' . $request->image->extension();
        $request->image->move(public_path('img'), $newImageName);

        return redirect()->route('dashboard');
    }

The problem is that it saves me the path "/tmp/phpVLn6qr" in the database.

It is the wrong directory, with the wrong name and without extension. What exactly am I doing wrong?

Mar
28
2 weeks ago
Activity icon

Started a new Conversation Foundations 🍋

Hello friends! ✨

I have a few questions that may seem fundamental, but still give me some difficulties in understanding.

Let's take the example:

User::all();

In theory, I can't write it into the controller, but would have to write into the model something like:

public function getAllUsers() {
return User::all();
}

and then in controller somehow like this:

$allUsers = $user->getAllUsers();

My understanding is that the controller is responsible for the correct calls and not as a playground for numerous calculations etc. - Is that correct?

And if so, where do I write the calculations? Do I now push everything into the jobs and services? Are there perhaps videos where the whole topic is discussed?

Thanks!

Mar
26
2 weeks ago
Activity icon

Replied to Request ➕Create

Aww. Simple change "created" to "creating". Works fine! Thanks!

Activity icon

Replied to Request ➕Create

Observer 😍.

But doesn't the Observer fire AFTER the store?! 🤔

Activity icon

Started a new Conversation Request ➕Create

Hello friends!

The following, quite simple, situation:

I just want to save a post with the "auth()->user()->id" in the database. From a form I get a "title" with.

First I have php artisan make:request PostStoreRequest and set up my rules there.

Now I want to get that into the database in the controller:

Post::create($request->all());

How do I get the ID of the user into the database? I don't want to solve it with a hidden field.

Thanks! ✨

Mar
23
3 weeks ago
Activity icon

Replied to Get ☘️ALL!

I realize that.

Of course, the data sets do not become less, only less data is fetched.

I suppose that in combination with "pagninate" or/and "remember" it would definitely bring more speed.

Activity icon

Replied to Get ☘️ALL!

I have now changed it to "Select". Does this also make sense? I don't need the ID and timestamps.

Platform:all();

to

Platform::select(['title', 'link', 'imgurl', 'slug'])->get();
Activity icon

Started a new Conversation Get ☘️ALL!

Hello friends!

I keep reading that something like this is not very great because it can cause performance problems.

$user = User::all();

But what is the alternative to this? I need a list of users from the database..

Thanks!

Activity icon

Replied to Dynamic 🛸Forms

No idea anyone? 😭😭😭

Mar
22
3 weeks ago
Activity icon

Replied to Dynamic 🛸Forms

It can be!

Currently it is a "normal" view. I would then create livewire components and include them with something like "<livewire:forms />" in the view e.g. "welcome.blade.php".

Activity icon

Replied to Dynamic 🛸Forms

I'll try it this way:

Step 1: I press a button and a new form like e.g.

<div>
<form method="POST" action="xy">
@csrf
<input type="text" name="xx">
<input type="text" name="yy">
</form>

appears.

Step 2: If I type something into these input fields, then immediately a new entry is created with what is typed there.

Of course I have to complete step 1 first.

Activity icon

Started a new Conversation Dynamic 🛸Forms

Hello friends!

I need some food for thought on how to create a new form with input fields (which in turn immediately write to the database each time a key is pressed in the typed - But step by step) by clicking on a button.

I am using Laravel & Livewire.

Thanks for the help! 🖤

Mar
21
3 weeks ago
Activity icon

Started a new Conversation TailwindCSS2 ⚡️PHPStorm

Hello friends! 🌿

It is strange! In some projects I can make the TailwindCSS classes complete via autocomplete. On other projects, also with the classic setum given by TailwindCSS2 tutorial. Suddenly it doesn't work anymore.

Does anyone maybe have the same problem?

I would very much hate to have to resort to any PHPStorm plugins. 😒

Thank you very much! 🖤

Mar
12
1 month ago
Activity icon

Replied to Best 🍪Way?!

I didn't say that the components are new, but that the way to include a template via the components was new to me.

Activity icon

Started a new Conversation Best 🍪Way?!

Hello friends! ✨

What is actually the best way to build a template?

In the past I always wrote the following:

@extends('app.layout')
@section('sidebar')
...

When I look at Jetstream, it has been solved via the components. Is this the new shit now? 🤭

Jan
10
3 months ago
Activity icon

Replied to CURL-Massacre 🩸

Now I have pushed everything up and get at least already halfway something "right". Oddly enough, it now tells me that I am unauthorized. With terminal it now also no longer works.

But the keys are stored correctly.

Illuminate\Http\Client\Response {#494 ▼
  #response: GuzzleHttp\Psr7\Response {#529 ▼
    -reasonPhrase: "Unauthorized"
    -statusCode: 401
    -headers: array:15 [▼
      "Date" => array:1 [▶]
      "Server" => array:1 [▶]
      "X-Powered-By" => array:1 [▶]
      "X-Robots-Tag" => array:1 [▶]
      "Link" => array:1 [▶]
      "X-Content-Type-Options" => array:1 [▶]
      "Access-Control-Expose-Headers" => array:1 [▶]
      "Access-Control-Allow-Headers" => array:1 [▶]
      "Vary" => array:1 [▶]
      "Content-Type" => array:1 [▶]
      "X-Varnish" => array:1 [▶]
      "Age" => array:1 [▶]
      "Via" => array:1 [▶]
      "Content-Length" => array:1 [▶]
      "Connection" => array:1 [▶]
    ]
    -headerNames: array:15 [▶]
    -protocol: "1.1"
    -stream: GuzzleHttp\Psr7\Stream {#527 ▶}
  }
  #decoded: null
  +"cookies": GuzzleHttp\Cookie\CookieJar {#508 ▶}
  +"transferStats": GuzzleHttp\TransferStats {#530 ▶}

Edit:

In the WooCommerce description is somehow still passed the "wp_api" and "version". Do I have to (and can I) pass that via Laravel as well?

require __DIR__ . '/vendor/autoload.php';

use Automattic\WooCommerce\Client;

$woocommerce = new Client(
    'https://example.com',
    'consumer_key',
    'consumer_secret',
    [
        'wp_api' => true,
        'version' => 'wc/v3'
    ]
);
Activity icon

Replied to CURL-Massacre 🩸

Laravel and WooCommerce runs on the same local machine. But your post 🖤 got me thinking. Yes, it may be that the terminal can fire a successful cURL statement to the local environment, but I shouldn't assume that an application can as well. I'll push the store to a live server and would test it again and get back to you if necessary.

Thanks for this thought! :)

Jan
09
3 months ago
Activity icon

Replied to CURL-Massacre 🩸

Hi, big thank you for the explanation! I have now tried it with BasicAuth. Unfortunately this does not work. But I get correct results via the conosole.

curl https://playground-wordpress.site/wp-json/wc/v3/orders -u ck_3345f111b028e182d49feeca982815c6b3dacebe:cs_eaa8618793277f5eb4c17625dace0969bdd50a81

The keys don't matter for now, since it's all local.

My try with Laravel:

$response = Http::withBasicAuth(
     'cs_eaa8618793277f5eb4c17625dace0969bdd50a81', 'ck_3345f111b028e182d49feeca982815c6b3dacebe')
    ->get('http://playground-wordpress.site/wp-json/wc/v3/orders');

dd($response);

Output:

Illuminate\Http\Client\Response {#494 ▼
  #response: GuzzleHttp\Psr7\Response {#529 ▼
    -reasonPhrase: "Not Found"
    -statusCode: 404
    -headers: array:6 [▶]
    -headerNames: array:6 [▶]
    -protocol: "1.1"
    -stream: GuzzleHttp\Psr7\Stream {#527 ▶}
  }
  #decoded: null
  +"cookies": GuzzleHttp\Cookie\CookieJar {#508 ▶}
  +"transferStats": GuzzleHttp\TransferStats {#530 ▶}
Activity icon

Replied to CURL-Massacre 🩸

As said. The site did not help me because there are no exampels that are close to reality. At least as far as this problem is concerned.

Jan
08
3 months ago
Activity icon

Started a new Conversation CURL-Massacre 🩸

Hello!

So slowly I'm getting desperate. I have a simple cURL command. There is a URL and after "-u" a "CONSUMER_KEY" and a "CONSUMER_SECRET".

Via the terminal it works wonderfully. How do I implement this in PHP with Laravel. The documentation just tells me nothing and helps 0.

So I hope someone here knows a simple method to fire a simple command and return its response.

Thanks.

Jan
06
3 months ago
Activity icon

Started a new Conversation Best🪡Way

Hello

Output

Stroman, McDermott and Mueller: 150
Considine-Osinski: 54
Stroman, McDermott and Mueller: 59
Kirlin-Blick: 195

Controller:

Playground::join('number', 'playground.hash', '=', 'earnings.hash')->orderBy('number.id', 'DESC')->get();

I want to see only one player, but the points should be counted together. Any idea how best to do this in Laravel? 🎉

Thanks

Dec
30
3 months ago
Activity icon

Replied to Right ✨Update-Queries.

That's what I'm going to do. Thanks!

I used to fetch the ID via the request, pass it in where and then it was done. But I want to get better. :D

Activity icon

Replied to Right ✨Update-Queries.

Thanks for this hint, which I certainly did not come up with....

Is there anyone who can explain this to me again in detail? For example, do I put in ->where($client) or something like that?

But thanks for your......... "help".

Activity icon

Started a new Conversation Right ✨Update-Queries.

Hello!

When I initiate a class, the method "Update" is created automatically:

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Client  $client
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Client $client)
    {
        //
    }

I don't quite understand why $request and $client are passed as parameters. What would the an input field in HTML, the route in web.php and the correct notation have to be to make an update?

Thanks! 🍰

Dec
17
3 months ago
Activity icon

Replied to Livewire 😒don't Work...

Hey.

Unfortunately, no logs are thrown. Could it be that Livewire 2 is not yet compatible with Laravel 8?

Activity icon

Started a new Conversation Livewire 😒don't Work...

Hello.

Always the same error that has been with me for weeks and for which I can not find a solution.

Completely empty installation of Laravel 8 ✅. TailwindCSS 2 installed and working ✅

But if I do the only two steps that Livewire wants:

composer require livewire/livewire
@livewireStyles
@livewireScripts

Then only this comes in the browser:

@livewireStyles @livewireScripts

Why doesn't it interepret this? It worked fine with Livewire 1....so a crap.

Dec
15
3 months ago
Activity icon

Started a new Conversation Skipping 😳PSR4

Whenever I do "composer update" it comes up gaaanz. Any idea how to solve this? 🤔

Thanks.

Class Livewire\Exceptions\CannotBindToModelDataWithoutValidationRuleException located in ./vendor/livewire/livewire/src/Exceptions/CannotBindToModelDataWithoutValidationRuleException 3.php does not comply with psr-4 autoloading standard. Skipping.
Class Livewire\Exceptions\CannotUseReservedLivewireComponentProperties located in ./vendor/livewire/livewire/src/Exceptions/CannotUseReservedLivewireComponentProperties 3.php does not comply with psr-4 autoloading standard. Skipping.
Class Livewire\Exceptions\ComponentNotFoundException located in ./vendor/livewire/livewire/src/Exceptions/ComponentNotFoundException 3.php does not comply with psr-4 autoloading standard. Skipping.
Class Livewire\Exceptions\CorruptComponentPayloadException located in ./vendor/livewire/livewire/src/Exceptions/CorruptComponentPayloadException 3.php does not comply with psr-4 autoloading standard. Skipping.
Class Livewire\Exceptions\MethodNotFoundException located in ./vendor/livewire/livewire/src/Exceptions/MethodNotFoundException 3.php does not comply with psr-4 autoloading standard. Skipping.
Class Livewire\Exceptions\MissingFileUploadsTraitException located in ./vendor/livewire/livewire/src/Exceptions/MissingFileUploadsTraitException 3.php does not comply with psr-4 autoloading standard. Skipping.
Nov
27
4 months ago
Activity icon

Replied to Tailwind Part ✌🏻

Now only errors if i try to run "npm run dev", after "npm install" ofc. :(

(Use `node --trace-warnings ...` to show where the warning was created)
(node:8036) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8036) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Activity icon

Replied to Tailwind Part ✌🏻

Hey. I run "npm run dev".

My package.json:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.19",
        "cross-env": "^7.0",
        "laravel-mix": "^5.0.1",
        "lodash": "^4.17.19",
        "resolve-url-loader": "^3.1.0",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "autoprefixer": "^10.0.2",
        "postcss": "^8.1.10",
        "tailwindcss": "^2.0.1"
    }
}
Nov
26
4 months ago
Activity icon

Started a new Conversation Tailwind Part ✌🏻

Hello. ✨

How do I install Tailwind v. 2 ? The instructions are not quite conclusive for me.

Install:

npm install tailwindcss postcss autoprefixer

resources/css/app.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

webpack.mix.js:

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        require('tailwindcss')
    ]);

ℹ️Output in public/css/app.css:

@tailwind base;
@tailwind components;
@tailwind utilities;
Nov
10
5 months ago
Activity icon

Started a new Conversation "Old" Auth-Mechanisms

Hello.

I'm a little confused now, what "auth mechanisms" there are in Laravel, away from Jetstream.

Actually, I would only have the "old" Auth option, but then with Tailwindcss instead of Bootstrap.

Would that be possible?

Thanks

Nov
08
5 months ago
Activity icon

Replied to Redirect Away

"htt"//youtube.link

Thanks! :)

Activity icon

Replied to Redirect Away

<a href="{{$youtube->youtube_link}}" target="_blank">Hello :) </a>

Not working. :(

Activity icon

Started a new Conversation Redirect Away

Hello.

I just want to get a link from the database, e.g. a YouTube link, and when I click on it I don't want /mypage.com/jdfskn to open, but the page in a new tab.

With redirect()->away() this does not work.

Oct
29
5 months ago
Activity icon

Replied to Stock In 📻Buttons.

Now I copied yours 1:1 and inserted my values and now it works. I had CSRF in it.

Don't find the error in my code, but thanks to you it works! :)

Activity icon

Replied to Stock In 📻Buttons.

    <p class="inline-block text-2xl"><input type="hidden" name ='questions[0][question_id]' value="Bird?">Bird?</p>
            <p class="text-2xl"><input type="radio" name="questions[0][answer]" value="1"> 🦜 <input type="radio" name="questions[0][answer]" value="2"> 🐥</p>
            
            <p class="inline-block text-2xl"><input type="hidden" name ='questions[1][question_id]' value="Take one">Take one</p>
            <p class="text-2xl"><input type="radio" name="questions[1][answer]" value="1"> 👋🏻 <input type="radio" name="questions[1][answer]" value="2"> ✨</p>

Cant find it. 🤔

Activity icon

Replied to Stock In 📻Buttons.

array:2 [▼
  0 => array:2 [▼
    "question_id" => Bird?"
    "answer" => "1"
  ]
  1 => "✨"
]

But we are slowly getting closer! :D Thanks!

Activity icon

Replied to Stock In 📻Buttons.

Migration:

    public function up()
    {
        Schema::create('birdy', function (Blueprint $table) {
            $table->id();
            $table->integer('player');
            $table->text('question');
            $table->integer('answer');
            $table->timestamps();
        });
    }

Views:

         <p class="inline-block text-2xl"><input type="hidden" name ='questions[0]question_id' value="Bird?">Bird?</p>
            <p class="text-2xl"><input type="radio" name="questions[0]answer" value="1"> 🦜 <input type="radio" name="questions[0]answer" value="2"> 🐥</p>
            
            <p class="inline-block text-2xl"><input type="hidden" name ='questions[1]question_id' value="Take one.">Take one.</p>
            <p class="text-2xl"><input type="radio" name="questions[1]answer" value="1"> 👋🏻 <input type="radio" name="questions[1]answer" value="2"> ✨ </p>
            

Controller:

  public function store(Request $request)
    {
        /* Dont work, i comment in for the testing
        $this->validate($request,[
            'questions.*.question' => 'required',
            'questions.*.answer' => 'required'
        ]);
        */
        
        dd($request->questions);
        
        foreach ($request->questions as $question) {
            DarkMatter::create([
                'player' => 1, // Here i need the value from first Question
                'question' => $question['question'],
                'answer' => $question['answer'],
            ]);
        }
        
    }
Activity icon

Replied to Stock In 📻Buttons.

 dd($request->questions);
array:1 [▼
  0 => "1"
]

Ehm. And now? I need something like this:

array:1 [▼
  'Take a bird.' => "1"
]

So i can save the Question and the Answer. :)

Activity icon

Replied to Stock In 📻Buttons.

Unfortunately I cannot yet imagine how the store method in the controller for this frontend looks like.

Do you happen to have a tip for me? :)

Activity icon

Replied to Stock In 📻Buttons.

Thanks for the detailed answer.

I have the problem that the questions do not come from the database, but are fixed in the code. So they have no ID. :(

Activity icon

Replied to Stock In 📻Buttons.

Great Idea! That will works!

More ideas for the best solution?

Wait a moment:

Will it work with multiple questions?

Activity icon

Replied to Stock In 📻Buttons.

Sure! :)

My Frontend:

<p class="inline-block text-2xl">Take a bird.</p>
<p class="text-2xl"><input type="radio"> 🦜 <input type="radio" class="ml-10"> 🐥</p>

And i want to store like:

id, question, answer, created_at, updated_at

Activity icon

Started a new Conversation Stock In 📻Buttons.

Hello friends! ✨

Actually a very simple task. I have a

tag, there is a question formulated. Underneath are the answers. I want it to store the question AND the answers in a line in the database. How do I do that exactly?

I get the answers in, but I don't get the question, because it is a

-tag. If I do a hidden-input, there is no assignment to the answers.

I hope someone knows the best solution for this.

Thanks. 🖤