helpmyworld

helpmyworld

Member Since 1 Year Ago

Experience Points 4,340
Experience Level 1

660 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 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.

20 Mar
4 days ago

helpmyworld left a reply on SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column '0' In 'field List'

@SPRESNAC - it's a copy and paste mistake. My code has that. Let me correct it.

helpmyworld started a new conversation SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column '0' In 'field List'

I am getting this troublesome error

```SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: update cms_pages set status = 1, title =


My controller is:

public function editCmsPage(Request $request,$id){ if($request->isMethod('post')){ $data = $request->all(); if(empty($data['status'])){ $status = '0'; }else{ $status = '1'; } CmsPage::where(['id'=>$id])>update(['status'=>$status,'title'=>$data['title'],'url'=>$data['url'],'description'=>$data['description']]); return redirect()->back()->with('flash_message_success', 'CMS Page has been updated successfully'); } $cmsPage = CmsPage::where('id',$id)->first(); return view('admin.pages.edit_cms_page')->with(compact('cmsPage')); }


I am sure the challenge is somewhere in my controller.
17 Feb
1 month ago

helpmyworld started a new conversation Trying To Get Property 'slug' Of Non-object (View:

I know this has been answered before but please i do not find a solution relevant to my case.

This works very well

        $productsAll = Product::inRandomOrder()->where('status',1)->where('feature_item', 1)->get();

BUT WHEN I TRY TO PAGINATE LIKE SO

        $productsAll = Product::inRandomOrder()->where('status',1)->where('feature_item', 1)->paginate(4);

I get the the error "Trying to get property 'slug' of non-object (View:"

MY VIEW

<div class="productinfo text-center">
                                            <a href="{{ url('/product/'.$pro->slug) }}"><img src="{{ asset('/images/backend_images/product/small/'.$pro->image) }}" alt="" width="212" height="340"/></a>
                                            <h2>R {{ $pro->price }}</h2>
                                            <a href="{{ url('/product/'.$pro->slug) }}"><p>{{ $pro->product_name }}</p></a>
                                            <a href="{{ url('/product/'.$pro->slug) }}" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</a>
                                        </div>

Please help

03 Feb
1 month ago

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@SNAPEY - The goal is to get this: localhost:8000/books/book-one

This error appears when i try to create a slug. for example in my controller i have

public function getSingle($slug){

        $productsAll = Product::where('slug', '=', $slug)->first();
        return view('books.single')->withProductsAll(compact('productsAll'));
    }

my MODEL =====

class Product extends Model
{
    public function attributes(){
        return $this->hasMany('App\ProductsAttribute','product_id');
    }

    use Sluggable;

    /**
     * Return the sluggable configuration array for this model.
     *
     * @return array
     */
    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'product_name'
            ]
        ];
    }
}

ROUTE ===

Route::get('books/{slug}', ['as' => 'books.single', 'uses' => '[email protected]'])->where('slug', '[\w\d\-\_]+');

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@SNAPEY - this is all there is... on the right hand side

BadMethodCallException thrown with message "Call to undefined method App\Product::products()"

Stacktrace:
#67 BadMethodCallException in C:\xampp\htdocs\ecomweb\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:50
#66 Illuminate\Database\Eloquent\Model:throwBadMethodCallException in C:\xampp\htdocs\ecomweb\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:36
#65 Illuminate\Database\Eloquent\Model:forwardCallTo in C:\xampp\htdocs\ecomweb\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1608...........


and 

C:\xampp\htdocs\ecomweb\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php
            if ($matches['class'] != get_class($object) ||
                $matches['method'] != $method) {
                throw $e;
            }
 
            static::throwBadMethodCallException($method);
        }
    }
 
    /**
     * Throw a bad method call exception for the given method.
     *
     * @param  string  $method
     * @return void
     *
     * @throws \BadMethodCallException
     */
    protected static function throwBadMethodCallException($method)
    {
        throw new BadMethodCallException(sprintf(
            'Call to undefined method %s::%s()', static::class, $method
        ));
    }
}
 
Arguments
"Call to undefined method App\Product::products()"

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@SNAPEY - The error message is BadMethodCallException Call to undefined method App\Product::products()

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@SNAPEY - I have been at this for some time and i am still stuck. Could this help find out where the problem might be

protected static function throwBadMethodCallException($method)
    {
        throw new BadMethodCallException(sprintf(
            'Call to undefined method %s::%s()', static::class, $method
        ));
    }
}
02 Feb
1 month ago

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@AURAWINDSURFING - My model===

class Product extends Model
{
    public function attributes(){
        return $this->hasMany('App\ProductsAttribute','product_id');
    }
}


VIEW ======

<div class="col-sm-5">
                            <div class="view-product">
                                <div class="easyzoom easyzoom--overlay easyzoom--with-thumbnails">
                                    <a id="mainImgLarge" href="{{ asset('/images/backend_images/product/large/'.$productDetails->image) }}">
                                        <img style="width:300px" id="mainImg" src="{{ asset('/images/backend_images/product/medium/'.$productDetails->image) }}" alt=""
                                             width="212" height="400"/>
                                    </a>
                                </div>
                            </div>
                            <div id="similar-product" class="carousel slide" data-ride="carousel">

                                <!-- Wrapper for slides -->
                                <div class="carousel-inner">
                                    @if(count($productAltImages)>0)
                                        <div class="item active thumbnails">
                                            @foreach($productAltImages as $altimg)
                                                <a href="{{ asset('images/backend_images/product/medium/'.$altimg->image) }}" data-standard="{{ asset('images/backend_images/product/small/'.$altimg->image) }}">
                                                    <img class="changeImage" style="width:80px; cursor:pointer" src="{{ asset('images/backend_images/product/small/'.$altimg->image) }}" alt="">
                                                </a>
                                            @endforeach
                                        </div>
                                    @endif
                                </div>

                                <!-- Controls -->
                                <a class="left item-control" href="#similar-product" data-slide="prev">
                                  <i class="fa fa-angle-left"></i>
                                </a>
                                <a class="right item-control" href="#similar-product" data-slide="next">
                                  <i class="fa fa-angle-right"></i>
                                </a>
                            </div>

                        </div>
                        <div class="col-sm-7">
                            <form name="addtoCartForm" id="addtoCartForm" action="{{ url('add-cart') }}" method="post">{{ csrf_field() }}
                                <input type="hidden" name="product_id" value="{{ $productDetails->id }}">
                                <input type="hidden" name="product_name" value="{{ $productDetails->product_name }}">
                                <input type="hidden" name="product_code" value="{{ $productDetails->product_code }}">
                                <input type="hidden" name="product_color" value="{{ $productDetails->product_color }}">
                                <input type="hidden" name="price" id="price" value="{{ $productDetails->price }}">
                                <div class="product-information"><!--/product-information-->
                                    <img src="images/product-details/new.jpg" class="newarrival" alt="" />
                                    <h2>{{ $productDetails->product_name }}</h2>
                                    <p>Product Code: {{ $productDetails->product_code }}</p>
                                    <p>
                                        <select id="selSize" name="size" style="width:150px;" required>
                                            <option value="">Select</option>
                                            @foreach($productDetails->attributes as $sizes)
                                                <option value="{{ $productDetails->id }}-{{ $sizes->size }}">{{ $sizes->size }}</option>
                                            @endforeach
                                        </select>
                                    </p>
                                    <img src="images/product-details/rating.png" alt="" />
                                    <span>
                                        <span id="getPrice">R {{ $productDetails->price }}</span>
                                        <label>Quantity:</label>
                                        <input name="quantity" type="text" value="1" />
                                        @if($total_stock>0)
                                            <button type="submit" class="btn btn-fefault cart" id="cartButton">
                                                <i class="fa fa-shopping-cart"></i>
                                                Add to cart
                                            </button>
                                        @endif
                                    </span>
                                    <p><b>Availability: </b><span id="Availability"> @if($total_stock>0) In Stock @else Out Of Stock @endif</span></p>
                                    <p><b>Condition:</b> New</p>

                                    <a href=""><img src="images/product-details/share.png" class="share img-responsive"  alt="" /></a>
                                </div><!--/product-information-->
                            </form>
                        </div>
                    </div><!--/product-details-->

                    <div class="category-tab shop-details-tab"><!--category-tab-->
                        <div class="col-sm-12">
                            <ul class="nav nav-tabs">
                                <li class="active"><a href="#description" data-toggle="tab">Description</a></li>
                                <li><a href="#care" data-toggle="tab">Material & Care</a></li>
                                <li><a href="#delivery" data-toggle="tab">Delivery Options</a></li>
                            </ul>
                        </div>
                        <div class="tab-content">
                            <div class="tab-pane fade" id="description" >
                                <div class="col-sm-12">
                                    <p>{{ $productDetails->description }}</p>
                                </div>
                            </div>

                            <div class="tab-pane fade" id="care" >
                                <div class="col-sm-12">
                                    <p>{{ $productDetails->care }}</p>
                                </div>
                            </div>

                            <div class="tab-pane fade" id="delivery" >
                                <div class="col-sm-12">
                                    <p>100% Original Products <br>
                                        Cash on delivery might be available</p>
                                </div>
                            </div>


                        </div>
                    </div><!--/category-tab-->

                    <div class="recommended_items"><!--recommended_items-->
                        <h2 class="title text-center">recommended items</h2>

                        <div id="recommended-item-carousel" class="carousel slide" data-ride="carousel">
                            <div class="carousel-inner">
                                <?php $count=1; ?>
                                @foreach($relatedProducts->chunk(3) as $chunk)
                                    <div <?php if($count==1){ ?> class="item active" <?php } else { ?> class="item" <?php } ?>>
                                        @foreach($chunk as $item)
                                            <div class="col-sm-4">
                                                <div class="product-image-wrapper">
                                                    <div class="single-products">
                                                        <div class="productinfo text-center">
                                                            <img style="width:200px;" src="{{ asset('images/backend_images/product/small/'.$item->image) }}" alt=""  width="320" height="400"/>
                                                            <h2>R {{ $item->price }}</h2>
                                                            <p>{{ $item->product_name }}</p>
                                                            <a href="{{ url('/product/'.$item->id) }}"><button type="button" class="btn btn-default add-to-cart"><i class="fa fa-shopping-cart"></i>Add to cart</button></a>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        @endforeach
                                    </div>
                                    <?php $count++; ?>
                                @endforeach
                            </div>

helpmyworld left a reply on BadMethodCallException Call To Undefined Method App\Product::products()

@AURAWINDSURFING - I do not think so, because the same code for books.single works on another view blade (product.listing).

helpmyworld started a new conversation BadMethodCallException Call To Undefined Method App\Product::products()

I hope this will be my last call for help on this project. I am getting a BadMethodCallException Call to undefined method.

I am trying to use slug as a way to display links on my URL for example instead of using http://localhost:8000/product/1 I want to use but http://localhost:8000/product/blue-shirts

I am stuck on my controller.

My controller

public function getSingle($slug) {

        $productsAll = Product::where('slug', '=', $slug)->first();

        // Get All Categories and Sub Categories
        $categories_menu = "";
        $categories = Category::with('categories')->where(['parent_id' => 0])->get();
        $categories = json_decode(json_encode($categories));
        /*echo "<pre>"; print_r($categories); die;*/

        // Get Product Details
        $productDetails = Product::with('attributes')->where('slug', $slug)->first();
        $relatedProducts = Product::where('slug','!=',$slug)->where(['category_id' => $productDetails->category_id])->get();


        return view('books.single')->with(compact('productsAll','productDetails','categories_menu','categories','banners',
            'relatedProducts','productAltImages','total_stock'));
    }

helpmyworld left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'ecomweb.poster_poster

@SNAPEY - Yes, i am ok with this one. You helped to resolve it on the other discussion.

Thank you

helpmyworld left a reply on Pass Variable To All Views

Wow, it works, can space make that much of a difference. Thank you!

helpmyworld left a reply on Pass Variable To All Views

@SNAPEY - It is getting there. It works well when I do what you suggest: dd('getting posters');

helpmyworld left a reply on Pass Variable To All Views

@SNAPEY - My apologies if I am a little bit slow. There are my results

"Undefined variable: posters (View: C:\xampp\htdocs\ecomweb\resources\views\layouts\frontLayout\front_footer.blade.php) (View: C:\xampp\htdocs\ecomweb\resources\views\layouts\frontLayout\front_footer.blade.php) (View: C:\xampp\htdocs\ecomweb\resources\views\layouts\frontLayout\front_footer.blade.php) ◀"

helpmyworld left a reply on Pass Variable To All Views

@SNAPEY - Yes, these are the results. But I am not quite sure how to use them in the composer. is this the correct way?

public function boot()
    {
        view()->composer('layouts.frontLayout.front_footer', function ($view){

            $view->with('posters ', \App\Poster::all());
        });
    }

helpmyworld left a reply on Pass Variable To All Views

@SNAPEY - After doing running:

C:\xampp\htdocs\ecomweb>php artisan tinker

Psy Shell v0.9.9 (PHP 7.2.11 — cli) by Justin Hileman

Results========

\App\Poster::all() => Illuminate\Database\Eloquent\Collection {#3070 all: [ App\Poster {#3071 id: 1, image: "31041.jpg", title: "Poster one", link: "poster 1", status: 1, created_at: "2019-02-02 03:58:01", updated_at: "2019-02-02 03:58:01", }, ], }

helpmyworld left a reply on Pass Variable To All Views

@SNAPEY - This is what happened after using tinker

`` C:\xampp\htdocs\ecomweb>php artisan tinker Psy Shell v0.9.9 (PHP 7.2.11 — cli) by Justin Hileman

\App\Poster::posters() BadMethodCallException with message 'Call to undefined method App/Poster::posters()' \App\Poster::all()); PHP Parse error: Syntax error, unexpected ')' on line 1 \App\Poster::all() => Illuminate\Database\Eloquent\Collection {#3070 all: [ App\Poster {#3071 id: 1, image: "31041.jpg", title: "Poster one", link: "poster 1", status: 1, created_at: "2019-02-02 03:58:01", updated_at: "2019-02-02 03:58:01", }, ], }

helpmyworld started a new conversation Pass Variable To All Views

My apologies if i am opening multiple questions at once. I realized that my first question was not explained well.

I am trying to pass variables to all my views. I keep getting the undefined variable error. Undefined variable: posters (View: C:\xampp\htdocs\ecomweb\resources\views\layouts\frontLayout\front_footer.blade.php) (View:

I tried to follow this https://laracasts.com/series/laravel-5-fundamentals/episodes/25

AppServiceProvider

    {
        Schema::defaultStringLength(191);
        //
       
        view()->composer('layouts.frontLayout.front_footer', function ($view){

            $view->with('posters ', \App\Poster::has('posters')->pluck('image'));
        });
    }

My View=========
<ol class="carousel-indicators">
                                    @foreach($posters as $key => $poster)
                                        <li data-target="#slider-carousel" data-slide-to="0" @if($key==0) class="active" @endif></li>
                                    @endforeach
                                </ol>

                                <div class="carousel-inner">
                                    @foreach($posters as $key => $poster)
                                        <div class="item @if($key==0) active @endif">
                                            <a href="{{ $poster->link }}" title="poster 1"><img src="images/frontend_images/posters/{{ $poster->image }}"></a>
                                        </div>
                                    @endforeach
                                </div>

helpmyworld left a reply on SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'ecomweb.poster_poster

I do understand what you mean. I am not making sense in my code. My intention is that I WANT TO SHARE A VIEW WITH ALL MY BLADES"

I have posters that are in the footer which are pulled from the database. When I do that it says undefined variable. So I thought I should solve using the AppServiceProver.

Briefly, I want to pass data to all views but I keep getting an error that says undefined variable.

helpmyworld started a new conversation SQLSTATE[42S02]: Base Table Or View Not Found: 1146 Table 'ecomweb.poster_poster

May i please be assisted.

Laravel is trying to use a table that does not exist. I am trying to find out what is the root cause of this. The goal is to pass a view to all the pages

public function up()
    {
        Schema::create('posters', function (Blueprint $table) {
            $table->increments('id');
            $table->string('image', 255);
            $table->string('title', 255);
            $table->string('link', 255);
            $table->tinyInteger('status');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('posters');
    }
}


Model===
class Poster extends Model
{
    public function posters()

    {
//        public $table = "posters";
        return $this->belongsToMany('App\Poster');
    }


AppService Provider===

 public function boot()
    {
       
        view()->composer('layouts.frontLayout.front_footer', function ($view){

            $view->with('posters ', \App\Poster::has('posters')->pluck('image'));
        });
    }


Kind Regards

16 Jan
2 months ago

helpmyworld started a new conversation Swift_TransportException Process Could Not Be Started [The System Cannot Find The Path Specified. ]

Please assist me with this error "Swift_TransportException Process could not be started [The system cannot find the path specified. ]"

env

MAIL_DRIVER=smtp
MAIL_HOST=helpmyworld.co.za
MAIL_PORT=995
MAIL_USERNAME=*****@helpmyworld.co.za
MAIL_PASSWORD=********@
MAIL_ENCRYPTION=SSL
05 Jan
2 months ago

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@SHEZ1983 - Thank you. I am not ignoring him at all... I am rather learning with what he suggested. You are right I have a lot of learning to do so far as Laravel is concerned.

04 Jan
2 months ago

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@SNAPEY - Please, so far as your knowledge is concerned. I'd like to get your view on the solution below.

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

the following solved my issue. I changed$ shippingCount to $shippingDetails

        $shippingCount = DeliveryAddress::where('user_id',$user_id)->count();
        if($shippingCount>0){
            $shippingDetails = DeliveryAddress::where('user_id',$user_id)->first();
//remember it was: $shippingCount = DeliveryAddress::where('user_id', $user_id)->first();
        }

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@SNAPEY - I know you are trying to help and you have tremendously helped me before. Unfortunately, I do not know how to respond back to you. I am a copycat in this case, I am literally following a youtube video tutorial but I will work on this until I find a way

03 Jan
2 months ago

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@SNAPEY - I modified the id column to auto-increment. I am not back to the error of "Object of class App\DeliveryAddress could not be converted to int"

I noticed that users adding new shipping addresses for the first time successfully add to the database. The object of class...error appears when the same user is buying something for the second time with the old/new shipping address.

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

I deleted my database data on table "delivery_addresss" the error I am getting now is

SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value (SQL: insert into `delivery_addresses` (`user_id`, `user_email`, `name`, `address`, ▶"

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@MANELGAVALDA - It's an online store.

I want to check if the logged in "user" has already filled in the shipping address. If they already filled in the shipping address then the will be no need to fill the shipping address form again.

If there is a shipping address linked to the user id, the form will populate the address automatically. if there is no address, I want to save the new address.

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

@MANELGAVALDA - Thank you.

I can make sense of what you are advising, just that I am not sure where to go from here. I will try to look at it and do my best to resolve it. I am guilty of being a beginner just following youtube videos without the basic understanding of reading the code.

helpmyworld left a reply on Object Of Class App\DeliveryAddress Could Not Be Converted To Int

        $user_id = Auth::user()->id;
        $user_email = Auth::user()->email;
        $userDetails = User::find($user_id);
        $shippingDetails = User::find($user_id);
        $countries = Country::get();

        //check if the shipping address exist
        $shippingCount = DeliveryAddress::where('user_id', $user_id)->count();
        if($shippingCount>0){
            $shippingCount = DeliveryAddress::where('user_id', $user_id)->first();
        }

        // Update cart table with user email
        $session_id = Session::get('session_id');
        DB::table('cart')->where(['session_id'=>$session_id])->update(['user_email'=>$user_email]);
        if($request->isMethod('post')){
            $data = $request->all();
//            echo "<pre"; print_r($data); die;

            if(empty($data['billing_name'])
                || empty($data['billing_address'])
                || empty($data['billing_city'])
                || empty($data['billing_state'])
                || empty($data['billing_country'])
                || empty($data['billing_pincode'])
                || empty($data['billing_mobile'])
                || empty($data['shipping_name'])
                || empty($data['shipping_address'])
                || empty($data['shipping_city'])
                || empty($data['shipping_state'])
                || empty($data['shipping_country'])
                || empty($data['shipping_pincode'])
                || empty($data['shipping_mobile'])){
                return redirect()->back()->with('flash_message_error', 'Please fill al fields to Checkout!');
            }

            //Update User details
            User::where('id', $user_id)->update([
                'name'=>$data['billing_name'],
                'address'=>$data['billing_address'],
                'city'=>$data['billing_city'],
                'state'=>$data['billing_state'],
                'pincode'=>$data['billing_pincode'],
                'country'=>$data['billing_country'],
                'mobile'=>$data['billing_mobile']
            ]);

            if($shippingCount>0){
                //update shipping address
//                DeliveryAddress::where('user_id', $user_id)->update([
//                    'name'=>$data['shipping_name'],
//                    'address'=>$data['shipping_address'],
//                    'city'=>$data['shipping_city'],
//                    'state'=>$data['shipping_state'],
//                    'pincode'=>$data['shipping_pincode'],
//                    'country'=>$data['shipping_country'],
//                    'mobile'=>$data['shipping_mobile']
//                ]);

                DeliveryAddress::where('user_id', $user_id)->first()->update([
                    'name'=>$data['shipping_name'],
                    'address'=>$data['shipping_address'],
                    'city'=>$data['shipping_city'],
                    'state'=>$data['shipping_state'],
                    'pincode'=>$data['shipping_pincode'],
                    'country'=>$data['shipping_country'],
                    'mobile'=>$data['shipping_mobile']
                ]);

            }else{
                //add new shipping address
                $shipping = new DeliveryAddress;
                $shipping->user_id = $user_id;
                $shipping->user_email = $user_email;
                $shipping->name = $data['shipping_name'];
                $shipping->address = $data['shipping_address'];
                $shipping->city = $data['shipping_city'];
                $shipping->state = $data['shipping_state'];
                $shipping->pincode = $data['shipping_pincode'];
                $shipping->country = $data['shipping_country'];
                $shipping->mobile = $data['shipping_mobile'];
                $shipping->save();
            }
            return redirect()->action('[email protected]');


        }

        return view('products.checkout')->with(compact('userDetails','countries', 'shippingDetails'));
    } ```

helpmyworld started a new conversation Object Of Class App\DeliveryAddress Could Not Be Converted To Int

Please help, I did my research but I seem to get nowhere with "Object of class App\DeliveryAddress could not be converted to int"


public function checkout (Request $request){

if($shippingCount>0){
                //update shipping address
                DeliveryAddress::where('user_id', $user_id)->update([
                    'name'=>$data['shipping_name'],
                    'address'=>$data['shipping_address'],
                    'city'=>$data['shipping_city'],
                    'state'=>$data['shipping_state'],
                    'pincode'=>$data['shipping_pincode'],
                    'country'=>$data['shipping_country'],
                    'mobile'=>$data['shipping_mobile']
                ]);

helpmyworld started a new conversation Call To Undefined Function App\Http\Controllers\table()

Please help me with this issue. Call to undefined function App\Http\Controllers\table()

my controller

public function checkout (Request $request){
        $user_id = Auth::user()->id;
        $user_email = Auth::user()->email;
      

        // Update cart table with user email
        $session_id = Session::get('session_id');
        DB:table('cart')->where(['session_id'=>$session_id])->update(['user_email'=>$user_email]);
23 May
10 months ago

helpmyworld left a reply on Unable To Run Composer Install And Update On Production

Thank you, this was easy i am embarrassed. I enabled the function in my WHM Cpanel.

helpmyworld left a reply on This Page Isn’t Working Www.maimoonahgori.co.za Is Currently Unable To Handle This Request. HTTP ERROR 500

This is my own server, i am using WHM Cpanel, created a reseller account inside this server.

helpmyworld left a reply on This Page Isn’t Working Www.maimoonahgori.co.za Is Currently Unable To Handle This Request. HTTP ERROR 500

It happens for every url. the entire website is showing that error.

Cronix please enlighten me, when i check the logs, what do i look for? I am asking because i am learning as i build.

helpmyworld started a new conversation Unable To Run Composer Install And Update On Production

i am using putty to log on to my server. i navigate to my laravel project to run "composer update or install" i get the below error

  The "https://packagist.org/packages.json" file could not be downloaded: all
  ow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in th
  e server configuration by allow_url_fopen=0
  failed to open stream: no suitable wrapper could be found)

Please assist

helpmyworld started a new conversation This Page Isn’t Working Www.maimoonahgori.co.za Is Currently Unable To Handle This Request. HTTP ERROR 500

I know that this this issue has been tackled before but all the answers out there do not solve my problem.

My website was working well not it is showing this error. Please assist.

05 Apr
11 months ago

helpmyworld left a reply on NotFoundHttpException In RouteCollection.php (line 179) I Am Unable To View Books In A Specified Category.

i managed to get it to work with this the following:

Route::get('/books/cats/book/{id}', '[email protected]');

 public function getbook($id){

        $book=Product::find($id);

        return view('front.book',compact('book'));
    }

Thank you

04 Apr
11 months ago

helpmyworld started a new conversation NotFoundHttpException In RouteCollection.php (line 179) I Am Unable To View Books In A Specified Category.

I am unable to view books in a specified category.

how can I make a route for this "http://localhost:8000/books/cats/book/2"?

I do not have a route, I do not know how to make one that yields the desired end results.

My Scenario is this: I have a book and I need to categorize them, so far I am able to put them in different categories however I am unable to view books in a specified category.

The current routes and controller:

Route::get('/books/cats/{cat}','[email protected]');



 public function index(Category $category)
    {

       $postsPerPage = 10; //As many posts as you want to show on each page
       $posts = $category->posts()->orderBy('id', 'desc')->paginate($postsPerPage);
        //$posts = Post::->paginate(3);
       return view('front.blog', compact('posts'));
    }

Somone please educate me.

14 Mar
1 year ago

helpmyworld left a reply on Wordpress Themes On Laravel 5.4 CMS

@oooALIooo, may i see your finished project (cms). Share your link with me please.

03 Feb
1 year ago

helpmyworld started a new conversation (1/1) TokenMismatchException In VerifyCsrfToken.php (line 68)

Good day

I am trying to send an email via contact form. I get the error to say " (1/1) TokenMismatchException"

I tried to run php artisan config: cache and php artisan cache: clear

Rechecked my .env file and mail.php to see if it is the same as my email smtp details but nothing seem to work.

27 Jan
1 year ago

helpmyworld left a reply on Pictures Do Not Display On Production Server Failed To Load Resource: The Server Responded With A Status Of 500 (Internal Server Error)

@m-rk allow me to say i also do not like including public to get my css right. this is the link to my website http://sgmpublishing.co.za/

Please assist me. I not sure of your question but when i visit my page i see the address link of my website as i provided up there. Can you perhaps guide me? I would really appreciate it.

26 Jan
1 year ago

helpmyworld left a reply on Pictures Do Not Display On Production Server Failed To Load Resource: The Server Responded With A Status Of 500 (Internal Server Error)

@m-rk i got it right. I just learned that i had to reference the full path.

It was like this ``` @if(!empty($author->image)) @endif

now i made it like this

@if(!empty($author->image)) @endif```

I just added "/public/" and it worked.

helpmyworld started a new conversation Pictures Do Not Display On Production Server

Good day

I have deployed my laravel app successfully, however, pictures do not display/show on the production site.

May I please be assisted.