imrulhasan273

imrulhasan273

Member Since 1 Month Ago

Experience Points
1,830
Total
Experience

3,170 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
6
Lessons
Completed
Best Reply Awards
0
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 1
1,830 XP
Sep
20
1 week ago
Activity icon

Started a new Conversation How To Pass The Structured Data To A Function In C++?

#include<bits/stdc++.h>
using namespace std;
/// -- -- - -- -- - -- - - Start Solution (a) --- -- --- - -- --
struct movieStar
{
    char name[100];
    int age;
    char income[100];
    char gender[100];
};
/// -- -- - -- -- - -- - - End Solution (a) --- -- --- - -- --




/// -- -- - -- -- - -- - - Start Solution (c) --- -- --- - -- --		//this is the target function
float highest_earning(struct movieStar s, int n)
{

    int n=1;
    for(int i=0;i<n;i++)
    {
        puts(s[i].name);
        printf("%d\n",s[i].age);
        puts(s[i].income);
        puts(s[i].gender);
    }
    printf("%d",n);
    return n;
}
/// -- -- - -- -- - -- - - End Solution (c) --- -- --- - -- --




int main()
{
    /// -- -- - -- -- - -- - - Start Solution (b) --- -- --- - -- --
    int n;
    printf("Number of Movie Star to Insert: ");
    scanf("%d",&n);

    getchar();
    movieStar s[n];

    int count = 1;
    for(int i=0;i<n;i++)
    {
        printf("\nStart Number-%d \n",count);
        printf("----------------\n");
        printf("Name: ");
        gets(s[i].name);

        printf("Age: ");
        scanf("%d",&s[i].age);

        printf("Annual Income: ");
        getchar();
        gets(s[i].income);

        printf("Gender: ");
        getchar();
        gets(s[i].gender);
        count++;
    }
    /// -- -- - -- -- - -- - - End Solution (b) --- -- --- - -- --


    float annual_income = highest_earning(s[n]);   // here I tried to pass... but error.


    return 0;
}

Here I want to pass the structure datas[n] to highest_earning function s[n] have data of user input.. ... How can I pass the structured data?

Sep
09
2 weeks ago
Activity icon

Replied to How To Query This To Get The Desired Output Table In Raw SQL Query?

thanks a lot bro.... Your helps me a lot to find our the problem.... <3

Activity icon

Replied to How To Query This To Get The Desired Output Table In Raw SQL Query?

Will you give an example from output table? My instructor give it to me solve. But I don't understand the Routing

Activity icon

Started a new Conversation How To Query This To Get The Desired Output Table In Raw SQL Query?

## Table A

| ID  | Name | Parent_ID |
| ---  | ---- | --------- |
| 1   | A    | 0         |
| 2   | B    | 1         |
| 3   | C    | 2         |
| 4   | D    | 0         |
| 5   | E    | 3         |
| 6   | F    | 1         |

## Table B

| ID  | Product_Name | Table_A_ID |
| --- | ------------ | ---------- |
| 1   | X            | 5          |
| 2   | Y            | 4          |
| 3   | Z            | 6          |

## Output

| Routing       | Product_Name | Table_B_ID |
| ------------- | ------------ | ---------- |
| A < B < C < E | X            | 1          |
| D             | Y            | 2          |
| A < F         | Z            | 3          |
Sep
06
3 weeks ago
Activity icon

Started a new Conversation How Can Fix The Registration Issue For Herokuapp In Laravel?

I deployed my Laravel Project in herokuapp. but when I insert a new user then below error comes.

SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bigint: "except" (SQL: select count(*) as aggregate from "users" where "email" = imrulhasan273@gmail.com and "id" <> except)

I am using MySQL in local server. And this herokuapp server uses postgresql.

Here is my database migration for users table.

 Schema::create('users', function (Blueprint $table) {

            $table->id();
            $table->string('name');
            $table->double('credits')->nullable();
            $table->double('lock_credits')->nullable();
            $table->string('user_name')->unique();
            $table->string('email')->unique();
            $table->string('photo')->nullable();
            $table->string('phone')->nullable();

            $table->unsignedBigInteger('club_id')->nullable();
            $table->foreign('club_id')->references('id')->on('clubs')->onDelete('cascade');

            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
Activity icon

Started a new Conversation How Can I Validate The From For Null Value Or Exist In Laravel?

$validate =  Validator::make($data, [
    'name' => ['required', 'string', 'max:255'],
    'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
    'user_name' => ['required', 'unique:users'],
    'sponsor' => ['exists:users,user_name'],   // here need to be changed.
    'password' => ['required', 'string', 'min:8', 'confirmed'],
 ]);

Here user name is unique name of users table. And sponsor is also a user_name of user table.

its validation rules when a new user Register for a new account.

User can type sponsor_name which is a user_name of users table. But it's optional.

case

  • So when user doesn't type any input in sponsor name. Then sponsor_name is null. Then it should validate.

  • If user type an input in sponsor_name then sponsor_name should already exist in users table.

How can I validate the form?

Sep
03
3 weeks ago
Activity icon

Replied to How Can I Validate Existing User_name From User In Laravel?

I didn't input user_name column. that's why I have again this problem? So I need to make validation for user_name also?

Activity icon

Replied to How Can I Validate Existing User_name From User In Laravel?

SQLSTATE[HY000]: General error: 1364 Field 'user_name' doesn't have a default value (SQL: insert into users (name, email, club_id, phone, password, remember_token, updated_at, created_at) values (Imrul Hasan, imrulhasan273@gmail.com, 2, 1775707460,

Activity icon

Started a new Conversation How Can I Validate Existing User_name From User In Laravel?

I Have the below validation for registration a new User.

return Validator::make($data, [
   'name' => ['required', 'string', 'max:255'],
   'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
   'sponsor' => ['required', 'string', 'user_name', 'max:255', 'exists:users,user_name'],  //here is the problem
   'password' => ['required', 'string', 'min:8', 'confirmed'],
 ]);

I have an input field for sponsor. New registration needs a reference_user_name. So a user try to register his account, Software will ask for sponsors user_name who is already an existing user. So I want to check if the input user_name exists or not. user_name is an UNIQUE column of users table

I have tried the above but there occurs below errors.

BadMethodCallException Method Illuminate\Validation\Validator::validateUserName does not exist. http://127.0.0.1:8000/register Hide solutions Bad Method Call Did you mean Illuminate\Validation\Validator::validateSame() ?

for your reference here is the table structure that I have

Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->float('credits')->nullable();
            $table->float('lock_credits')->nullable();
            $table->string('user_name')->unique();
            $table->string('email')->unique();
            $table->string('photo')->nullable();
            $table->string('phone')->nullable();

            $table->unsignedBigInteger('club_id')->nullable();
            $table->foreign('club_id')->references('id')->on('clubs')->onDelete('cascade');

            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
 });
Aug
27
1 month ago
Activity icon

Replied to How Can I Validate An Existing Email In Laravel?

thanks Sir...... I got it now..... <3

Activity icon

Started a new Conversation How Can I Validate An Existing Email In Laravel?

    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => ['required', 'string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'sponsor' => ['required', 'string', 'email', 'max:255', 'NON-UNIQUE:users'],      // here is the line
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);
   }

Here I want to check if the sponsor email is already existing in validator.

If the sponsor email is not exists then the the validator will report an alert to pass an existing email as reference.

So the valitaor will be successfull when input an email which is already exists.

Aug
21
1 month ago
Activity icon

Started a new Conversation How Can I Get The Full Text For A Modal Event Inside JQuery?

<div class="data-show"
     data-toggle="modal"
     data-target="#betting"
     style="" id="select"
     data-ques = {{$question->question}}>
</div>

Here is my code where I set a Modal as target attribute. I also take the value of $question->question in the data-ques attribute. The above pice of code is inside a loop.

<script type="text/javascript">
$('#betting').on('show.bs.modal', function (event) {
  var button = $(event.relatedTarget)
    var question = button.data('ques');
    console.log(question);
})
</script>

Here is my JS code. I tried to get the data of qustion inside the variable question. I get the question. but I can't get the full text.

suppose $question->question = "Some Text". But when I get the data using Javascript variable using var question. The question prints "Some". But It should prints "Some Text".

How can I get the full text?

Activity icon

Started a new Conversation How Can I Get The Value Inside The Modal From When I Click On The Answer?

I am making something like that,

@foreach ($answers as $answer)
@if ($question->id == $answer->question_id)
<div >
   <div class="data-show" data-toggle="modal" data-target="#betting" id="select">
          <div>
              {{$answer->answer}}
              <span id="ansID" class="" text-align="center" style="color:#F9CD51;">
              {{$answer->bet_rate}}
              </span>
          </div>
      </div>
</div>
@endif
@endforeach

ABove is my code when I click in the ans row. It will open the below modal

<div  class="modal fade betForm" id="betting" role="dialog" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
<span id="BettingSubTitleOption">
       {{ here should be the ans }}
 </span>

Above is the modal. the problem How can I pass the ans value in the modals inside <span></span> tag.

As first code is inside loop. So the modal need to get the value dynamically may be.

Activity icon

Replied to How Can I Get The Value Of Tags In JQuery?

thanks Sir. <3 It works like champ.

Activity icon

Started a new Conversation How Can I Get The Value Of Tags In JQuery?

<span  id="testing">
    TEST LINE
</span>

The above<span> section is inside a modal. When I clicked on a button then the modal appears.

<script type="text/javascript">
    $("#betting").on("click", function() {
        console.log('HELLO');
        var game = $("#testing").val();
        console.log(game);

    });
</script>

When i clicked on the Bet button then the "HELLO" prints . but game variable prints an empty string insead of TEST LINE

What is wrong here?

Aug
18
1 month ago
Activity icon

Started a new Conversation How Can I Get The `subject` In A Variable In Laravel Blade File?

http://127.0.0.1:8000/wallet/webmessage?subject

Here is the link when I reply to a message. And here subject is the subject of the message. How can I get the subject in a variable in laravel blade file?

Aug
17
1 month ago
Activity icon

Replied to How Can I Set Time Datatype In Laravel Migration?

here i find $table->time('sunrise', 0). but I didn't understand the parameter of time here.

Activity icon

Replied to How Can I Set Time Datatype In Laravel Migration?

ok... bro... I did not tryied. I didn't find any datatype only in time so I am make sure..... I will now test it. Thank bro.. For your confirmation.

Activity icon

Started a new Conversation How Can I Set Time Datatype In Laravel Migration?

Schema::create('games', function (Blueprint $table) {
	$table->id();
        $table->unsignedBigInteger('type_id');
        $table->foreign('type_id')->references('id')->on('types')->onDelete('cascade');

        //date
        $table->date('date');	//here is date	
        //time
        $table->time('time');	//here is time

        $table->string('name');
        $table->string('tournament_name');
        $table->string('game_update');
        $table->string('status');
        $table->timestamps();
});

Here is my expected migrations... I need a column datatype only for date and a column datatype only for time. May be the date column is correct. But If i want to set a time (ex: 20:20), how the column data types would be?

Aug
09
1 month ago
Activity icon

Started a new Conversation How Can I Make This Rating System In HTML, CSS And PHP?

<div class="p-rating">
 <a data-value="{{$product->id}} 1" class="btn "><i class="fa fa-star-o"></i></a>
 <a data-value="{{$product->id}} 2" class="btn "><i class="fa fa-star-o"></i></a>
 <a data-value="{{$product->id}} 3" class="btn "><i class="fa fa-star-o"></i></a>
 <a data-value="{{$product->id}} 4" class="btn "> <i class="fa fa-star-o"></i></a>
 <a data-value="{{$product->id}} 5" class="btn "> <i class="fa fa-star-o fa-fade"></i></a>
</div>

Here are 5 <a> tags one after another. All tags represent an star. here in this example the last start is blue colored with class name fa-fade. First 4 start in red star.

in this blade file there is a variable contains a value between 1 to 5. Depending on the value of the variable how can I make red star?

Activity icon

Started a new Conversation How Can I Convert `data[1]` To Integer Format In JQuery-Ajax?

 $.ajax({
                type: "get",
                url: "{{ route('ajaxReview.rating') }}",
                data: { id: value },
                success: function(data) {
                    console.log(data);
                    $(".RATINGajax").text(data[0]);
                    $count = $(".COUNTajax").text();
		    $sum = $count[0]+data[1]
                    console.log($sum);


                },
                error: function() {}
            });

Here i got a JSON data inside data from response from a Controller. I got the text value in $count. Here $count = 1 user. So I take the integer from here using $count=$count[0]

I have integer data in data[1] I have integer value in $count[0]

Now I want to sum both of these variable. $sum = $count[0]+data[1].

Currently It shows string concatenate value 1+1=11 instead of 2. I want 2.

It needs integer convertion.

Activity icon

Replied to How Can I Get The Value Of `<a>` Tag From Blade Into `js` File Using JQuery?

thanks Sister.... <3 <3 it works like a charm...

Activity icon

Replied to How Can I Get The Value Of `<a>` Tag From Blade Into `js` File Using JQuery?

Still I get i=6... How can I get the exact value?

Activity icon

Replied to How Can I Get The Value Of `<a>` Tag From Blade Into `js` File Using JQuery?

it get the value of i=6 even i click on first <a> tag. Because after loop complete the value of i get

Activity icon

Started a new Conversation How Can I Get The Value Of `<a>` Tag From Blade Into `js` File Using JQuery?

<div class="p-rating">
<a value ="1" type="button" class="btn RatingAjax1"><i class="fa fa-star-o"></i></a>
<a value="2" type="button" class="btn RatingAjax2"><i class="fa fa-star-o"></i></a>
<a value="3" type="button" class="btn RatingAjax3"><i class="fa fa-star-o"></i></a>
<a value="4" type="button" class="btn RatingAjax4"> <i class="fa fa-star-o"></i></a>
<a value="5" type="button" class="btn RatingAjax5"><i class="fa fa-star-o fa-fade"></i></a></div>

Here is my process i have given different class name for every button. For one start RatingAjax1 upto 5 star

$(document).ready(function() {
    var i;
    for (i = 1; i <= 5; i++) {
        $(".RatingAjax" + i).click(function() {
            alert("clicked");
            alert(i); 
            
        });
    }
});

In this js file I want to get the value of <a> tag depending on click event.

How When I click on first button then it value ofi should be 1. If i clicked on 5th button value of i should be 5.

How to solve this problem?

Aug
08
1 month ago
Activity icon

Replied to Can You Write Dd(); In The View ?

use

{{ dd(var) }}

You may notice that you never use ; after content name..

{{ $user->name }}. NOtice you didn't use ; after name. In this way {{dd($user) }}

Activity icon

Replied to Relationship In DB Does Not Exist

It usually happens when your crm_company_addresses table must have been dropped before migration:reset rolled back

Check the order of execution of your migrations.

As you were trying to reset, to fix it now, open your database, drop all tables manually and execute migrate again.

Aug
07
1 month ago
Activity icon

Started a new Conversation How Can I Make The <a> Tag Like <button> Using CSS?

<a class="add-card cart_item_count"><i class="flaticon-bag"></i><span>ADD TO CART</span></a>

This is my <a> tag. I have some JavaScript work usingcart_item_count class for onclick event. But when I change it to button it works. but When <a> it doesn't clickable.

I want this tag clickable without href because I am using AJAX-Jquery Work without page refresh.

I want when I hovor on the <a> tag it will show finger instead of arrow.

Activity icon

Replied to How Can I Make A Conditional Variable In PHP?

Thanks a lot bro.... Its what I am looking for. <3

Activity icon

Started a new Conversation How Can I Make A Conditional Variable In PHP?

$AJAXproducts = $products;

Here I get the $AJAXproducts = $products; and $products value is an array of data. But sometimes the $products is undefined for some pages. So for those pages I want something like below

$AJAXproducts = $products : [];

I want something that if products is not undefined then $AJAXproducts = $product else $AJAXproducts = [] and empty array

Activity icon

Replied to How Can I Update The Cart In A The Tag Using The `ajax` Data In Laravel?

Thanks Sister... It works like a Charm!!!!..... <3

Activity icon

Started a new Conversation How Can I Update The Cart In A The Tag Using The `ajax` Data In Laravel?

$.ajax({
	type:'get',
        data:{'id':ID},
        url:"{{ route('ajaxcart') }}",
        success:function(data){
        alert(data);

        $('itemCountAjax').val(data);
        $('itemCountAjax').val(data);
        },
        error:function(){
        }
});

Here is my AJax method without page refresh. I have get the respose data from controller to this method. Here data contains the single integer for example 4 or 5 or 6 etc. Now I want to update the cart items without refresh.

_header.blade.php

<span class="itemCountAjax">{{ $itemCount ?? '' }}</span>

here in this <span> tag $itemsCount contains number of items added to cart. After executing ajax method I want the $itemCount to be set to value of data which is from the ajax method.

Activity icon

Replied to How Can I Fix The JQuery-Ajax Request And Response In Laravel?

thanks Bro for your suggestion. I have find out the problem by inspecting network tab. Now I can send and response request. <3

Activity icon

Replied to How Can I Fix The JQuery-Ajax Request And Response In Laravel?

I just check it shows http://127.0.0.1:8000/add?id=10 and Status Code: 200 OK.... and Response shows the ID

Activity icon

Started a new Conversation How Can I Fix The JQuery-Ajax Request And Response In Laravel?

I am trying to pass product ID to the controller through JQuery-Ajax method.

Frontend.blade.php

<script type="text/javascript">
        $(document).ready(function(){
        let x;
        <?php
             $maxP = count($products);
             for($i = 0;$i<$maxP;$i++)
             { ?>
                $('#addCart<?php echo $i; ?>').click(function() {
                    x = pro_id<?php echo $i;?> = $('#pro_id<?php echo $i;?>').val();
                    var ID = x;			//this ID contains the id of a product. 
                    $.ajax({
                        type:'get',
                        url:"{{ route('ajaxcart') }}",
                        data:{'id':ID},					
                        success:function(data){
                            alert('Data:',data); 
                        },
                        error:function(){
                        }
                    });
                });
       <?php } ?>
        });
    </script>

I sent data to the controller. But the data is not sending. when I try to fetch the data it is not collecting.

web.php

Route::get('/cart/add', '[email protected]')->name('ajaxcart')->middleware('auth');

CartController.php

public function ajax(Request $request)
{


    $data = $request->id;
    return response()->json($data);
}

Here I in $request the id is not getting. So sending data is unseccesfull

Again I try the response setting $data=10 . hence this 10 is not even getting in

Probably the php codes is the reason for that. But I need to use php as I have to make a add to cart button for different product.

Aug
05
1 month ago
Activity icon

Replied to Why My Recursion Doesn't Work In Laravel?

I am in a controller. Now the function is working properly as well as I make the logic fulfill. But is my method inefficient? I know It can be done using some relationship in Model. But as I am learning laravel about 4 months so I have some struggling using relationship... so I make the logic in coding way.

Activity icon

Replied to Why My Recursion Doesn't Work In Laravel?

thanks bro... it is working now.... <3

Activity icon

Started a new Conversation Why My Recursion Doesn't Work In Laravel?

        $stack = array();
        $result = array();

        $result = $this->recursion($product->id, $categories, $stack, $result);
    function recursion($prod, $categories, $stack, $result)
    {

        //initially $prod = prod id, $categories = Collection, $stack = [], $result = []
        array_push($result, $prod);

        foreach ($categories as $cat) {
            array_push($stack, $cat->id);
        }

        $pop = array_pop($stack);
        // array_push($result, $pop);

        $cats = Category::where('parent_id', $pop)->get();

        if ($stack != null) {
            return recursion($pop, $cats, $stack, $result);
        } else {
            return $result;
        }
    }

Why my return recursion($pop, $cats, $stack, $result); doesn't work... It says Undefined function 'App\Http\Controllers\recursion'.intelephense(1010)