JMarcher

JMarcher

Member Since 4 Years Ago

Cologne

Senior Developer at OUTRIGHT Vision GmbH

Experience Points 68,220
Experience Level 14

1,780 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 658
Lessons
Completed
Best Reply Awards 2
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.

11 Feb
5 months ago

JMarcher left a reply on Laravel 42000 Syntax Error Or Access Voilation 1064 You Have An Error In Sql Syntax

Disable debug on the production server, I can see all the passwords and secret keys

27 Nov
7 months ago

JMarcher left a reply on How To Decrypt Data From Encrypted Database To Show A List?

You could add something like this in your model:


public function getNomeDecryptedAttribute(){
    return decrypt($this->nome);
}

This way you attributes only will be decrypted when needed. If you need all attributes at once, I believe there is no other way around and you need to do it as you did.

May I ask why are you encrypting every single field and then decrypting it back?

23 Nov
7 months ago

JMarcher left a reply on Session Expire Event?

You can extend the SessionManager and overwide the createCacheHandler() method to return your own CacheBasedSessionHandler.

Inside the CacheBasedSessionHandler is where the destroy() method resides, there you should be able to fire an event and then destroy the session.

15 Aug
11 months ago

JMarcher left a reply on How Can I Convert Many Statement Mysql To Laravel Eloquent?

@moses Look we are not here to do your homework.

I do not want to sound aggressive but you seem to want the answer served on a plate....

21 Feb
1 year ago

JMarcher left a reply on Abandoned Package

You just need to use any version > 2.2.0

19 Jan
1 year ago

JMarcher left a reply on SWITCH TO LINUX

I personally use Manjaro using it since years and have no complains about it.

18 Aug
1 year ago

JMarcher left a reply on Laravel Artisan Commands From Route Times Out

You should do that on a job.

Check your .env file and make sure that your queue driver is not sync, if you do not want jobs to be dispatched directly in the request

JMarcher left a reply on Laravel Artisan Commands From Route Times Out

$stats = Stat::where('userid', $user->id)->first(); gets executed for each user, it seems like your model is missing a relationship.

Your user model could have a hasMany relationship between Stat and you will reduce your number of queries notoriously if you do something like:

$users = User::with('stats')->get();

JMarcher left a reply on Join Two Tables

Laravel has Lazy loading for relationships , to use eager loading we need to use the with() method.

In your case what you want to do is apply some conditions on a relationship that your model has (note wording) that is why you can use whereHas() to apply some conditions on the relationship.

JMarcher left a reply on Join Two Tables

That is wrong, you should be doing something like:

$addresses = Address::whereHas('linked_addresses',function($query) use($single_mixing){
$query->where('code', '!=', $single_mixing->code);
})->get();
05 Apr
2 years ago

JMarcher left a reply on Making API Routes Stateful

APIs are by nature stateless, you can achieve the behaviour you want by using API Tokens, that references one user, state or action in your application.

07 Dec
2 years ago

JMarcher left a reply on Nested Eager Loading

Something like

$post = Post::with(['comments' => function ($query) { $query->orderBy('created_at', 'desc'); },'comments.owner'])->find($id);
23 Nov
2 years ago

JMarcher left a reply on Github Synchronisation Issue

Github released Gitkraken it looks like a great multi-platform tool to do the job

I personally do not use any tools, and resolve the conflicts my self with a text editor and use command line to merge.

15 Nov
2 years ago

JMarcher left a reply on Github Synchronisation Issue

That's kinda part of the job, to resolve conflicts, ideal is that if you are in a team, your team members do not edit the same files as you but if that happens you need to resolve the conflicts if any.

There are several tools to make this a little bit easier

17 Aug
2 years ago

JMarcher left a reply on About JSON Errors Response

Don't be intimidated by Transformers, you can maybe start with an ErrorTransformer like this:

<?php

class ErrorTransformer {
    public function transform($errors)
    {
        return [
                    'success' => false,
                    'errors' => $this->transformErrors($errors)
                ]
    }
    protected function transformErrors($errors)
    {
         // Transform the errors as you want
    }
}

but take note that the MessageBag has errors and errors can contain a list of values in it

08 Aug
2 years ago

JMarcher left a reply on Get Real IP Address

If you are under the same WiFi you will always have the same public IP

05 Aug
2 years ago

JMarcher left a reply on 5.3 Ready For Production?

Taylor also twitted that it will be released in a couple of weeks: https://twitter.com/taylorotwell/status/760954553948774400

16 Jul
3 years ago

JMarcher left a reply on Any Way To Clean Up My BlogController ?

@alanaasmaa Just a Trait with the methods you need, lets say for example: getCategories() and you either retrieve them from your database or from your cache.

15 Jul
3 years ago

JMarcher left a reply on Any Way To Clean Up My BlogController ?

just because you use tags and categories in every request in your controller, I would create a ModelCache trait, so you don't query your database each time to retrieve them.

26 Jun
3 years ago

JMarcher left a reply on Forcing HTTPS Routes On Laravel 5.2

I use a Middleware here is mine:

<?php

namespace Demi\Http\Middleware;

use App;
use Closure;
use Illuminate\Http\Request;
use Redirect;

class ForceSecure
{
    /**
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        if (! $request->secure() && App::environment() !== 'local') {
            $request->setTrustedProxies([$request->getClientIp()]);

            return Redirect::secure($request->getRequestUri());
        }

        return $next($request);
    }
}

the line is for CloudFlare:

$request->setTrustedProxies([$request->getClientIp()]);
20 Jun
3 years ago

JMarcher left a reply on How To Add Middleware To Middleware Group Based On Enviroment

@vedmant yes it works, you need to do it like so:

/**
     * Kernel constructor.
     * @param array $middlewareGroups
     */
    public function __construct(Application $app, Router $router)
    {
        $this->app = $app;
        $this->router = $router;
        $this->middlewareGroups['api']=[
            'throttle:1000,2',
        ];
        foreach ($this->middlewareGroups as $key => $middleware) {
            $router->middlewareGroup($key, $middleware);
        }

        foreach ($this->routeMiddleware as $key => $middleware) {
            $router->middleware($key, $middleware);
        }

    }

JMarcher left a reply on How To Add Middleware To Middleware Group Based On Enviroment

On Kernel's __construct()

Just push what you want to $middlewareGroups

16 Jun
3 years ago

JMarcher left a reply on New Spark App Zeitgeber

I just saw to promotional video, I just spotted a typo: Plural for Activity is Activities not Activitys

15 Jun
3 years ago

JMarcher left a reply on Smartest Way To Re-use JSON API Within Blade

If I understood what you want, what you could do is: Use Vue, then, load the models with your Json Data and you can use this to display everything. This has nothing to do with Blade btw

10 Jun
3 years ago

JMarcher left a reply on SPAM Protection?

@JeffreyWay Why not recaptcha? I personally hate email verification (of course only a personal preference) because I need to leave the website and sometimes wait for the email to arrive.

30 May
3 years ago

JMarcher left a reply on Should I Move To A CDN?

The reason that @SaeedPrez points is why CDN is actually the best approach, because cache is your best friend when you need to load a page as quick as possible

23 May
3 years ago

JMarcher left a reply on Storing A New Contact (polymorphic Business/Person)

  • Remove comments and spaces between lines, most of them are redundant
  • By the amount of conditionals in your code, it is clear that this method has to many responsibilities
  • Try to extract some responsibilities to a new Class or if you don't find it necessary into different methods
14 May
3 years ago

JMarcher left a reply on Search Package

Algolia have a free plan that for a starter is pretty good, if you need more records is probably worth it to spend a few dollars in a good search service

JMarcher left a reply on Where Are You All From?

I'm from Montevideo, Uruguay But I live in Paderborn, Germany

JMarcher left a reply on Search Package

I recommend Algolia ( https://www.algolia.com/ ) Super simple and the results are pretty fast.

Really easy to integrate with Laravel

13 May
3 years ago

JMarcher left a reply on Database Tables, Migration, Indexes

I would really consider splitting your Model in a different way, for example

$table->integer('make_id');
            $table->integer('models_id');
            $table->integer('color_id');
            $table->integer('fuel_id');
            $table->dateTime('yearOfManufacture');
            $table->integer('cylinder_id');
            $table->integer('emission_id');
            $table->integer('wheels_id');
            $table->integer('weight_id');
            $table->integer('mileage');
            $table->decimal('price', 8, 2);
            $table->string('vin');
            $table->integer('transmission_id');
            $table->integer('typeApproval_id');
            $table->integer('numberOfDoors');
            $table->integer('bodytype_id');

Could be simplified with:

 $table->unsignedInteger('car_id');
$table->foreign('car_id')->references('id')->on('cars')
                ->onUpdate('cascade')->onDelete('cascade');

This way your model will be cleaner, and with this relationship you could do something like $ad->car->price;

JMarcher left a reply on MariaDB Or MySQL?

Yes, until now you can use the same tools you used for MySQL in MariaDB also.

JMarcher left a reply on MariaDB Or MySQL?

This leads always to a personal choice. But I'll always stick with whatever package your operative system supports/maintains/updates better.

06 May
3 years ago

JMarcher left a reply on [Help] Need To Add Image And Text Inside A Json DB Column

Rather than answering your question I'll try to encourage you to change your implementation.

Your implementation violates one of the first principles of database normalization, where "Every row-and-column intersection contains exactly one value from the applicable domain (and nothing else)." -Wikipedia

You may think you don't but storing an array as json in a cell for me kind of does.

In your case I would consider making Image a new Model

JMarcher left a reply on Homestead: Not Working After "El Capitan" Installation

As indicated, did you tried to boot the vagrant image with your VM?

16 Apr
3 years ago

JMarcher left a reply on Non Mantained Laravel Versions Documentation

@jlrdw Dude, do you even read?

There are Laravel versions not maintained anymore, for this versions is mandatory a kind of warning.

JMarcher left a reply on Non Mantained Laravel Versions Documentation

@jlrdw It is not about how smart you are for making 2 clicks

It is about user friendliness.

And also Laravel 4.2 and below are not maintained anymore.

JMarcher started a new conversation Non Mantained Laravel Versions Documentation

This is a suggestion for the Laravel Documentation on the website. I realized that when you seach on google for some laravel documentation, most of the times it takes me to the Laravel 4.2 documentation. In my oppinion the user must be adviced to change the documentation version for the recent one.