shamsul_huda

shamsul_huda

Member Since 10 Months Ago

Dhaka

Experience Points 11,050
Experience Level 3

3,950 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 104
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.

24 Jan
7 months ago

shamsul_huda started a new conversation Creating Default Object From Empty Value

Here is the controller I get into problem

 public function best_answer($id)
    {
        $reply = Reply::find($id);

        $reply->best_answer = 1;

        $reply->save();

        Session::flash('success', 'Marked as best answer');

        return redirect()->back();
    }

Here is the Table field where I make it default 0 which should be replaced with 1.

$table->boolean('best_answer')->default(0);

I also add this functionality to my DiscussionController


public function show($slug)
    {
        $discussion = Discussion::where('slug', $slug)->first();

       // dd($discussion);

        $best_answer = $discussion->replies()->where('best_answer', 1)->first();
        
        
        return view('discussions.show')
                        ->with('d', $discussion)
                        ->with('best_answer', $best_answer);
        
    }

shamsul_huda left a reply on In Bootstrap 4, Select Option Field Doesn't Support Required="true" For Simple Validation

And finally, I solve this problem...

you have to keep first option value blank.

<span class="channel">
           <select class="selectpicker" name="channel_id" data-style="btn btn-link" id="exampleFormControlSelect1" required="true">
                 <option value="">Channel</option>

               @foreach($channels as $channel)
                  <option value="{{ $channel->id }}">{{ $channel->title }}   
                 </option>
               @endforeach

            </select>
  </span>

shamsul_huda started a new conversation In Bootstrap 4, Select Option Field Doesn't Support Required="true" For Simple Validation

<span class="channel">
           <select class="selectpicker" name="channel_id" data-style="btn btn-link" id="exampleFormControlSelect1" required="true">
                 <option>Channel</option>

               @foreach($channels as $channel)
                  <option value="{{ $channel->id }}">{{ $channel->title }}   
                 </option>
               @endforeach

            </select>
  </span>
23 Jan
7 months ago

shamsul_huda left a reply on Invalid Argument Supplied For Foreach()

I got this! it was a function name, typing mistake (watcher() to watchers())

shamsul_huda started a new conversation Invalid Argument Supplied For Foreach()

I can't get this error...

public function is_being_watched_by_auth_user()
    {
        $id = Auth::id();

        $watchers_ids = array();

        foreach($this->watchers as $w):
            array_push($watchers_ids, $w->user_id);
        endforeach;

        if(in_array($id, $watchers_ids))
        {
            return true;
        }
        else {
            return false;
        }
    }
19 Jan
7 months ago

shamsul_huda started a new conversation Problems To Install Laravel Socialite (I'm Using Laravel 5.6)

When I'm trying to install Laravel Socialite package I get this problem-

C:\xampp\htdocs\forum>composer require laravel/socialite
Using version ^4.0 for laravel/socialite
./composer.json has been updated
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
    - Conclusion: remove laravel/framework v5.6.39
    - Conclusion: don't install laravel/framework v5.6.39
    - laravel/socialite 4.0.x-dev requires illuminate/http ~5.7 -> satisfiable by illuminate/http[5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - laravel/socialite v4.0.0 requires illuminate/http ~5.7 -> satisfiable by illuminate/http[5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - laravel/socialite v4.0.1 requires illuminate/http ~5.7 -> satisfiable by illuminate/http[5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9].
    - don't install illuminate/http 5.7.17|don't install laravel/framework v5.6.39
    - don't install illuminate/http 5.7.18|don't install laravel/framework v5.6.39
    - don't install illuminate/http 5.7.19|don't install laravel/framework v5.6.39
    - don't install illuminate/http 5.7.x-dev|don't install laravel/framework v5.6.39
    - don't install illuminate/http 5.8.x-dev|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.0|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.1|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.10|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.11|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.15|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.2|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.20|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.21|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.3|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.4|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.5|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.6|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.7|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.8|don't install laravel/framework v5.6.39
    - don't install illuminate/http v5.7.9|don't install laravel/framework v5.6.39
    - Installation request for laravel/framework (locked at v5.6.39, required as 5.6.*) -> satisfiable by laravel/framework[v5.6.39].
    - Installation request for laravel/socialite ^4.0 -> satisfiable by laravel/socialite[4.0.x-dev, v4.0.0, v4.0.1].


Installation failed, reverting ./composer.json to its original content.

Please help me :(

12 Dec
9 months ago

shamsul_huda started a new conversation When I'm Trying To Update Image It's Works Properly But Old Image Doesn't Delete.

Here is my code:

$post = Post::find($id);
        $filename  = public_path('uploads/posts/').$post->featured;

        if ($request->hasFile('featured'))
        {
            
            $featured = $request->featured;

            $featured_new_name = time() . $featured->getClientOriginalName();

            $featured->move('uploads/posts', $featured_new_name);

            // $oldFileName = $post->featured;
            // give new name of featurerd_new_name

            $post->featured = 'uploads/posts/'.$featured_new_name;

            // delete old one
            File::delete($filename);
        }
07 Dec
9 months ago

shamsul_huda left a reply on Sweet Alert And Toast For Laravel

Hi, @realrashid

I tried to use your sweet-alert following your instruction but get an error, it shows up- Call to undefined method RealRashid\SweetAlert\Toaster::ready() in view

05 Dec
9 months ago

shamsul_huda started a new conversation FatalThrowableError (E_ERROR) Call To A Member Function Replies() On Null

When I'm trying to update post it's updated successfully but, when it returns it shows error here-

NB: Replies under this post where I'm trying to update.

public function show($slug)
{
    $discussion = Discussion::where('slug', $slug)->first();

    $best_answer = $discussion->replies()->where('best_answer', 1)->first();

    return view('discussions.show')
                    ->with('d', $discussion)
                    ->with('best_answer', $best_answer);
}

dd($discussion) After $discussion = Discussion::where('slug', $slug)->first(); I get NULL value.

19 Nov
9 months ago

shamsul_huda started a new conversation How Can I Update Or Overwrite And Delete Posts 'featured-image' From Uploads Folder?

Here is update code:

public function update(Request $request, $id) {

    $this->validate($request, [

        'title' => 'required',
        'category_id' => 'required',
        'content' => 'required'

    ]);

    $post = Post::find($id);

    if ($request->hasFile('featured'))
    {
        
        $featured = $request->featured;

        $featured_new_name = time() . $featured->getClientOriginalName();

        $featured->move('uploads/posts', $featured_new_name);
        // give new name of featurerd_new_name

        $post->featured = 'uploads/posts/'.$featured_new_name;
    }

    $post->title = $request->title;
    $post->content = $request->content;
    $post->category_id = $request->category_id;
    
    $post->save();

    $post->tags()->sync($request->tags);

    Session::flash('success', 'Your posts successfully updated.');

    return redirect()->route('posts');

}

Here is Delete code:

public function kill($id) { $post = Post::withTrashed()->where('id', $id)->first();

    $post->forceDelete();

    Session::flash('success', 'Post deleted permanently.');

    return redirect()->back();
}
05 Nov
10 months ago

shamsul_huda started a new conversation Trying To Get Property Of Non-object (View: C:\laragon\www\blog\resources\views\admin\users\index.blade.php)

Problem: when I'm going to create a new user I get this type of error. And error mark over the image link. If I change image route like$user->profile['avatar']) it works, but in view page, it doesn't display the image.

https://imgur.com/h3Ihz3R

View page: https://imgur.com/XllJfWt

Control function: https://imgur.com/Rc5yjf8

04 Nov
10 months ago

shamsul_huda started a new conversation ErrorException (E_NOTICE) Undefined Variable: User

public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required',
            'email' => 'required|email',
            'password' =>bcrypt('password')
        ]);
 
        $profile = Profile::create([
            'user_id' => $user->id
        ]);
 
        Session::flash('success', 'User created successfully!');
 
        return redirect()->route('users');
    }
02 Nov
10 months ago

shamsul_huda started a new conversation Laravel-5.6 Error: BadMethodCallException Method Illuminate\Database\Query\Builder::tag Does Not Exist.

//When i trying Update tags it Shows this error. How can i fix this? //Error code:

public function __call($method, $parameters)
   {
       if (static::hasMacro($method)) {
           return $this->macroCall($method, $parameters);
       }

       if (Str::startsWith($method, 'where')) {
           return $this->dynamicWhere($method, $parameters);
       }

       throw new BadMethodCallException(sprintf(
           'Method %s::%s does not exist.', static::class, $method
       ));
   }

//Edit code from Controller:

public function edit($id)
    {
        $post = Post::find($id);

        return view('admin.posts.edit')->with('post', $post)
                                       ->with('categories', Category::all())
                                       ->with('tags', Tag::all());
    }

//Update code from Controller:

public function update(Request $request, $id)
    {
        
        $this->validate($request, [

            'title' => 'required',
            'category_id' => 'required',
            'content' => 'required'

        ]);

        $post = Post::find($id);

        if ($request->hasFile('featured'))
        {
            
            $featured = $request->featured;

            $featured_new_name = time() . $featured->getClientOriginalName();

            $featured->move('uploads/posts', $featured_new_name);
            // give new name of featurerd_new_name

            $post->featured = 'uploads/posts/'.$featured_new_name;
        }

        $post->title = $request->title;
        $post->content = $request->content;
        $post->category_id = $request->category_id;

        $post->save();

        $post->tag()->sync($request->tags);

        Session::flash('success', 'Your posts successfully updated.');

        return redirect()->route('posts');

    }
01 Nov
10 months ago

shamsul_huda started a new conversation Laravel-5.6 Error: Creating Default Object From Empty Value

when I'm trying to update value, it shows this error. How can i solve this problem? Here is the simple code....

 public function update(Request $request, $id)
    {
        $this->validate($request, [
            'tag' => 'required'
        ]);
 
        $tag = Tag::find($id);
 
        $tag->tag = $request->tag;
 
        $tag->save();
 
        Session::flash('success', 'Tag Updated Successfully.');
 
        return redirect()->route('tags');
    }