mtvs_dev

mtvs_dev

Member Since 4 Years Ago

Experience Points
7,000
Total
Experience

3,000 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
61
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 2
7,000 XP
25 Nov
3 years ago

mtvs_dev left a reply on Should I Store Hashids In Database Or Decode Them On Every Request?

@mstnorris Not true about hashids.org

Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers.

mtvs_dev left a reply on Should I Store Hashids In Database Or Decode Them On Every Request?

@pmall Initially I was going to do it like you said but I saw this answer http://stackoverflow.com/a/12257207/1404348

The good thing about this is you don't even have to store these hashes in the database. You could get the hash from url once request comes in and decrypt it on the fly - and then pull by primary id's from the database (which is obviously an advantage in speed).

So still not sure which way i should do this.

mtvs_dev started a new conversation Should I Store Hashids In Database Or Decode Them On Every Request?

I`m going to use hashids instead of database ids in my urls, should I dedicate a field to them in database table or encode ids to hashids on url generation and decode hashids to ids on incoming requests?

18 Nov
3 years ago

mtvs_dev left a reply on Laravel Elixir And Font-Awesome

I think elixir should replace the original file with the versioned file to avoid these problems.

13 Oct
3 years ago

mtvs_dev started a new conversation Composer Update Fails

I just want to install a new package but when I run composer update package/package it fails because of the requirements of another package.

How can I skip this?

php composer.phar update guzzlehttp/guzzle

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - mccool/laravel-auto-presenter 3.0.0 requires php >=5.5.0 -> your PHP version (5.4.45-1+deb.sury.org~precise+1) or "config.platform.php" value does not satisfy that requirement.
    - mccool/laravel-auto-presenter 3.0.0 requires php >=5.5.0 -> your PHP version (5.4.45-1+deb.sury.org~precise+1) or "config.platform.php" value does not satisfy that requirement.
    - mccool/laravel-auto-presenter 3.0.0 requires php >=5.5.0 -> your PHP version (5.4.45-1+deb.sury.org~precise+1) or "config.platform.php" value does not satisfy that requirement.
    - Installation request for mccool/laravel-auto-presenter == 3.0.0.0 -> satisfiable by mccool/laravel-auto-presenter[3.0.0].
07 Jun
4 years ago

mtvs_dev left a reply on Access To Config Service Inside App\Console\Kernel::schedule()

I just needed to call the $this->bootstrap() inseide the App\Console\Kernel::schedule().

mtvs_dev left a reply on Access To Config Service Inside App\Console\Kernel::schedule()

@mstnorris I just call config('file.key') inside the App\Console\Kernel::schedule() and I don't change its namespace.

mtvs_dev left a reply on Access To Config Service Inside App\Console\Kernel::schedule()

@mstnorris that's not the problem because I access to the config service using config().

mtvs_dev started a new conversation Access To Config Service Inside App\Console\Kernel::schedule()

I want to get a couple of config values in the App\Console\Kernel::schedule() but the following error occurs:

ReflectionException: Class config does not exist in /home/vagrant/Code/sm/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 776

Probably the bindings hasn't happened yet, Is there a solution for this?

I want to set up the scheduling based on my config values.

19 May
4 years ago

mtvs_dev left a reply on [PDOException] Access Denied For User 'forge'@'localhost'

@bobbyborisov thanks at least i know where it comes from but as i said i've created the .env file, I`l double check that

mtvs_dev left a reply on [PDOException] Access Denied For User 'forge'@'localhost'

@bestmomo I've set them, no, I`m on homestead

mtvs_dev started a new conversation [PDOException] Access Denied For User 'forge'@'localhost'

When I try to migrate the database tables, I get the following error:

[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'forge'@'localhost' (using pa ssword: NO)

I created the .env file and just change the DB_DATABASE and the APP_KEY, I don`t know where the heck forge comes from?

13 May
4 years ago

mtvs_dev left a reply on Where Do You Set The Public Directory In Laravel 5?

You shouldn't call \App::bind(...) inside index.php because in this way it wouldn`t be executed when you run the application from the command line or in the case of the queue jobs.

31 Mar
4 years ago

mtvs_dev left a reply on Adding A Subquery To An Eloquent Query

@JarekTkaczyk Tnx but eager loading participantsCount results to a collection of the participants plus their count.

I read your blog post and noticed that for counting has many relations you used hasOne to avoid a collection but i don't think the same is possible with the hasManyThrough.

So I used the other method that you have described in your blog post and joined the tables and at the end using selectRaw() added the all items fields and the count of their unapproved participants.

Thank you for your useful post.

here is the final code:

Item::leftJoin('places', 'items.id', '=', 'places.item_id')
    ->leftJoin('participants', 'places.id', '=', 'participants.place_id')
    ->groupBy('items.id')
    ->selectRaw('items.*, COUNT(IF(approved = 0, 1, NULL)) AS unapproved_participants');
30 Mar
4 years ago

mtvs_dev left a reply on Adding A Subquery To An Eloquent Query

@bastiaan89 An item has many places and a place has one participant, Anyway I just want to count the number of the related participants that are not approved for each item so I don`t want to fetch all of the participants fields.

and i want to do one query for all the items not one query for each.

is there a way to do this using relations?

mtvs_dev started a new conversation Adding A Subquery To An Eloquent Query

I want to add a field to the result set of an eloquent query that its value is provided by a subquery.

In other words I want the returned eloquent models have an extra field using that subquery.

SELECT * , (
SELECT COUNT( * )
FROM `items` AS `i`
INNER JOIN `places` ON `places`.`item_id` = `i`.`id`
INNER JOIN `participants` ON `participants`.`place_id` = `places`.`id`
WHERE `items`.`id` = `i`.`id`
AND `participants`.`approved` =1
) AS `unapproved_participants`
FROM `items`

so I have both items fields and the unapproved_participants

06 Mar
4 years ago

mtvs_dev started a new conversation Laravel 5 Session Data Is Not Accessible In The App Boot Process

In Laravel 5, It seems you can't access the session data in a ServiceProvider::boot(), the Session::get() just returns null while the data exists in the session.

In a package ServiceProvider how can I access to the session data?

I think I should hook to an event, is there an event about loading session in laravel 5, if not what event should I use? I want to share a variable in my views.

21 Feb
4 years ago

mtvs_dev left a reply on May I Pass Arguments To The L5 `FormRequest::authorize()`?

@blackbird I think logically, first you need to check if the requested resource is available to be edited by the user then validate the user input.

@hfalucas Thanks, but I think I prefer it in the old way

mtvs_dev started a new conversation May I Pass Arguments To The L5 `FormRequest::authorize()`?

In an update() process I want to

  1. Attempt to grab the resource/record that is requested to be updated,
  2. Check if it is existed
  3. Check if the user owns the resource (authorization)
  4. Validate input ...

So I want to instantiate my FormRequest after the first two step not by method injection, and pass the grabbed resource to its authorize() method.

Can I do this, and if yes how?