mushood

mushood

Back End Web Developer at Esokia Web Agency ltd

Member Since 3 Years Ago

Port Louis

Experience Points
176,590
Total
Experience

3,410 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
1212
Lessons
Completed
Best Reply Awards
85
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 36
176,590 XP
Feb
24
3 months ago
Activity icon

Awarded Best Reply on Laravel Mail Editor (Mailables Editor) - Package

Will definitely check this out! Definitely looks useful from first glance

Feb
06
3 months ago
Activity icon

Awarded Best Reply on Best Practice For Passing Parameter To Create Method

@bwrigley

Then the question is:

How do you know which profile is attached to the telephone in the create method?

Do you go on this profile page and then add the telephone. In this case, I would pass the profile identifier, which I guess is id in your case, in the query string

<a href="{{ route('telephone.create', ['profile' => $profile->id]) }}"> Add phone number</a>

I would retrieve the id from the query BUT not fetch the profile object from database. No need. Then continue as above

Dec
29
4 months ago
Activity icon

Replied to Storage Download Seems To Be Corrupted

No

You'll need to run php artisan storage:link. This will create storage/app/public which is a symlink to public/storage

Dec
28
4 months ago
Activity icon

Replied to Storage Download Seems To Be Corrupted

Yes weird behavior indeed

I would suggest keeping it in storage/app since this is where files are usually stored, but whatever feels more natural for you is what matters most :)

Activity icon

Awarded Best Reply on Storage Download Seems To Be Corrupted

@bigblueboss

When you save the contents, yo have to save the actual file

 Storage::disk('local')->put($sanitized, $request->filename);

Also why are you doing this?

//store into server
  $request->fileName->storeAs('/', $sanitized);

The storage does that

Also you are saving your files in uploads file which is not in public path

Activity icon

Replied to Storage Download Seems To Be Corrupted

@bigblueboss

When you save the contents, yo have to save the actual file

 Storage::disk('local')->put($sanitized, $request->filename);

Also why are you doing this?

//store into server
  $request->fileName->storeAs('/', $sanitized);

The storage does that

Also you are saving your files in uploads file which is not in public path

Activity icon

Replied to How To Dowload File From Laravel Blade

first check the file path

$myfile = public_path('PG/doc/',$file->id,'/',$file->multiple_doc);
dd($myfile);

Then check that the file is actually there or adjust your path accordingly

Activity icon

Replied to Unable To Locate Factory With Name [default] [App\User].

Very weird.

Don't see anything wrong

Maybe try clearing cache

php artisan cache:clear

composer dump-autoload
Activity icon

Replied to Storage Download Seems To Be Corrupted

The issue could be during the storing process?

Is this a large file and you're not moving the whole OR you are changing the extension?

Can you post the storing process and download process code?

Activity icon

Replied to Unable To Locate Factory With Name [default] [App\User].

Could you try this?

Where you are calling the factory

use App\User;

.
.
.
.
factory(User::class)->create();
Activity icon

Replied to How To Display File As Image View

are the files in your public directory?

use public_path() instead of base_path()

Activity icon

Replied to Unable To Locate Factory With Name [default] [App\User].

Can you show the code for the factory?

use App\Models\User;


.
.
.


$factory->define(User::class, function (Faker $faker) {
Activity icon

Replied to How To Dowload File From Laravel Blade

You should direct towards a link and then return the file in response

Check here: https://laravel.com/docs/5.8/responses#file-downloads

Activity icon

Awarded Best Reply on TokenMismatchException For Particular Post Url

From here

@elseif($mode=='edit')
             <input type="hidden" name="_token" value="{{ csrf_token() }}"/>

It means that only the mode is edit that you have the csrf token. When the mode is add, you dont have it.

So at the top itself, i would do this

     @if($mode=='add')
         <form class="form-horizontal" role="form" action="/customattributevalue/add" method="post">
     @elseif($mode=='edit')
        <form class="form-horizontal" role="form" action="/customattributevalue/edit" method="post">
        @endif 

             <input type="hidden" name="_token" value="{{ csrf_token() }}"/>

//form continues
Activity icon

Replied to TokenMismatchException For Particular Post Url

From here

@elseif($mode=='edit')
             <input type="hidden" name="_token" value="{{ csrf_token() }}"/>

It means that only the mode is edit that you have the csrf token. When the mode is add, you dont have it.

So at the top itself, i would do this

     @if($mode=='add')
         <form class="form-horizontal" role="form" action="/customattributevalue/add" method="post">
     @elseif($mode=='edit')
        <form class="form-horizontal" role="form" action="/customattributevalue/edit" method="post">
        @endif 

             <input type="hidden" name="_token" value="{{ csrf_token() }}"/>

//form continues
Dec
27
4 months ago
Activity icon

Replied to TokenMismatchException For Particular Post Url

can you post the code for the form leading to this issue?

Activity icon

Replied to Best Practice For Passing Parameter To Create Method

@bwrigley

Then the question is:

How do you know which profile is attached to the telephone in the create method?

Do you go on this profile page and then add the telephone. In this case, I would pass the profile identifier, which I guess is id in your case, in the query string

<a href="{{ route('telephone.create', ['profile' => $profile->id]) }}"> Add phone number</a>

I would retrieve the id from the query BUT not fetch the profile object from database. No need. Then continue as above

Activity icon

Awarded Best Reply on Livewire Performance Issue

It comes down to the size of js files you are sending.

More framework, bigger size, less performance

What you can do is seperate the files and reference them in the pages where they are used only

Leverage extraction: https://laravel.com/docs/6.x/mix#vendor-extraction

Activity icon

Replied to Cache Table Deadlock

If in this route, you call a cached query or the like, it can cause this issue. Switch to redis for caching maybe?

Activity icon

Replied to Livewire Performance Issue

It comes down to the size of js files you are sending.

More framework, bigger size, less performance

What you can do is seperate the files and reference them in the pages where they are used only

Leverage extraction: https://laravel.com/docs/6.x/mix#vendor-extraction

Activity icon

Replied to Best Practice For Passing Parameter To Create Method

Best practice .... dont really know if this is

But I what I would do is pass the variable to my view in the create method.

Then set a hidden field with the field value set to the profile id

Then when the post is submitted, I retrieve the id the the post data.

Dec
22
5 months ago
Activity icon

Replied to Get Session Start Time And User Inactivity Period

@bobbyaxe61 Post your answer.

Someone else might have this issue and will find this when googling ;)

Mark it as solved as well

Activity icon

Awarded Best Reply on Count(): Parameter Must Be An Array Or An Object That Implements Countable

YOu need to actually get the results

$arr['accounts'] = Account::where('th_emp_id', auth()->user()->id)->where('th_pay_status', 0)->orderBy('th_tran_no','desc')->get();

Now you just have eloquent query

Activity icon

Replied to Get Session Start Time And User Inactivity Period

What does user inactivity mean for your project? Page open but not doing anything or did not do any valuable action on the site?

Also why use database to store your sessions? Any specific blocking issue?

Activity icon

Replied to Laracasts - Thoughts? Opinions? Roadmap To Proper Use?

Specifically to this comment.

What i did, I went through the free vids. Then I bought a one -year subscription. Then I bought a lifetime account.

Test it out. See if its for you. For me, it totally made sense. Good luck on your journey.

Activity icon

Replied to Polymorphic Relationship With Pivot Data

dynamic data structure in SQL. Why not consider mongoDB?

Activity icon

Replied to Get Session Start Time And User Inactivity Period

If we are talking pure php, I dont think this can be done.

You can set a time in the session and then on the next request, get this time and calculate the difference between the two requests

Try this: https://laracasts.com/discuss/channels/laravel/laravel-using-sessions-storing-session-to-database

Save the session in your database and then query to see when it was set

Activity icon

Replied to Count(): Parameter Must Be An Array Or An Object That Implements Countable

YOu need to actually get the results

$arr['accounts'] = Account::where('th_emp_id', auth()->user()->id)->where('th_pay_status', 0)->orderBy('th_tran_no','desc')->get();

Now you just have eloquent query

Activity icon

Replied to DropDown Menu

2 things to reconsider:

use foreach instead of for

you need to use $user instead of users inside the loop

@foreach($users as $user)

{{$user->user_role}}

@endfor
Dec
07
5 months ago
Activity icon

Replied to Blade, Partials, Javascript, Structure!

There is no laravel specific way to solve this from what I know.

You can seperate the new row section into a blade and fetch that html in ajax (option 2).

You might want to look into pjax: https://www.pixelstech.net/article/1366737736-What-is-pjax-and-why-we-should-use-it

Activity icon

Replied to Tentando Obter Propriedade De Não-objeto Laravel

Por favor, mostre algum código

Nov
30
5 months ago
Activity icon

Replied to DisplayUsing() Not Working With Integers

Don't know Nova specifically BUT you might want to implement the following method in the Gearratio

public function __toString()
Activity icon

Replied to Product Page Link Refreshes To Category Page

I do, but i am currently fully booked.

Try upwork.com ;)

Activity icon

Replied to Laravel To Production!

Hello

I am just curious to why there is 2 parameters, the only reason I can see is that the DB HOST is grabbing my data from env and if the env is empty it is using p2 as a back up. Please clarify.

Yes, that is correct. If check if in your env, this key is set. Else, it uses the default which is the second parameter

In production, if you organised your app correctly, you should only have to change the .env. Otherwise, files in your /config as well might be worth validating, to override like defaults as seen.

For migrations, you can either upload an sql file to the phpmyadmin section OR enable ssh access to your server. You will then have access to a cPanel. If you are just starting, use the phpmyadmin option. However, do note you can only do this the first time. If you db structure changes in the future, you'll have to drop and reimport the database / run sql commands directly to affect the recreate the changes in db

Activity icon

Replied to Product Page Link Refreshes To Category Page

Then maybe have something like this

//only one route
Route::get('/used-equipment/{categoryOrProduct}.php', '[email protected]')->name('usedproducts.differentiate');

In the controller, then decide if it is a category or product. Check if in db or from a list

Activity icon

Awarded Best Reply on Product Page Link Refreshes To Category Page

The issue is with your routes

Try this

/** Category List - Works **/
Route::get('/used-equipment/category/{category}.php', '[email protected]')->name('usedproducts.show');
/** Single Product - Just refreshes category page **/
Route::get('/used-equipment/product/{product}.php', '[email protected]')->name('usedequipment.show');

The issue is that your router cannot differentiate between these two routes and just uses the first one it matches with:

/used-equipment/abcdef

Also why are you using php files directly? You don't need to add .php at the end. You have a router in laravel which is far cleaner

Activity icon

Replied to Product Page Link Refreshes To Category Page

How do you differentiate between a category-name Or a product-name?

What happens when a category has the same name as a product?

Activity icon

Replied to Product Page Link Refreshes To Category Page

Did you try the code above @webbieworks

Activity icon

Replied to Localize Model If Requested From A Web Route

in your app/Http/Kernel.php

    protected $middlewareGroups = [
        'web' => [
            \App\Http\Middleware\EncryptCookies::class,
            \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
            \Illuminate\Session\Middleware\StartSession::class,
            // \Illuminate\Session\Middleware\AuthenticateSession::class,
            \Illuminate\View\Middleware\ShareErrorsFromSession::class,
            \App\Http\Middleware\VerifyCsrfToken::class,
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],

        'api' => [
            'throttle:60,1',
            'bindings',
        ],
    ];

apply your middleware in the "web" key

Activity icon

Replied to Product Page Link Refreshes To Category Page

The issue is with your routes

Try this

/** Category List - Works **/
Route::get('/used-equipment/category/{category}.php', '[email protected]')->name('usedproducts.show');
/** Single Product - Just refreshes category page **/
Route::get('/used-equipment/product/{product}.php', '[email protected]')->name('usedequipment.show');

The issue is that your router cannot differentiate between these two routes and just uses the first one it matches with:

/used-equipment/abcdef

Also why are you using php files directly? You don't need to add .php at the end. You have a router in laravel which is far cleaner

Activity icon

Replied to Online Hotel Booking Project - Need Some Logic Building Tips To Prevent Code Duplication

Have a base controller

class BaseController {
protected $ppt = null;
public function __construct(Request $request)
{
if ($isset(request->pID)
    $this->ppt = PropertyMaster::findOrFail($request->pID);

//use request or session
}
}


class SubController {


public function __construct {
parent::__construct();
}

// use $this->ppt since it is inherited from base controller 
}
Activity icon

Replied to Be Awesome In PHPStorm

@gliga24 A lot of things will be like that in your programming career. Better get used to it. Different environments will have their own specifications.

For this series, you should treat it as a demo of the different functionalities and then find the right shortcut. Go to settings -->keymap, and you should be able to see the various options

You also have the option to set the default to sublime and sublime (mac os) in the dropdown, if you want to closely match the video.

Also I would suggest not learning the shortcuts by heart at one go. Program and as you go along, know that a functionality exist and pick them up one by one. Some of them, you'd not even use.

Nov
29
5 months ago
Activity icon

Awarded Best Reply on Check Relations In Tables With Soft Delete

Check this link: https://stackoverflow.com/questions/32163509/how-to-soft-delete-related-records-when-soft-deleting-a-parent-record-in-laravel

You have a solution plus a package as well

You can also check https://laravel.com/docs/5.7/eloquent#events You can listen to the deleted events and perform checks here.

Hope this helps

Activity icon

Started a new Conversation Laravel Certification

Hey guys

Has anyone heard of any discount on the laravel certification for black friday / cyber monday

Best i've seen is this post: https://liamhammett.com/black-friday-cyber-monday-2019-deals-for-php-laravel-developers-KvrGA8oM?source=post_page-----2d25d10aee7----------------------

Activity icon

Replied to How To Count In Laravel

@foreach (Auth::user()->Notifications as $key => $notification)                                 
        {{$key+1}}. {{ $notification->data['message'] }}
    @endforeach 

foreach gives you the key for the array. If indexed, you can use this as a counter when looping