Web Developper at Ajaccio

Member Since 3 Years Ago


Experience Points

3,450 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
Best Reply Awards
Best Reply
  • 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.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    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 16
76,550 XP
1 month ago
Activity icon

Started a new Conversation Updating Router


I've built a resource-tool and I wonder how I can change the url after a specific method.

For now I'm using the window.location.href, it's working but it's also reloading (I'm losing some toast notification for example).

How can I reload the router in Nova ?


1 month ago
Activity icon

Replied to Laravel Nova Action Fields

You can do something like

Text::make('Field name', function() {
    return $this->a.'/'.$this->b;
Activity icon

Replied to Display Memory Usage / Time In Artisan Command

for the time you can use the microtime function.

$start = microtime(true);
// your code
$execution_time = microtime(true) - $start;
Activity icon

Replied to Many To Many Relationship Attach User When Creating A Project

@stephanha54 hey I think I know why it didn't work, you can attach / sync pivot data on a single model. In my code was doing it on the whole collection of projects.

Maybe this would work better

Activity icon

Replied to Question About The Connection For A User

I don't understand why you are trying to achieve here. Is there any errors ?

Activity icon

Replied to Eloquent | Relationship With And Where Clause Based On Foreign Column

Maybe try this

Group::where('visible',1)->with(['pages'=>function($q) {
   $q->where('visible', 1);
}])->has('pages', '>', 0)->orderBy('order', 'asc')->get();
Activity icon

Replied to Fetch Profile Data For The Profile View

the Auth::user() gives you the User model of the logged user, so I don't understand the problem here

Activity icon

Replied to Foreach Loop Is Deleting Me A Record !

Can we see the full controller ? Are you using an Observer ?

1 month ago
Activity icon

Replied to Sublime Text 3 Setup For Laravel

I think a lot of people here moved to Visual Studio Code or PHP Storm

1 month ago
Activity icon

Replied to How To Sort Outer Query Based On A Internal Query Field??

Try this maybe

DB::table('products')->join('reviews', '', '=', 'reviews.productId')->where('category_id', $category->id)->selectRaw('products.*, AVG(reviews.rating) as product_rating')->orderByDesc('product_rating')->get();
Activity icon

Replied to How To Prevent Specific Value In Validation

 'companyAddressId' => 'required|not_in:one,two',
Activity icon

Replied to Laravel Vapor Deployment Error

@jlrdw I tweeted him but no response yet

Activity icon

Started a new Conversation Laravel Vapor Deployment Error

Hi everyone,

I'm trying Laravel Vapor but I've got a weird problem. When I try to deploy my app I've got this error

  Loading composer repositories with package information                                                        
  Installing dependencies (including require-dev) from lock file                                                
  Package operations: 2 installs, 0 updates, 0 removals                                                         
    - Installing itconsulting/serveralerts (dev-master): Symlinking from ./nova-components/ServerAlerts         
    - Installing laravel/nova (dev-master): Symlinking from ./nova                                              
  Generating optimized autoload files                                                                           
  > Illuminate\Foundation\ComposerScripts::postAutoloadDump                                                     
  > @php artisan package:discover --ansi                                                                        
  The environment file is invalid!                                                                              
  Failed to parse dotenv file due to unexpected whitespace. Failed at...

Here is my .env file







PFKE_USERAGENT="XX XXXXXXXXX ([email protected])"


I'm only able to deploy if all PFKE and GMOD keys are not in the .env file

Can you spot the problem here ?

Thank you

Activity icon

Replied to Many To Many Relationship Attach User When Creating A Project

Try this

$user->projects()->attach($project->id, ['field' => 'data']);
Activity icon

Replied to Store Data To Two Table From One Controller

You could add a method addDevice to your Sale model and then call it like


Sale Model

function addDevice($data) {
    $this->devices()->save(new Device($data));
Activity icon

Replied to Collect Data And Generate A Report

Pull the data from the database, put it on a view and transform this view into PDF with

Activity icon

Replied to Calculate Hours

If hour start and hour end are Carbon instance then you can calculate time like this

Activity icon

Replied to Laravel: Drag And Drop Fields Funtionalities.

I don't know premade packages like this.

Create your own around this maybe

Activity icon

Replied to @if En Una Vista

In english would have been better :p

It's probably not working because your query return an instance of Collection.

Try something like this

DB::table('providers')->where('id', $provider->id)->select('active')->first();

and then in you're if

@if($pro->active === "no")
@elseif($pro->active === "si")

p.s: @bobbybouwmann too fast :p

2 months ago
Activity icon

Replied to Send Data From Model To The Ajax In Laravel

Can you show us the error ?

Activity icon

Replied to How To Get Rating Average?

Let's try this (replace with good table name and field names)

DB::table('businesses')->join('reviews', '', '=', 'reviews.business_id')->groupBy('')->selectRaw('businesses.*, AVG(reviews.rating) AS average')->orderByDesc('average')->get()
Activity icon

Replied to Validation: Class Users Does Not Exist

can you show us the whole method ?

Activity icon

Replied to Validation: Class Users Does Not Exist

  'email'     => 'required|email|unique:users,email'

for the unique rule you have to give the table (users) and the field (email)

Activity icon

Replied to Hello Upload Photo Not Found!

Can you show us the code ? Hard to help if we can't see anything

2 months ago
4 months ago
Activity icon

Replied to Uncaught ReferenceError: Require Is Not Defined In Vuejs Laravel

Show us the content of your JS file

Activity icon

Replied to How To Get Data From Database?

Is there any reasons not to user Eloquent models ?

By the way I don't really understand what you want to achieve here ? What's the problem ?

tips: the href in the a tag could be

{{ url($contact->username) }}
Activity icon

Replied to Progressive Web Apps

That would be nice !

Activity icon

Replied to WhereNotIn & Where Methods Not Working When Combined

Can you show us the query ? Or report that bug to github :p

Activity icon

Replied to Dynamic Model Names

You could do

// $entity could be 'user' or whatever the model name

$model = app(ucfirst($entity));

Activity icon

Replied to Best Practice To Implement Code Revision

Why not use git the deploy your code en production and staging server ?

Activity icon

Replied to Making My Class Instance Persistent Over Next Request

Maybe you could store the model in a session or something ?

Activity icon

Replied to Should I Use An Accessor Or A Function?

I would user a function, maybe one day you'll have to pass some parameters to filter the result or something.

Activity icon

Replied to Login Over URL

You could pass the api token to the browser via a query string (well that's not safe but it should work), and then process it in you're controller like this

public function logViaToken() {
    // Validate the request
    // Get the user
    $user = User::where('api_token', request('api_token'))->first();
    // Check if user exists
    // Log the user

    // Redirect
Activity icon

Replied to Authorization And Mysql Query

@jlrdw I already think to use a scope to filter the programmes the user can access. It limits the verification you're right. I've never used the global scope and it works really fine, thanks for the suggestion.

The only problem with the global scope (well it's not a big problem) is when i try to access a programme I shouldn't I receive an 404 not found error instead of a 403 unauthorized.

4 months ago
Activity icon

Replied to How To Select Some Entries From HasMany Relation?


You could make a thing like this. I don't know the model names or relations names so I'll guess it

// fetch all the tracks from a specific job
$tracks = Job::find(X)->tracks;

$start = $tracks->first();
$end = $tracks->last();

// where Y is the index you want
$points = $tracks->slice(Y, 10);
Activity icon

Started a new Conversation Authorization And Mysql Query

Hi everyone,

I'm not sure where to post this, I've got no problems but I'd wonder if I could optimize my code, so here is the thing.

I've got a model called 'Promotion' which is a sort of a container. To view a promotion a user must have the authorization according to his role and his company.

For the promotion owner this is just a simple verification like promotion->owner_id === user->id so no problem

My concern is for the real estate agents, they can view a promotion only if their company has been attached to the promotion via a 'Mandat'. So if I'm listing all the promotions on a page, for each row the gate will query the database like

select * from `mandats` where `mandats`.`promotion_id` = X and `mandats`.`promotion_id` is not null and `company_id` = Y limit 1

Is there a better way using the authorization when there are queries ? Is there any other solutions ?