Konstruktionsplan

Konstruktionsplan

Member Since 8 Months Ago

Hamburg

Experience Points
8,150
Total
Experience

1,850 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
63
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 2
8,150 XP
Mar
31
1 month 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
2 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
2 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...

Feb
28
3 months ago
Activity icon

Started a new Conversation Install Laravel 7 With Composer

Hello! I want to install laravel 7 with composer. How is the right terminal command for do this? Thanks

Jan
24
4 months ago
Activity icon

Started a new Conversation Filter One Value.

Howdy!

I'm looking for the "best" way to get all entries out of the database, except a specific one.

Background: I have a dropdown with animals. It should show all animals from the database, except the animal that is currently opening this dropdown.

return AnimalClass::find($animal_class_id)->animal;

Here I get all animals, which belong to an AnimalClass. But now exactly one animal from the whole selection should be "filtered".

Thanks

Jan
21
4 months ago
Activity icon

Replied to Name For This?

Very good! I didn't know it under that term because nobody ever said it. :D Thanks!

Activity icon

Replied to Name For This?

Thank you for the explanation. :) I know what it means, but what is its name? If I want to explain to someone what it is, I have to say: Something that converts a string into an integer.

Activity icon

Started a new Conversation Name For This?

Hi friends!

$page = (int) $request->get('site', 1);

What is this spelling: "(int)" before the "$request". Is there a special expression like "type hinting"?

Jan
13
4 months ago
Activity icon

Replied to PHPStorm - "Wrong" DI

Delete Controller -> init new Controller -> DI another Controller -> works. :D

Thanks @jlrdw !

Activity icon

Started a new Conversation PHPStorm - "Wrong" DI

Howdy!

I want to insert my class into the constructor via DI, but instead of "HomeController" it writes "/HomeController". This was not the case before. Did I change anything?

Jan
08
4 months ago
Activity icon

Replied to Cant Find Animal

@tykus

use RefreshDatabase;

Wohoo! Thanks!

Activity icon

Replied to Cant Find Animal

Thanks a lot, @tykus. That looks cleaner!

If you could just tell me how to automatically delete the animal again. Is there a faker? Unfortunately, the Laracast tutorial is outdated. :(

Activity icon

Started a new Conversation Cant Find Animal

Hello Friends of Testing! :D

I wanted to check a specific URL. I create an animal and output a route that works when I call it from the browser.

$animal = factory('App\Animal')->create();
$response = $this->call('GET', 'tier', $animal->id);
$response->assertStatus(200);
ErrorException: Invalid argument supplied for foreach()

btw:

$animal = factory('App\Animal')->create();
$response = $this->get('tier/' . $animal->id);
$response->assertStatus(200);

This works great, but I think it's ugly. It would be better if I give the instance to the route, as it already happens with the view.

Route::get('/tier/{animal}', '[email protected]')->name('tier');
Jan
07
4 months ago
Activity icon

Replied to Pattern-Friends!

Hey @fylzero

Example:

I have many blog entries. These are displayed in the frontend and of course in the backend. (So more or less classic WordPress).

Now I would have to write something banal like "return Post::all();" in the [email protected]

I would have to do the same in the [email protected]

But at some point I get the idea that loading all entries will destroy the world. In your case I would have to open every controller and change every line. The homie with the repo, however, changes it only in one place for all controllers, because he injected the interface of the repo into the constructor via DI.

If I ever change to another database model, I have to go through the whole project to change it.

Activity icon

Replied to Pattern-Friends!

Of course, it is mostly project dependent. But I like to use the repository pattern, for example, because I find it much "cleaner".

Jan
06
4 months ago
Activity icon

Started a new Conversation Pattern-Friends!

Howdy!

I wanted to ask which patterns you use and which ones, at least in your eyes, make the most sense.

Jan
04
4 months ago
Activity icon

Replied to Mass Destroy Is Not Working

::delete is not working, i think.

Route::delete('users_mass_destroy', 'Admin\[email protected]')->name('users.mass_destroy');

In Forms you must "fake" the method:

<form method="POST">
@method('DELETE');
</form>

From here: https://laracasts.com/series/laravel-6-from-scratch/episodes/24
Jan
03
4 months ago
Activity icon

Awarded Best Reply on How To Enable Bootstrap In Laravel

composer require laravel/ui --dev
php artisan ui bootstrap

Did you execute this?

Source: https://laravel.com/docs/master/frontend#introduction

Jan
02
4 months ago
Activity icon

Replied to Show | Update - Method

But how does my view look like? No "hidden" type as input with "post_id" as value? How the method know, what to change?

Activity icon

Replied to Show | Update - Method

Wohoo! Thanks!

Currently i give the "post_id" as "type="hidden" in view an submit it to "update"-Method.

Is this the only way? (respectively the best)

Activity icon

Started a new Conversation Show | Update - Method

Hello! :)

Goal: I want to show a Post. :D

Migration, Seeding and so on is done.

View:

<a href="{{route(post, $post->id)}}">Great Post</a>

Route:

Route::get('/post/{post_id}', '[email protected]'));

Now my generated Controller show me this method-header:

 public function show(Post $post)

But why the generated Controller show me this code? I must change it to

 public function show(int $post_id)

It works! But i think, Laravel has a reason for this! :)

Activity icon

Replied to Limewire | Cache Problem

Nope. Its MacOS.

Activity icon

Replied to Limewire | Cache Problem

Yes. :(

Activity icon

Replied to Limewire | Cache Problem

I gave them the evil 777.

Activity icon

Replied to Limewire | Cache Problem

php artisan cache:clear

Not working. :C The "bootstrap/cache" directory exists.

Activity icon

Started a new Conversation Limewire | Cache Problem

Hello.

After install livewire and build the searchbar like here: https://medium.com/@branick/search-with-laravel-livewire-cb6dcd4ad541

The /tmp/storage/bootstrap/cache directory must be present and writable.
Activity icon

Replied to How To Enable Bootstrap In Laravel

composer require laravel/ui --dev
php artisan ui bootstrap

Did you execute this?

Source: https://laravel.com/docs/master/frontend#introduction

Activity icon

Replied to How To Display Animals With All Informations?

That's a good point.

$animal->race

In my dreams I want this scenario. Can you show me a little codesnipped what do you mean with "intermediate table"?

Here is my structure

Animal-Table: id, name, animal_class_id, timestamps
Race-Table (like german shepherd): id, race, timestamps
AnmialClass-Table (like Dog, cat): id, animal_class, timestamps
AnimalClassRace ("connect" AnimalClass and Race): id, race_id, animal_class_id, timestamps

The Animal-Table has the reference to "AnimalClassRace". The "AnimalClassRace" has the ids to race and animalclass.

My goal is: Display a Animal, with race (german shepherd) and animal_class (dog).

Activity icon

Replied to FIND_IN_SET In Laravel

Nice! That looks good!

Activity icon

Replied to Migration - Rename Always Needet?

Thanks a lot! :)

Activity icon

Replied to Migration - Rename Always Needet?

@nakov and its "okay" when the project get a lot of files in the migration-folder?

Activity icon

Replied to Migration - Rename Always Needet?

Let me explain my example:

We build a blog. Maybe a blog with shop. We start with shop and build the order, item, and so on. Now we need a user, because every user must be registred to buy something. We implements the shop system already and.... oh no!...the shop system must be have the reference to user! Now i must rename the new user-tables! (Maybe add a new colum like "owner" in shop-table. But the user-table must be migrate first!)

Btw: Thats not my project! :D Its only a example!

Activity icon

Replied to Migration - Rename Always Needet?

Hello.

I know why the migration fails but with 20 migration-files in running development (and a lot of client-changes :D) is the renaming of all this files to correct order not so cool. A Config-file for a big project is better then rename it or not?

Activity icon

Started a new Conversation Migration - Rename Always Needet?

Hello!

For example, we take two migration-files: 003-user and 002-profile.

Let us say, we build 002-profile first and write something like this:

$table->bigUnsignInteger('id');
$table->bigUnsignInterger('user_id');
$table->foreign //to user-table

Now it will crash, because he cant find the user-table. When i rename the user-table to 001-user, it works.

This example is easy, when i have two tables...but with 20 its a little bit...."unpractical".

Question: Can i write in code the order of my migrations (maybe a hidden config file)?

Activity icon

Replied to FIND_IN_SET In Laravel

I think, the best way is a "raw-query":

https://laravel.com/docs/6.x/queries#raw-expressions

Jan
01
4 months ago
Activity icon

Replied to Redirecting To Specific Id

Hey.

I don't know, how you build the roles-logic but maybe like this:

Auth::user()->role;

Now you get the role from your User. Maybe you build the @if-statment in Blade.

$user_id = Auth::user()->id;
User::where('id', $user_id)->first();

Now you get the User, who is logged in.

Activity icon

Replied to How To Display Animals With All Informations?

Big Thanks Guys!

   $animals = DB::table('animals')
            ->join('animal_classes_races', 'animals.animal_class_race_id', '=', 'animal_classes_races.id')
            ->join('races', 'animal_classes_races.race_id', '=', 'races.id')
            ->join('animal_classes', 'animal_classes_races.animal_class_id', '=', 'animal_classes.id')
            ->get();

And now:

Illuminate\Support\Collection {#286 ▼
  #items: array:1 [▼
    0 => {#295 ▼
      +"id": 1
      +"name": "bello"
      +"avatar": ""
      +"animal_class_race_id": 1
      +"created_at": "2019-12-30 20:32:58"
      +"updated_at": "2019-12-30 20:32:58"
      +"animal_class_id": 1
      +"race_id": 1
      +"race": "hund"
      +"animal_class": "eurasier"
    }
  ]
}

Is this the "best way" to do that?

Edit: Hmm. Now i must use the "where"-Statement in all the Tables. :(

Example: I want all animals whit "animal_class" "dog". Now i must write the whole statement with "->where('animal_class' = $request->animal_class_id). It works, but its not so pretty.

Dec
31
4 months ago
Activity icon

Replied to How To Display Animals With All Informations?

Thanks!

Now I get the the race_id from animalclassrace-Table. But I want to output the racename from racetable with this id. How can I do it?

Dec
30
5 months ago
Activity icon

Replied to How To Display Animals With All Informations?

Thanks for Help! :)

   $animals = Animal::with(['animalClassesRace'=>function($q){
            $q->select('*');
        }])->whereHas('animalclassesrace', function($q){
            $q->where('animal_classes_races.id','=',1);
        })->get();


        foreach($animals as $race){
           dd($race->animalClassesRace->race_id);
        }

Now i get the "race_id" and the "animal_class_id". With this information, the only way is to build another Where-Query? :(

Activity icon

Replied to How To Display Animals With All Informations?

Not bad, but not my situation.

I can output the animal:

#attributes: array:6 [▼ "id" => 1 "name" => "bello" "avatar" => "" "animal_class_race_id" => 1 "created_at" => "2019-12-30 11:21:29" "updated_at" => "2019-12-30 11:21:29" ]

But how can i reference the "animal_class_race_id" to "animal_class_race"-Table in the Database. The "animal_class_race" has "race_id" and "animal_class_id".

I need the values from "race" and "animal_class"-Tables, and not the numbers like 1,1. :(

Activity icon

Started a new Conversation How To Display Animals With All Informations?

Hello! :)

I have four Tables. "animals", "races", "animal_classes" and "animal_class_race".

Races and animal_classes are boring, only with "id" and "name".

The "animal_class_race" has: "id", "race_id", and "animal_class_id". Let us say: 1, 1, 1, and the timestamps

In "animal"-Table i have "id", "name" and "animal_class_race_id". Let us say: 1, bello, 1

What is the best Way to show this animal with informations from "race" and "animal_class"?

Thank you and happy christmas! :)

Nov
30
6 months ago
Activity icon

Replied to Laravel To Production!

Maybe the official tutorial from laravel.com? :)

https://laravel.com/docs/6.x/deployment