Pixelairport

Pixelairport

Member Since 2 Years Ago

Berlin

Experience Points
17,820
Total
Experience

2,180 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
164
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 4
17,820 XP
Nov
02
1 week ago
Activity icon

Started a new Conversation How To Save Images Path To Different Image Sizes?

I create a extension which have creates differents sizes for image uploads. For example I have an avatar. The full/path/to/image.jpg is stored to my users database. Now i want to upload mulitple files to public folder. This could look like this:

public/user/3nfHGe/avatar/msne484ng.jpg public/user/3nfHGe/avatar/small/msne484ng.jpg public/user/3nfHGe/avatar/large/msne484ng.jpg

I can change the macros for building these different sizes in a config file. So in one project i maybe have 2 macros in another one i have 10.

Now I try to find the best way to save the path to images in database. Would you save each to database in a single row, or would you do another field in users and save it as array or json in database, or would you split the filename and path and do everything in code. I mean recreating the full path in a controller or repository for example?

Nov
01
1 week ago
Activity icon

Started a new Conversation Save Whole Path To Image For Uploads?

Hi,

just wanted to ask if it is ok or best practise to save the whole path to database for uploads like avatars. I use Storage at laravel and get for example something like: user/4vR54Bnm/avatar/LJOGQJLe48GFceQxV5g4X5n8DZ1nguuZ7HQMzJj.png

The first part (user/4vR54Bnm/avatar/) is the path i want to use for the file and LJOGQJLe48GFceQxV5g4X5n8DZ1nguuZ7HQMzJj.png is the file.

Would you explode the full path and only store the file in database and create the full path again in your code? It is easier to store the whole path in db. But can i get problems with that later? What is best practise for that. I just ask before use it in my life project.

thx Norman

Oct
25
2 weeks ago
Activity icon

Awarded Best Reply on Phpunit.xml Does Not Use My Sqlite Settings

Ok. After a lot of hours i found the problem. It was my fault... I ever was thinking that

php artisan config:cache

does the same as

php artisan config:clear & php artisan cache:clear

But that isn't so... not sure why... but when i do the second version (first config:clear then cache:clear) it works.

Activity icon

Replied to Phpunit.xml Does Not Use My Sqlite Settings

Ok. After a lot of hours i found the problem. It was my fault... I ever was thinking that

php artisan config:cache

does the same as

php artisan config:clear & php artisan cache:clear

But that isn't so... not sure why... but when i do the second version (first config:clear then cache:clear) it works.

Oct
24
2 weeks ago
Activity icon

Replied to Phpunit.xml Does Not Use My Sqlite Settings

Yes. This is done by laravel as default. I changed nothing. I just set the two lines in phpunit.xml which is in root folder. Laravel comes with phpunit out of the box.

Activity icon

Replied to Phpunit.xml Does Not Use My Sqlite Settings

No. I dont set this be my own. I have the default user model and then another one:

class Trailer extends Model
{
    protected $fillable = [
        'title', 'tmdb_movie_id', 'site', 'key', 'size'
    ];
}
Activity icon

Replied to Phpunit.xml Does Not Use My Sqlite Settings

output is: alias phpunit='vendor/bin/phpunit'

Activity icon

Replied to Phpunit.xml Does Not Use My Sqlite Settings

With terminal while inside homestead/vagrant.

  1. vagrant ssh
  2. phpunit --filter=myTestFile
Activity icon

Started a new Conversation Phpunit.xml Does Not Use My Sqlite Settings

I start to learn testing. After a lot of tests I realized, that even if i setup my phpunit.xml to use sqlite, it uses my main database, which is mysql.

I have this in my phpunit.xml:

    <server name="APP_ENV" value="testing"/>
    <server name="BCRYPT_ROUNDS" value="4"/>
    <server name="CACHE_DRIVER" value="array"/>
    <server name="MAIL_DRIVER" value="array"/>
    <server name="QUEUE_CONNECTION" value="sync"/>
    <server name="SESSION_DRIVER" value="array"/>
    <server name="DB_CONNECTION" value="sqlite" />
    <server name="DB_DATABASE" value=":memory:" />

I don't want to use my production database for all my tests. I think it is better to use another one. But what have I forgot?

Oct
23
3 weeks ago
Activity icon

Replied to Best Way To Use Database At Testing

Thx @tykus ... sometimes i just need something to search for. Your really helped me to find a solution. The solution with php-vcr works. I also found a video here on laracasts: https://laracasts.com/lessons/testing-http-requests

Activity icon

Started a new Conversation Best Way To Use Database At Testing

I try to start with testing and wrote my first tests. Now i want to test things with database. Normally it creates every entry in the database which is my main database. So i switch to sqlite (:memory:). That means i have to do migrations everytime. The problem is, that i use other apis to get data into the database which i need. Its an app for movies and i need to get 100 movies for each test ... What is the best way now? Normally the application caches the movies for a few hours, but testing loads it everytime again and says "too many requests".

  1. Should i only work with fake data? I mean: Should i test the api in an extra test and the rest of my application with fake data (factories)?
  2. Should i use my live database and reset everything after tests. I think this is possible but not clever.
  3. Is there a way to use cache from my original application? And is that good ... i think this can get confusing when i have to test caching stuff. And also my repositories would throw errors.

What do you think? Or what is the best way. Im new to testing and the conept is a bit confusing for me.

Oct
14
4 weeks ago
Activity icon

Replied to Testing Json Status (with GuzzleHttp)

ok. i call the wrong parameters in console and did

phpunit --filter=unit/MovieDbApiTest.php

when only call

phpunit

it works.

this is the new test which works, if someone is interested.

public function it_has_api_access()
{
    $key = config('services.movieDb.key');
    $url = config('services.movieDb.url');
    $query = 'dumbo';

    $client = new Client();
    $response = $client->get("$url/search/movie?api_key=$key&query=$query");
    
    $this->assertEquals($response->getStatusCode(),200);
}
Activity icon

Started a new Conversation Testing Json Status (with GuzzleHttp)

I want to start with testing and wrote my first test. But the test always says that everything is ok. When using the code in a normal route and output the status i got 200... here i check for 500... but i also get an ok. Can anyone help?

public function it_has_api_access()
{
    $key = config('services.movieDb.key');
    $url = config('services.movieDb.url');
    $query = 'dumbo';

    $client = new Client();
    $response = $client->get("$url/search/movie?api_key=$key&query=$query");
    $response->assertStatus(500);
}
May
13
6 months ago
Activity icon

Replied to MP3 Upload

@ROBSTAR - what do you mean? Is that wrong? What would you suggest? thx