DarkRoast

DarkRoast

Member Since 4 Years Ago

Experience Points 35,050
Experience
Level
Lessons Completed 236
Lessons
Completed
Best Reply Awards 30
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

09 Nov
1 month ago

DarkRoast left a reply on What Is .then For?

It's an alternative and cleaner way to using callbacks. Internally axios would use a Promise which contains a resolve() and reject() function. Once resolve() is called that means the thing that takes time loading i.e. and image in this case is ready and your .then() function is called. if reject() is called in the promise that means some error has occurred which can be caught with .catch()

08 Jan
11 months ago

DarkRoast left a reply on Views Not Found

What does php artisan route:list show you?

13 Dec
1 year ago

DarkRoast left a reply on Eager Loading Is Taking A While

Joins can be more efficient than large "IN" lists.

11 Dec
1 year ago

DarkRoast left a reply on When I Change My Database, It Is Invalid

I think you need to specify the database connection you want to migrate:

php artisan migrate --database test_mysql
08 Dec
1 year ago

DarkRoast left a reply on Destroy All Related Posts On Destory Of A Discussion

Well you have a few options either just delete the related model like:

Discussion::posts()->delete();
Discussion::destroy($discussion->id);

Or you could use the deleting event which is fired by the framework.

Or you could set up a cascading delete in your migrations.

DarkRoast left a reply on VueJS Calculate With Percentage

Just add on the base no? (this.percentage / 100) * this.base + this.base

02 Dec
1 year ago

DarkRoast left a reply on Laravel Validation

Because the user can modify the html and disable it.

21 Nov
1 year ago

DarkRoast left a reply on How Do You Work With Different Computer?

I use homestead never had any issues with it although testing can be slow on an SQL database (prefer SQLite in memory wherever possible).

18 Nov
1 year ago

DarkRoast left a reply on Is Basic Laravel Auth Safe For Admin Panel?

You may want to use it over https for additional security that way everything that is sent is encrypted.

17 Nov
1 year ago

DarkRoast left a reply on Wanted To Move Away Values From .env

Perhaps create a symlink to the file?

12 Nov
1 year ago

DarkRoast left a reply on What Is The Actual Laravel Architecture? Is It Realy MVC Architecture?

The controller does not use middleware directly. The request can flow through the middleware on it's way to the controller if that middleware has been assigned to the route in question.

https://laravel.com/docs/5.5/lifecycle

07 Nov
1 year ago

DarkRoast left a reply on Regex In Validator Rules

Instead of a regex you can use alpha_num.

To solve with a regex it will look something like this: 'regex:/[a-zA-Z0-9]+/', {1} has no limiting effect here it will just be added to the character group.

06 Nov
1 year ago

DarkRoast left a reply on Laravel - Like \ Dislike System

Use polymorphic relation s like @ohffs says. You can add a boolean column too if you want to track likes and dislikes.

01 Nov
1 year ago

DarkRoast left a reply on Lots Of Error After Creating A Project In Laravel

You can use --no-euggest flag to silence suggest packages. It's not an error though and won't make any difference to the installation.

19 Oct
1 year ago

DarkRoast left a reply on Href Methods Laravel

Second param needs to be an array:

href="{{ action('[email protected]', ['id' => [$post['id'], 'eventID' => $eventID['eventID']]) }}"
18 Oct
1 year ago

DarkRoast left a reply on How To Implement Middleware Structure Design

To me middleware is part of the application where messages pass through and some checks are performed like authentication, rate limiting etc.. Logic in controllers is fine if it's a smaller app and you're not duplicating loads of code.

Depends how you define "business logic" too.. it's a bit of a vague term.

DarkRoast left a reply on AXIOS: How To Render To HTML

Try something like this in your template:

<div v-if="vitrine && vitrine.length">
  <div v-for="item in vitrine">{{ item.descricao }}</div>
</div>

Note that line one checks that that data has been received from the get request.

03 Oct
1 year ago

DarkRoast left a reply on Mac Shutdown During Tests. Why?

Check Utilities/Console and see if you can find something like:

"Previous Shutdown cause: 5"

Some of the error code numbers and their meanings:

https://georgegarside.com/blog/macos/shutdown-causes/

DarkRoast left a reply on How Can I Select A Model To Use Based On A Variable?

Was mainly referring to the query builder methods not other things like observers.

DarkRoast left a reply on How Can I Select A Model To Use Based On A Variable?

Yeah none of them are static under the hood that's just the facade providing a simple interface over the top.

https://laracasts.com/lessons/decoding-facades

DarkRoast left a reply on How Can I Select A Model To Use Based On A Variable?

Use polymorphism:

public function update(Illuminate\Database\Eloquent\Model $model)
{
  $info['type'] = $this->place_type;
  $info['name'] = $info['name'] ?? $title;
  $info['official_name'] = $info['official_name'] ?? $info['name'];

  $model->updateOrCreate(['title' => $title], ['title' => $title] + $info);
}

Then do something like $something->update(resolve(Country::class));

13 Jul
1 year ago

DarkRoast left a reply on Please Help Me Convert This SQL Into An Eloquent Query

I would leave it too. No need for Eloquent here.

02 May
1 year ago

DarkRoast left a reply on Mutated Date Columns Being Set To Current Timestamp

What does your migration SQL output look like? Is there anything like "ON UPDATE CURRENT_TIMESTAMP" on that column?

DarkRoast left a reply on Single Page Application Technique

They are loading all the data up front which would make sense given that the site does not have too many pages.

25 Apr
1 year ago

DarkRoast left a reply on Recommendations For Cloud-based Laravel Hosting (preferably Auto-scaling)?

You can use AWS with Forge so maybe AWS autoscaling would work for you?

23 Apr
1 year ago

DarkRoast left a reply on Mac Mini As Dev Box?

Thanks @Snapey How's the performance of the SSDs when running tests against the database? I'd imagine it would be quite a lot quicker than a standard HDD.

DarkRoast started a new conversation Mac Mini As Dev Box?

Hey guys, I'm in the market for a mac mini as a new dev machine (laravel/symfony/homstead/some light photoshop) and have a few questions:

  1. is 8gb of ram enough to run homstead/virtualbox or should I go with 16?
  2. which monitor would you recommend? Looking for something around 27inchs @ 2560x1440.
  3. general experience with the mac mini/reliability etc?

Thanks.

18 Apr
1 year ago

DarkRoast left a reply on How Integrate FPDF To Laravel 5.3, Help

Check packagist.org there's one for Laravel available here:

https://github.com/codedge/laravel-fpdf

14 Apr
1 year ago

DarkRoast left a reply on My Developer Friend's Opinion On Laravel

I don't think they have used Laravel enough to have an informed opinion. You can write the same enterprise style code with Laravel if you want to. I've used both.

DarkRoast left a reply on Npm Install Questions

As it says it wants node >= 6 but you have 4.4.7 - just install the latest from here:

https://nodejs.org/en/download/

DarkRoast left a reply on How Does Jeffrey Make Screencasts Without Keyboard Sounds?

I believe the technical term would be a noise gate. Not sure what app he uses though.. maybe:

https://www.youtube.com/watch?v=myV5m3PorJU

DarkRoast left a reply on Who Can I Order Records In Relationship.

Try this:

$post->comments()->orderBy('column_name')->get();

Also note this: http://stackoverflow.com/a/28224427

26 Mar
1 year ago

DarkRoast left a reply on MethodNotAllowedHttpException In RouteCollection.php Line 233

@Snapey I agree, I also don't use it anymore.

@ElvinGizWiz you can always have artisan generate your resource controllers for you with php artisan make:controller PostsController --resource to avoid typos and such.

DarkRoast left a reply on MethodNotAllowedHttpException In RouteCollection.php Line 233

In the console what does php artisan route:list show you? The exception means you're probably sending the wrong type of request to the endpoint e.g. GET to a POST.

Also you should be using {!! !!} instead of {{ }} because you are outputting html characters.

DarkRoast left a reply on Why Am I Finding It Difficult To Use A Framework?

In my opinion doing small throw away projects is fine to start with but you should also tackle something that will challenge you a bit more too. You could also try adding some features to an existing project.

24 Mar
1 year ago

DarkRoast left a reply on Working With Caching In Laravel 5

You could use decorators then your resulting code to perform a cached query would look like:

$posts = (new CacheablePosts(resolve(Post::class)))->all();

Take a look at this lesson.

DarkRoast left a reply on Laravel Paginator Object Does Not Have Render Method

You would get a method not found exception if the render method didn't exist. it's returning an empty string for some reason... check your inputs.

19 Mar
1 year ago

DarkRoast left a reply on Vue Js Object Property Called Within A Blade Call Possible?

I would create a separate <course-item> component then pass the id in as a prop.

10 Mar
1 year ago

DarkRoast left a reply on Should I Learn Jquery ?

I wouldn't use jQuery for any new projects it's practically a legacy technology at this point. I would use vanilla js until you feel you need some more structure then reach for something like Vue or React.

DarkRoast left a reply on Ajax Upload Image HELP

Your route should be lowercase.. Route::post

01 Mar
1 year ago

DarkRoast left a reply on Same URL For Different Actions Base On User Role

Yeah I'd defer that logic somewhere else like @jekinney said - maybe use the template method pattern or just plain inheritance to dry those helper classes up too.

27 Feb
1 year ago

DarkRoast left a reply on Laravel 5 Show Random Post

Route::post('get-random-post', '[email protected]'); should be Route::get(...)

DarkRoast left a reply on Laravel-mix Include Custom Webpack Config

Take a look at merging under Working With JavaScript - think that's what you might be looking for.

DarkRoast left a reply on Polymorphic Relationship

$item->comments->first() should do the trick.

25 Feb
1 year ago
23 Feb
1 year ago

DarkRoast left a reply on How To Pass Date Field To Date Formfield

The default format for the html date input type needs to be dd-mm-yyyy - that can't be changed as far as I can tell.

DarkRoast left a reply on Laravel - Array To String Conversion - When Validation Failed

Should it not be $request->input('first_name'); ?