Francismori7

Francismori7

Member Since 3 Years Ago

Quebec, Canada

Lead IT Management / Lead Developper at Groupe Ratté

Experience Points 176,550
Experience Level 36

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 1425
Lessons
Completed
Best Reply Awards 53
Best Reply
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.

01 Dec
3 months ago

Francismori7 left a reply on Prevent App From Duplicate Requests

Your CSRF token should actually take care of this.

29 Nov
3 months ago

Francismori7 left a reply on Laravel Display Restaurants By User_id

You may want to use a hasMany for your user model, if the user can have many restaurants. (Since you pluralize in your controller...)

However, if you are looking to get only the user's restaurant:

$restaurant = auth()->user()->restaurant;
04 Sep
6 months ago

Francismori7 left a reply on Composer Update Not Working In Laravel 5.6

I'm having the same issue right now. It was working fine yesterday. I'm upgrading to 5.7 right now and it's hanging.

Using composer update -vvv shows caches downloading, very slowly, but they are.

It ended up working fine.

16 Aug
7 months ago

Francismori7 left a reply on Take Only Specified Attributes From Collection.

There's absolutely no reason ->only() would not work here. I suggest you look further into your code base to see where you broke some stuff ...

08 Aug
7 months ago

Francismori7 left a reply on Pluck From A Nested Collection?

->map(function($item) { return $item->pls->strand_id; });

26 Jun
1 year ago

Francismori7 left a reply on Accessor On Demand But Not On Every Results.

@jlrdw definitely not the same method even if it's called with, that's why. I can have a create method on 1000 different objects and they all behave differently.

22 Jun
1 year ago

Francismori7 left a reply on Accessor On Demand But Not On Every Results.

Model::setAppends(['accessor'])->where('foo', 'bar'')->get('baz');

Try this.

Francismori7 left a reply on How Do I Hide And Show A Bootstrap Modal With Vue 2?

:class="{ in: modalShown }"
data() {
    return {
        modalShown: false;
    }
}

methods: {
    toggleModal() {
        this.modalShown = !this.modalShown;
    }
}

Francismori7 left a reply on Repo Pattern Really Worths?

Repositories on my side are useful when the implementation is subject to change, or the queries need to be centralised because they are used multiple times.

Francismori7 left a reply on Accessor On Demand But Not On Every Results.

@Borisu with() only works with relationships.

append() should work as expected.

26 Mar
1 year ago

Francismori7 left a reply on How To Write Texts To File In Laravel ?

Take a look at Storage:

use Storage;

Storage::put('file.txt', 'Your name');
18 Feb
2 years ago

Francismori7 left a reply on Collect Columns From Collection

What is your expected response? Think about it this way. What do you expect in the end?

05 Jan
2 years ago
04 Jan
2 years ago

Francismori7 left a reply on Braintree Payment

Paypal checkout buttons will still work.

20 Nov
2 years ago

Francismori7 left a reply on How To Insert Bunch Of Records In Table, Using Transaction Complete Or Rollback Concept?

DB::transaction(function() use ($studentsArray) {
    foreach($studentsArray as $student) {
        Student::create($student);
    }
});

Francismori7 left a reply on How To Mass Assignment Laravel Fillable

protected $guarded = [];
15 Nov
2 years ago

Francismori7 left a reply on Laracasts Refresh

Awesome

03 Oct
2 years ago

Francismori7 left a reply on Moment.js With Vue

@codeus, you missed the point. You can't use global scope variables from Vue's template bindings like this:

{{ moment(user.created_at).fromNow() }}

Having moment in the data helps. My way is to do this:

    //...
    methods: {
        moment(...args) {
            return moment(...args);
        }
    }
    // ...
28 Aug
2 years ago

Francismori7 left a reply on Syntax Error PhpStorm?

Because you have not set the JS syntax to support ES2015. You should have a popup up top that lets you do so.

25 Aug
2 years ago

Francismori7 left a reply on Laravel5.3 - Controller Auth Problems

@Bounoable using Middlewares to share variables to your views is the recommended approach in most cases, because you don't have to extend the controller over and over again.

Francismori7 left a reply on Grouping Laravel 5.3 Notifications

$user->notifications->groupBy('data.screen_id');

Should do the trick.

Otherwise, this will do it:

$user->notifications->groupBy(function ($item, $key) {
    return $item['data']['screen_id'];
});
07 Aug
2 years ago
27 Jul
2 years ago

Francismori7 left a reply on How To Combine And Retrieve Values Three Tables

Sale Model

  • Needs a items() relationship ($this->hasManyThrough)

SaleItem Model

Item Model

Review relationships and you'll be set to go.

25 Jul
2 years ago

Francismori7 left a reply on Swap Stripe Subscription To New Plan Doesn't Swap Name

You would then use book-club-subscription or something like that and widget-listing-subscription;. Those are STATIC id's that you refer from within your code. The plan name "display name" is not part of Cashier itself, for now.

16 Jul
2 years ago

Francismori7 left a reply on Laravel Pagination Not Working With Array Instead Of Collection

@DNAngel It wouldn't be a problem no.

The code you quoted on your post is related to eager loading. You load your model's relationships. In your case, you probably have something along the lines of $status->user or $status->comments, well you could use them there to load them properly from your database without using N+1 queries. See eager loading.

14 Jul
2 years ago

Francismori7 left a reply on Laravel Pagination Not Working With Array Instead Of Collection

@DNAngel I made it protected because it was only getting accessed from the very same controller it was declared in.

The MAX_CLIENTS_PER_PAGE "variables" are constants, not properties:

class ClientsController extends Controller
{
    /**
     * A page can have a maximum of x clients.
     */
    const MAX_CLIENTS_PER_PAGE = 10;
    /**
     * A client page can have a maximum of x orders.
     */
    const MAX_ORDERS_PER_CLIENT_PAGE = 10;

    /* Rest of class */
}
11 Jul
2 years ago

Francismori7 left a reply on Swap Stripe Subscription To New Plan Doesn't Swap Name

You completely missed my point. The name column is an IDENTIFIER, not a "pretty printed name". It's used so you can have multiple subscriptions for each user.

04 Jul
2 years ago

Francismori7 left a reply on Need Help With Query In Db With Huge Row

$keyBy = collect();

Product::where('buyer', 0)->where('cat_id',1)->chunk(10000, function($products) use ($keyBy) { 
    $keyBy->merge($products->keyBy('product_id'));
});

dd($keyBy);
03 Jul
2 years ago

Francismori7 left a reply on Laravel 5.2 JQuery Ajax Token 500 Error

Your jQuery instance uses this to fetch your CSRF token:

$.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') } })

Yet, your meta tag has a name of "csrf-token", not "_token".

That is your issue.

Use $('meta[name="csrf-token"]').attr('content') instead.

Francismori7 left a reply on Hacked

Your first issue is Wordpress. There are tons of AUTOMATED hacks for Wordpress websites. They just input your URL in the bot and in seconds they uploaded a malicious script that changes your SSH password and uploads itself onto your Wordpress installs.

Make sure you completely wipe out your Wordpress install and reinstall the latest version from scratch. You should be able to keep your database details.

Keep in mind MANY themes/templates will open vulnerabilities to your website since they use RAW PHP code that is unprotected and dangerous if used maliciously.

Francismori7 left a reply on Create Rows In Table Based On Number Of Users

if(\Carbon\Carbon::now()->dayOfWeek === \Carbon\Carbon::FRIDAY) {
    \DB::table('rentTable')->insert(['balance' => \DB::table('residentsTable')->count() * 170]);
}

If I understood properly?

24 Jun
2 years ago

Francismori7 left a reply on The Alert Doesn't Show Up In Laravel 5

@bashy has a good point, the redirect chaining allows with to flash data to the session.

Francismori7 left a reply on The Alert Doesn't Show Up In Laravel 5

In your view, you are referencing a Session variable while in your route you were passing a simple variable. The with() method passes data to a view but is never actually stored in the session.

Francismori7 left a reply on The Alert Doesn't Show Up In Laravel 5

You are passing an $info variable to your view, instead of flashing it to the database.

Use this:

Route::get('/', function () {
    \Session::flash('info', 'Hello world');
    return view('welcome');
});
22 Jun
2 years ago
16 Jun
2 years ago

Francismori7 left a reply on Class 'Braintree_Configuration' Not Found

https://laravel.com/docs/master/billing#braintree-configuration

You have the wrong package installed for Cashier and thus are not getting the right classes required by Spark.

11 Jun
2 years ago

Francismori7 left a reply on Can't Make V-cloak Work Anymore. How To Force V-cloak To Stay Longer?

@JohnRivs smart on the exception throwing. I would've went with a timer to check this to be honest. Good job.

Francismori7 left a reply on Can't Make V-cloak Work Anymore. How To Force V-cloak To Stay Longer?

It works. It's just fast enough that you don't see it. Try a created() method that hangs a bit and you'll see it.

Francismori7 left a reply on AuthorizesResources Not Found

Show us your Controller.php file.

Francismori7 left a reply on Swap Stripe Subscription To New Plan Doesn't Swap Name

Cashier's name table is not the plan itself, it's the name of the subscription for your code to use. Think of it as a way to have multiple subscriptions, one for videos and another one for topics for an example:

$videoSubscription = $user->subscription('videos');
$topicSubscription = $user->subscription('topics');

Note that you must specify it when creating a new subscription using newSubscription(). By default, it will be default.

Francismori7 left a reply on How To Write This Associative Query In Laravel 5.2 ?

$articles = \Auth::user()->articles()->with('category')->get();

You were referencing the "property" articles, which returns a collection, you would need to use ->articles->load('category'); for this. To use with, you need to reference the method itself (articles()) which exposes a query builder.

10 Jun
2 years ago

Francismori7 left a reply on Spark Forms Show Errors For A Split Second?

Use v-cloak on the main div.

Also add to your css:

[v-cloak] {
    display: none;
}

This is known as FOUC to vuejs. v-cloak will be removed by the compiler once it gets processed so you will only have the compiled content visible once it is available.

Francismori7 left a reply on Possible To Pass Vuejs Variable Into @include('partial') As Blade Variable

No. You cannot go from a compiled view back to a server side variable (PHP).

Using the event vuejs data in your partial will work without "passing" it since blade doesn't know about it, only the browser itself which compiles it upon reception.

If however your event variable comes from PHP in the same request that the view comes, you can use the $event variable directly without passing through vuejs.

09 Jun
2 years ago

Francismori7 left a reply on Returning JSON With Dates And Accessors

Just add due_at to the dates property and you will get exactly this behavior.

protected $dates = ['due_at'];
08 Jun
2 years ago

Francismori7 left a reply on Spark Vs Cashier

Very far. Spark is built with Cashier of course, but everything is baked in and was made with lots of time and effort from Taylor.

You will, however, be able to reach the same result with Cashier providing you have the patience and knowledge required.

07 Jun
2 years ago

Francismori7 left a reply on PhpStorm Autocomplete Not Working With Facade

I also have some issues with it. Some facades have no autocomplete data to them, some do... it's weird.