shamsul_huda

shamsul_huda

Member Since 5 Months Ago

Dhaka

Experience Points 750
Experience Level 1

4,250 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 1
Lessons
Completed
Best Reply Awards 0
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.

24 Jan
2 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
3 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
3 months ago

shamsul_huda started a new conversation Problems To Install Laravel Socialite

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
4 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
4 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
4 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
5 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
5 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)

Code Is Here: Error indicates the red mark over image file link :(

Image Name Permissions Delete @if($users->count()> 0) @foreach($users as $user) {{ $user->name }}
      @if($user->admin)

      <a href="{{route('user.not.admin',['id' => $user->id])}}" class="btn btn-sm btn-outline-danger">Remove permission</a>

      @else

      <a href="{{route('user.admin',['id' => $user->id])}}" class="btn btn-sm btn-outline-primary">Make admin</a>

      @endif

    </td>
    <td>
      delete
    </td>
  </tr>
@endforeach
@else
    <tr>
       <th colspan="5" class="text-center">No users available!</th>
    </tr>
@endif
04 Nov
5 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
5 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
5 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');
}