hadis

hadis

Member Since 1 Year Ago

Experience Points
3,310
Total
Experience

1,690 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
0
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
3,310 XP
Sep
08
1 month ago
Activity icon

Replied to Done In Todo List

completed is not tag!! it's function

Activity icon

Started a new Conversation Done In Todo List

I want to create a done function,this run when user click on checkbox this is what I did

function completed(id) {
    tasks.filter(t =>t.id , done=true)
    render()
}
function render() {

    document.getElementById("todos").innerHTML = ''

    tasks.map(t => {

        const htm = `<li>
            <div class="form-check">
                <label class="form-check-label" name="LA">
                    <input class="checkbox" onClick="completed('${t.id}')" type="checkbox" ${t.done ? 'checked="true"' : ''} id="checkbox">
                        <p class="todo" id="todo" ${t.done ? 'style="text-decoration:line-through"' : ''} >${t.text}</p>
                            <i class="input-helper"></i>
                </label>
            <button type="button" id="${t.id}" class="remove" onclick="removeItem('${t.id}')">remove</button></div></li>`;

        document.getElementById("todos").innerHTML += htm

    });

}

I don't know what should I do to create a line-through on text and check the chekbox?

Sep
07
1 month ago
Activity icon

Replied to Remove Item From An Array

I have chenged the code to :

function removeItem() {
    debugger
    let dele = document.getElementsByClassName("remove")
    for(let i=0; i<dele.length; i++){
        let item = tasks[i]
        item.remove()
    } 
}

and now it returns: NewToDo.js:51 Uncaught TypeError: item.remove is not a function

Activity icon

Replied to Remove Item From An Array

it returns text as undifined

Activity icon

Replied to Remove Item From An Array

It has that error again

Activity icon

Started a new Conversation Remove Item From An Array

I want to delete an item from my todo list and this is my code:

function removeItem(id) {

   let text = tasks[i]
  let dele = document.getElementsByClassName("remove")
  for(let i=0; i<dele.length; i++){
  	text.addEventListener("click", deleteListElement);
  }
  function deleteListElement(){
    this.parentElement.remove(); 
  }
  
}

but it has an error:'NewToDo.js:51 Uncaught TypeError: Cannot read property 'addEventListener' of undefined' what's the problem?

Sep
06
1 month ago
Activity icon

Started a new Conversation To Do List With Array

I want to use arrary to creating a todo list for removing and complete functions confused! this is my code:

let tasks = []

function remove(id) {
    debugger;
    let item = document.getElementById(id)
    item.remove()
}

here when I click on remove button just the button remove not li what is the problem? and can u suggest me a solution for showing complete? I have code but not working!

 htm.addEventListener('click', event=>{
        
        if(event.target.tagName === 'LA'){
            const itemKey = event.target.parentElement.dataset.key;
            toggleDone(itemKey);
            return true
        }
    })

htm is(It's in render function):

 const htm = `<li><div class="form-check"><label class="form-check-label" name="LA">
        <input class="checkbox" type="checkbox"><p class="todo">${t.text}</p><i class="input-helper"></i></label>
        <button type="button" id="${t.id}" class="remove" onclick="remove('${t.id}')">remove</button></div></li>`;
        document.getElementById("todos").innerHTML += htm
Sep
05
1 month ago
Activity icon

Replied to Remove Element By Id

now I am using button

<button class="clear" id="clear" onclick="remove(${id})" >clear</button>

and this error: ' todolist.html:1 Uncaught ReferenceError: item is not defined at HTMLButtonElement.onclick '

Activity icon

Replied to Remove Element By Id

ooops yeah but can I use instead?shouldn't use ?

Activity icon

Replied to Remove Element By Id

oh yeah thnk u but nothing happen,when I click clear button it just refresh page!

Activity icon

Replied to Remove Element By Id

it refresh page!!!

Activity icon

Started a new Conversation Remove Element By Id

I want to remove one of items using id this is my code:

function AddToDo() {
      let item = document.getElementById("add").value;

      const id = 'item-' + Math.random().toString().replace('.', '')
      const htm = `<li id='${id}'><div class="form-check"><label class="form-check-label"><input class="checkbox" type="checkbox"><p class="todo">' ${item} '</p><i class="input-helper"></i></label><a class="clear" href="" id="clear" onclick="remove('${id}')" >clear</a><a class="edit" href="" id="edit" >edit</a></div></li>`;

      document.getElementById("todos").innerHTML += htm
}
function remove(id) {
       let dele = document.removeChild(id);
      
}

but it's not working,what is the problem?

Activity icon

Started a new Conversation Clear In Todolist

I want to add clear to my to do list but when I click on clear all data in my page clear(refresh page!!)

this is what I did:

function clear(){  
      document.getElementById("todos").id = " "
      tasks = null
}
<li><div class="form-check"><label class="form-check-label"><input class="checkbox" type="checkbox"><p class="todo">'+ item +'</p><i class="input-helper"></i></label><a class="clear" href="" id="clear" onclick="clear()" >clear</a><a class="edit" href="" id="edit" >edit</a></div></li>
Sep
03
1 month ago
Activity icon

Replied to ToDo List

thnx alot

Sep
02
1 month ago
Activity icon

Replied to ToDo List

but what should I do if I wanna to use this html code for li?

<div class="list-wrapper">
         <ul class="todo-list">
               <li>
                   <div class="form-check">
                       <label class="form-check-label"> 
                           <input class="checkbox" type="checkbox"><p class="todo" id="todos"></p>
                                <i class="input-helper"></i></label><a href="" id="clear" >clear</a>
			</div>
                  </li>
         </ul>
</div>
Activity icon

Replied to ToDo List

oooops yeah,thanks a lot :)

Activity icon

Replied to ToDo List

Actully that code you suggest me print this: <li. tag>task1</li. tag><li. tag>task2</li. tag>

Activity icon

Replied to ToDo List

This is what I want:

  • The first task user enter
  • The second task user enter
  • Activity icon

    Replied to ToDo List

    it print something like this: <>task</> and in one line print all of tasks I want to show them like this:

  • task1
  • task2
  • Activity icon

    Started a new Conversation ToDo List

    I am new to js and I wanna create a simple todo list

    let tasks = null
    function AddToDo(){
        let item = document.getElementById("add").value
      document.getElementById("todos").innerText += item
    

    all of tasks I enter put in one line and end of each other but I wanna put each one in a li tag how can I do this?can anyone help me plzzz??

    Jun
    21
    4 months ago
    Activity icon

    Started a new Conversation Add Diffrent Images To A Page

    I want to add diffrent images to a page,the_post_thumbnail_url() just show feature image but I don't want to dispaly feature image at all! what should I do? Is there another solution?

    Jun
    10
    4 months ago
    Activity icon

    Started a new Conversation Warning: Count(): Parameter Must Be An Array Or An Object That Implements Countable

    when I use the_content method the error apears.this is what I did:

    <div class="b-bottom">
         <p class="sub"><?php the_content(); ?></p>
    </div>
    

    what is the problem?

    May
    21
    5 months ago
    Activity icon

    Started a new Conversation Count(): Parameter Must Be An Array Or An Object

    I want to change a html theme to wordpress theme,when I want to show posts I got this error: "Warning: count(): Parameter must be an array or an object that implements Countable in...." and this is the code:

    <div class="post-info"><span class="post-category"><a href="#"> سبک زندگی</a></span>
      <header class="post-title">
        <h3 class="serif-font"><a href="#"><?php echo get_the_title(); ?></a></h3>
      </header>
      <div class="post-body">
        <p class="serif-font"><?php  the_content()?></p>
      </div>
    
    <?php
                $args = array(
                        'posts_per_page'=> 3,
                        'offset'=> 0,
                        'category' => '',
                        'category_name' => '',
                        'orderby' => 'post_date' ,
                        'order' => 'DESC',
                        'include' => '',
                        'exclude' => '',
                        'meta_key' => '',
                        'meta_value' => '',
                        'post_type' => 'post',
                        'post_mime_type' => '',
                        'post_parent' => '',
                        'post_status' => 'publish',
                        'suppress_filters' => true,
    
                );
                    $my_posts = query_posts($args);
                    foreach ($my_posts as $post){
    
                ?>
    

    when I use the_content() this error apears! what's the problem?

    May
    18
    5 months ago
    Activity icon

    Replied to Undefined Variable

    ooops yeah thnx

    Activity icon

    Started a new Conversation Undefined Variable

    I want to show user orders and this is what I did:

     @foreach($$orderHistory as $order)
                    <div class="with-spacing three-col orders" id="works-grid">
                        <div class="work-item branding ui-ux">
                            <div class="work-detail">
                                <a href="#">
                                    <img src="images/portfolio-1.jpg" alt="">
                                    <div class="work-info">
                                        <div class="centrize">
                                            <div class="v-center">
                                                <h3>{{ $order->product_name }}</h3>
                                                <p> {{ $order->product_price }}</p>
                                            </div>
                                        </div>
                                    </div>
                                </a>
                            </div>
                        </div>
                    </div>
                    @endforeach
    

    and the error is:" Undefined variable: [{"name":"product 1","qty":15,"product_price":150000}] "

    what is the problem?

    May
    17
    5 months ago
    Activity icon

    Replied to SQLSTATE[42S02]: Base Table Or View Not Found

    oooops,yeah that was the problem,thanks a lot

    Activity icon

    Replied to SQLSTATE[42S02]: Base Table Or View Not Found

    no,it's singleproducts

    Activity icon

    Started a new Conversation SQLSTATE[42S02]: Base Table Or View Not Found

    I am using this code:

    $history = DB::table('cart')
                ->where('user_id', auth()->id())
                ->join(' singleproducts', 'singleproducts.id', '=', 'cart.product_id')
                ->select('singleproducts.name', 'cart.quantity', 'cart.price')
                ->get();
    

    and I have singleproducts table but I got this error "SQLSTATE[42S02]: Base table or view not found: 1146 Table '***. singleproducts' doesn't exist (SQL: select singleproducts.name, cart.quantity, cart.price from cart inner join singleproducts on singleproducts.id = cart.product_id where user_id is null)"

    what is the problem?

    May
    16
    5 months ago
    Activity icon

    Replied to Show Users What They Bought

    Cart model?Actully I don't have cart model,this is my cart method:

    public  function  addtocart(Request $request){
            $data = $request->all();
            if (empty($data['user_email'])){
                $data['user_email'] = ' ';
            }
    
            $user_id = Auth::id();
    
            $session_id = Session::get('session_id');
            if (empty($session_id)){
                $session_id = Str::random(40);
                Session::put('session_id' , $session_id);
            }
    
            DB::table('cart')->insert(['product_id' => $data['product_id'] ,  'product_name' => $data['product_name'], 'user_id'=>$user_id,
                'product_price' => $data['product_price'], 'qty' => $data['qty'], 'user_email' => $data['user_email'] , 'session_id' => $session_id ]);
    
            return redirect('cart');
        }
    
    
     public function cart(){
            $user_id = Auth::user()->id;
            $session_id = Session::get('session_id');
            $userCart = DB::table('cart')->where(['session_id'=>$session_id])->get();
            foreach ( $userCart as $key=>$product){
                $productDetail = Singleproduct::where('id' , $product->product_id)->first();
                $userCart[$key]->image = $productDetail->image;
            }
            return view('UI.store.cart' , compact('userCart'));
        }
    
    Activity icon

    Replied to Show Users What They Bought

    For profile just view created and in cart I got user_id but nothing else

    Activity icon

    Started a new Conversation Show Users What They Bought

    I want to create a page that shows users what they bought but I really have no idea how can I do this! can anyone help me in it plz?

    May
    01
    5 months ago
    Activity icon

    Started a new Conversation SQLSTATE[22007]: Invalid Datetime Forma

    I want to add to cart but faced with this error: " SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '[{"id":1}]' for column 'user_id' at row 1 "

    CartController:

    public  function  addtocart(Request $request){
            $data = $request->all();
            if (empty($data['user_email'])){
                $data['user_email'] = ' ';
            }
            $user_id = User::get('id');
            if (empty($user_id)){
                $user_id = Auth::user()->id;
            }
    
            $session_id = Session::get('session_id');
            if (empty($session_id)){
                $session_id = Str::random(40);
                Session::put('session_id' , $session_id);
            }
    
            DB::table('cart')->insert([ 'product_name' => $data['product_name'], 'user_id'=>$user_id,
                'product_price' => $data['product_price'], 'qty' => $data['qty'], 'user_email' => $data['user_email'] , 'session_id' => $session_id ]);
    
            return redirect('cart');
        }
    
    
     public function cart(){
            return $this->hasOne('App\User');
        }
    
     public function cart(){
            return $this->hasOne('App\Cart');
        }
    
     Schema::create('cart', function (Blueprint $table) {
                $table->increments('id');
                $table->integer('user_id');
                $table->string('session_id');
                $table->string('product_name');
                $table->string('user_email');
                $table->integer('qty');
                $table->integer('product_price');
    
                $table->timestamps();
            });
    
    Apr
    30
    5 months ago
    Activity icon

    Started a new Conversation How To Assign Value Of User_id From Users Table In Cart?

    I want to assign id from Users table as user_id for cart and I want to use many to many relationship this is what I did:

     public function user(){
            return $this->belongsTo('App\User');
        }
    
    public function profile(){
            return $this->hasOne('App\Profile');
        }
    

    next I don't know what should I do :) can anyone help me in it?

    Apr
    26
    6 months ago
    Activity icon

    Started a new Conversation User_id In Cart

    I want to show purchased products in user profie but I dont know how to undrestand which product is for which user

    this is add to cart method:

    public  function  addtocart(Request $request){
            $data = $request->all();
         
            $session_id = Session::get('session_id');
            if (empty($session_id)){
                $session_id = Str::random(40);
                Session::put('session_id' , $session_id);
            }
            DB::table('cart')->insert(['product_id' => $data['product_id'], 'product_name' => $data['product_name'],
                'product_price' => $data['product_price'], 'qty' => $data['qty'], 'session_id' => $session_id ]);
    
            return redirect('cart');
        }
    

    and user model:

    protected $fillable = [
             'name','email', 'password', 'admin'
        ];
    

    Can someone give me a solution?