JhumanJ

JhumanJ

Computer science student at University College London

Member Since 3 Years Ago

Paris - London

Experience Points
2,740
Total
Experience

2,260 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
8
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.

Level 1
2,740 XP
Oct
13
2 days ago
Activity icon

Replied to Terrible Vue Performances

Thats interesting I never thought of that. Ill definitely look into the server side issue. Ill leave it as not resolved for the moment to get some more feedback, but Thanks !

Activity icon

Started a new conversation Terrible Vue Performances

Hello, here is my website: https://www.passetonbillet.fr/. The loading time is huge, and I'm really not sure what to do to improve it. I know about quite a lot of front-end improvements, such as image compression, lazy-loading of images and components... and others. I tried them, and either implemented them or couldn't do it simply. I know there is room for improvements in many aspects, but I'm really interested in reducing the loading time of vue on my pages. Any ideas?

Edit : Here is my lighthouse report: https://lighthouse-dot-webdotdevsite.appspot.com/lh/html?url=https://www.passetonbillet.fr/. Again, I know about these improvements, but right now I'm particularly interested in improving the vue loading time.

Sep
14
1 month ago
Activity icon

Replied to Refactoring My Store() Method

Also depends on the content of request but you could use Post::create($request->all()), or even Post::create($request->only(['title','description','prize','location','image']))

Aug
25
1 month ago
Activity icon

Replied to What Is The Laravel Way To Keep On Maximum Of 5 Records On DB

I have never heard of something similar before. What you could simply do is to check after each ip inserts if there are too many addresses and if so delete them.

Model::orderBy('created_at','desc')->skip(5)->destroy() or similar might work.

May
15
5 months ago
Activity icon

Replied to Phone Format

Please provide your migration file for the user table, and explain more in depth what you're trying to achieve

Activity icon

Replied to No Message Error

Hey could please provide the url of the generated route (i.e output of route('adaugajob') )?

Activity icon

Replied to Between Datetime

You could have some messages after the start of week but not before the end of the week (i.e. in the after this week).

Anyway can you try this?

Message::where('moderator_id', '1')->whereBetween('created_at', [$startOfWeek, $endOfWeek])-> count();
Activity icon

Replied to Between Datetime

I guess you made sure you had some messages for this week in the db?

May
10
5 months ago
Activity icon

Replied to Passport - Access Token To Json Response With Refresh Token

Hey any news on this guys? Trying to generate a refresh token following a call to $user->createToken('My API');...

Mar
24
6 months ago
Activity icon

Replied to How To Distinguish Passport Response Between Wrong Credential And Expired Token?

Hello, having some problem here. Anyone have an idea?

Aug
27
1 year ago
Activity icon

Replied to How To Use Faker With A Custom List Of Words And Make Them Unique?

You don't need faker for that:

'name' => array_random(['User', 'Company', 'Operator', 'Admin'])
Aug
26
1 year ago
Activity icon

Replied to How Fix This Error?

Hey, could you please provide the whole code? It seems that your url variable is not an array, and therefore can't use the indexOf method.

Aug
04
1 year ago
Activity icon

Replied to Namespace Issue

@lostdreamer_nl Thank you for your answer!

I'm not sure about the syntax error, I can use the class without having any troubles. I also tried to clear the cache, but it does not solve the issue...

Activity icon

Replied to Namespace Issue

@tykus thanks for your answer! I already have a facade for the Eurostar, but I want to access on its constant. Somehow I can use the facade, but not the aliased class Eurostar...

Activity icon

Started a new conversation Namespace Issue

Hey,

I just have a small namespace issue I can't explain.

I have this Eurostar class in app/Trains:

<?php

namespace App\Trains;

class Eurostar
{
 ...
}

And a EurostarTest class test associated in tests/app/Trains/Eurostar:

<?php

namespace Tests\App\Trains;

use App\Station;
use App\Ticket;
use App\Train;
use App\Trains\Eurostar as EurostarClass;
use App\Facades\Eurostar;
use Tests\TestCase;

class EurostarTest extends TestCase
{

 ....
    echo (EurostarClass::SOME_CONST);
...

}

But the following gives me the following error: Error : Class 'App\Trains\Eurostar' not found

Any clue what's going on? Thanks

Julien

Feb
09
1 year ago
Activity icon

Replied to Overwrite Default Notifications

Here is what I did:

<?php

namespace App\Notifications;

use App\Mail\MailResetPassword;
use Illuminate\Auth\Notifications\ResetPassword;

class ResetPasswordNotification extends ResetPassword
{
    public function toMail($notifiable)
    {
        return new MailResetPassword( $notifiable, $this->token );
    }
}

Activity icon

Replied to Overriding Resource Constructor

It seems that it shouldn't be done this way. I'll simply create different resource collections.

Activity icon

Started a new conversation Overriding Resource Constructor

Hey There!

I am using Laravel's resource to serialize my models. I would like to have specific options, and therefore overwritten the constructor:

<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\Resource;

class DiscussionResource extends Resource
{

    /**
     * For the message list page we want to include the last message
     */
    public $lastMessageIncluded;

    public function __construct( $resource, $includeLastMessage = false )
    {
        parent::__construct( $resource );
        $this->lastMessageIncluded = $includeLastMessage;
    }

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function toArray( $request )
    {
        return [
            'id'         => $this->id,
            'status'     => $this->status,
            'buyer'      => new UserRessource( $this->buyer ),
            'seller'     => new UserRessource( $this->seller ),
            'ticket'     => new TicketRessource( $this->ticket ),
            'price'      => $this->price,
//            'messages'   => $this->when(!$this->lastMessageIncluded, MessageResource::collection($this->messages)),
            'currency'   => $this->currency,
            'updated_at' => $this->updated_at,
            'last_message'=> $this->when($this->lastMessageIncluded,$this->last_message )
        ];
    }
}

Because of that I can't deal with collections anymore and do stuff like:

DiscussionResource::collection( $offersAwaiting )

I would like to be able to use custom resource with collections like this:

DiscussionResource::collection( $offersAwaiting , true)

Anyone have an idea about this?

Thanks

Jan
20
1 year ago
Activity icon

Replied to PhpUnit Is Deleting My Database!

Could you show us your config/database.php ?

Dec
18
1 year ago
Activity icon

Replied to GET Parameters Testing

Hey! Name your route in your route file:

    Route::get('/agreements/create', '[email protected]')->name('agreement_creation');

And then your line of test can become:

$test = $this->get( route('agreement_creation', ['provider' => $provider, 'type'=>$type]) );

Enjoy your day!

Aug
12
2 years ago
Activity icon

Replied to Vue Form Components Loader

@danmatthews thanks for your reply! You mean using v-cloack for the parent component?

Aug
11
2 years ago
Activity icon

Replied to Asserting Array/json Structure Without Doing Any Request

Just use this:

function isJson($string) {
 json_decode($string);
 return (json_last_error() == JSON_ERROR_NONE);
}

and assert it is true :)

Activity icon

Started a new conversation Vue Form Components Loader

Hi everyone,

I was wondering if there is an easy way to have a full page loader while all of the vue elements are being created. At the moment, my page loads, and then the components show themselves after 1 sec. Is there any simple way for the vue app to detect that all components are finish being created? Because emitting events from each of the components would be pretty long... and not very reusable.

Here is my form when html finishes to load: Html loaded

And here is my form when vue finishes to load my components (here user and ticket type input): Vue loaded

Thanks for your help!

Aug
10
2 years ago
Activity icon

Replied to Npm Run Watch - Utils.isStandardBrowserEnv

So if anyone here has the same problem, here is a dirty fix:

In bootstrap.js, replace window.axios = require('axios'); with window.axios = require('axios/dist/axios.js');

But it shouldn't be a definitive fix. See the Github issue above for more details.

Aug
09
2 years ago
Activity icon

Started a new conversation Npm Run Watch - Utils.isStandardBrowserEnv

Hello everyone!

I'm working on a laravel 5.4 project and as everyone I often use npm run watch. However, I'm not quite sure of what I did to day, but after the first compilation the console shows this error (even though webpack compiles successfully...):

Uncaught TypeError: utils.isStandardBrowserEnv is not a function

So I can't watch for sass changes anymore...

I found an opened issue about this here: https://github.com/JeffreyWay/laravel-mix/issues/1092

Does anyone have a fix here?

Thanks a lot

Aug
04
2 years ago
Activity icon

Replied to Urgent Problem

Can't see your error message..

Aug
03
2 years ago
Activity icon

Replied to Laravel Mass Assignment Cannot Be Null

Go and check your migration file for the model and make sure you add ->nullable() to the field. This will allow the field to hold null values!

Aug
02
2 years ago
Activity icon

Replied to Orderby Problem Sort By Id Not By Name

To be honest i'm not quite sure eheh. Either the prepend was interfering somehow with the `orderBy, or jQuery was reordering the response depending on the value (not the key) so reversing did the trick... If you play around a vit you should be able to find out the reason of this! If you do so let me know what you find! ;)

Activity icon

Replied to Orderby Problem Sort By Id Not By Name

No worries :)

Ok I understand your problem now! The please select you prepend in your controller shouldn't be added here anyway. This has nothing to do with the data itself, so it should be added in the front-end.

Try to replace the success callback of ajax call with this:

 $.ajax({
            url: '/admin/gegonos/ajax/'+nomosID,
            type: "GET",
            dataType: "json",                    
            success:function(data) {   

                $('select[name="city_id"]').empty();
        $('select[name="city_id"]').append('<option value="">Please select</option>');
                $.each(data, function(key, value) {

                    $('select[name="city_id"]').append('<option value="'+ key +'">'+ value +'</option>');
                });                                            
            }                    
        });

Remove the ->prepend('Please select', '') in your controller.

Now if after this you still have the problem replace pluck('name','id') with pluck('id','name') and change your jQuery to reverse key and value!

Activity icon

Replied to Unit Testing Classes That Have Request As Parameter

I would mock this class and make sure it is called with the right request. You should make a façade for this class, it would then be even easier to test:

ClassName::shouldReceive('methodName')->with($request);
Activity icon

Replied to Orderby Problem Sort By Id Not By Name

You should format your message a bit more, it's really hard to understand it as it is...

Activity icon

Replied to How To Pass The Value From Controller To View If Using DB::select?

My bad, if you're question is about the query. Then instead of putting all your logic in the query, let the query builder do the work.

Check here: https://laravel.com/docs/5.4/queries

You have a function sum, and the possibility of joining tables.

Ex:

DB::table('users')
        ->join('orders', function ($join) {
            $join->on('users.id', '=', 'orders.user_id')->orOn(...);
        })
        ->sum('orders.price');
Activity icon

Replied to How To Pass The Value From Controller To View If Using DB::select?

It doesn't matter where your value comes from, or what it is. Just pass it to the view as a parameter!

You could do:

return view( 'yourViewName' )
            ->with( 'value', $value );
Jul
25
2 years ago
Activity icon

Replied to Route File

You can have a group using several middlewares by passing an array of middlewares to the group :

Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth.user', 'auth.admin']], function() {});

You can make as many groups as you want.

Feb
09
2 years ago
Activity icon

Replied to Add Chatter Accesslevel On Category

Alright so that's perfect! Look for the controllers in the package, find the one responsible for loading discussion and use your middelware to check that user has the right to load this discussion.

You could do condition like, if has level access query all discussions, if not query discussions where accesslevel is lower than X.

Am I clear enough?

Feb
08
2 years ago
Activity icon

Replied to Add Chatter Accesslevel On Category

Does your user table have an accesslevel as well? Because you need to have some roles set somehow.

Feb
07
2 years ago
Activity icon

Replied to Creating A Package For An API

Alright, I'm gonna go for the app version (never done any package :) )! Thanks for your help!

Activity icon

Replied to Creating A Package For An API

Thanks for your reply @zachleigh! That's what I was pretty much thinking but I have some doubt regarding where I should save this class?

Activity icon

Started a new conversation Creating A Package For An API

Hello!

I found this train API online that I want to use in my Laravel project. I was wondering what is the best way to integrate it? Doing some curl call straight in my controllers definitely does not seem to be a great idea. I'm never done such a thing before, should I create a package? If yes any good ressource about that?

Thank you!

Nov
30
2 years ago
Activity icon

Replied to Wamp / Laravel 5.3 / Postgres Pdo Exception Could Not Find Driver

@kickthemooon Yeah it does! I'm a bit confused, what did you do exactly?

Activity icon

Replied to Wamp / Laravel 5.3 / Postgres Pdo Exception Could Not Find Driver

I have the exact same probem with Mamp...

Sep
18
3 years ago
Activity icon

Replied to Artisan Error

I wonder if the problem wasn't coming from the package... I ended up downloading the chatter packaging instead, and I had 0 problems installing it. Thanks, anyway.

Activity icon

Started a new conversation Artisan Error

Hello everybody,

I'm currently trying to add the forum package (made by teamteatime) to my laravel app. However, when I want to conclude the install by doing the following:

php artisan vendor:publish

I have the following error message:

[Symfony\Component\Debug\Exception\FatalErrorException]  
  parse error, expecting `','' or `';''                                                          

I installed Intervention to handle images just before that, and I didn't get any issues of that kind... So is there truly a missing semicolon? And if yes how could i possibly find it?

Thanks for your answers!

Sep
06
3 years ago
Activity icon

Replied to View Depending On Middleware

Yep it perfectly does the work thanks!

Activity icon

Replied to View Depending On Middleware

Hey @primordial

In my first message I reversed the order of auth routes and guest routes (compared to my code), but yeah, it always return the 'home' (and so to the login page if not logged).

So isn't there a way to have both page, dashboard and home page use the same url/route?

Activity icon

Replied to View Depending On Middleware

Hello @RomainLanz and thanks for your quick reply!

Ok, so basically when I do that with my routes, it's like if the auth middleware "takes" over the guest one. I configured the auth middleware to redirect to the login page, if somebody tries to access to any logged functionality/pages. And because of that, when guests tries to access the home page (not logged), it automatically redirects to the login page...

I don't know if I'm really clear do you understand?

Activity icon

Started a new conversation View Depending On Middleware

Hello everybody, my name is Julien, and i'm new to Laracasts.

I want the view returned on my home page (route '/') to depend on the middleware.

Route::group(['middleware' => 'auth'], function () {

    Route::get('/', function () {
        return view('home');
    });

   ....

});

Route::group(['middleware' => 'guest'], function () {

    Route::get('/', function () {
        return view('welcome');
    });
    
.....
}); 

I tried this but it doesn't work... I also tried to use the Authcontroller to handle this, but it doesn't work either... Do you have any ideas? Thanks

Julien