Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

hackroot

hackroot

Web Designer at Brandsafric

Member Since 1 Year Ago

Experience Points
1,300
Total
Experience

3,700 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
1,300 XP
Nov
24
1 day ago
Activity icon

Replied to Multi-step Form In Laravel 8 With Parsley-js

@automica, please what am I doing wrong?

Activity icon

Started a new Conversation Multi-step Form In Laravel 8 With Parsley-js

Hi, I am trying to create a multi-step form in laravel however I don't know why the form is not displaying all i see is the header and footer of the card component i used. This is a link to what I see; https://imgur.com/a/fyMhDu0,

Any assistance of sort will be greatly appreciated... Thanks

members javascript

  <script>
        $(function(){
            var $sections = $('.form-section');

            function navigateTo(index){
                $sections.removeClass('current').eq(index).addClass('current');
                $('.form-navigation .previous').toggle(index>0);
                var atTheEnd = index >= $sections.length - 1;
                $('.form-navigation .next').toggle(!atThe End);
                $('.form-navigation [type=submit]').toggle(atTheEnd);
            }

            function curIndex()
            {
                return $sections.index($sections.filter('.current'));
            }

            $('.form-navigation .previous').click(function(){
                navigateTo(curIndex()-1);
            });

            $('.form-navigation .next').click(function(){
                $('.contact-form').parsley().whenValidate({
                    group: 'block-' + curIndex()
                }).done(function(){
                    navigateTo(curIndex()+1);
                });
            });

            $sections.each(function(index,section){
                $(section).find(':input').attr('data-parsley-group','block-'+index);
                });

                navigateTo(0);
        });
    </script>

members form css

   <style>
        .section{
            padding-top:100px !important;
        }
        .form-section{
            padding-left:15px;
            display: none;
        }
        .form-section.current{
            display: inherit;
        }
        .btn-info, .btn-success{
            margin-top:10px;
        }
        .parsley-error-list{
            margin: 2px 0 3px;
            padding: 0;
            list-style-type:none;
            color:red;
        }
    </style>

members.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width-device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie-edge">
    <title>Add New Member</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/parsley.js/2.9.2/parsley.min.js" integrity="sha512-eyHL1atYNycXNXZMDndxrDhNAegH2BDWt1TmkXJPoGf1WLlNYt08CSjkqF5lnCRmdm3IrkHid8s2jOUY4NIZVQ==" crossorigin="anonymous"></script>
 
</head>
<body>
    <section>
        <div class="container">
            <div class="row">
                <div class="col-md-8 offset-md-3">
                    <div class="card">
                        <div class="card-header text-white bg-info">
                            <h5>Membership Application Form</h5>
                        </div>
                        <div class="card-body">
                            <form class="contact-form">
                                @csrf
                                <div class="form-section">
                                    <label for="firstname">First Name:</label>
                                    <input type="text" name="firstname" class="form-control" placeholder="First Name" required/>

                                    <label for="middlename">Middle Name:</label>
                                    <input type="text" name="middlename" class="form-control" placeholder="Middle Name / Other Name"/>

                                    <label for="lastname">Last Name:</label>
                                    <input type="text" name="lastname" class="form-control" placeholder="Last Name" required/>

                                    <label for="gender">Gender:</label>
                                    <input type="text" name="" class="form-control" required/>

                                    <label for="hobbies">What are your hobbies?</label>
                                    <input type="text" name="hobbies" class="form-control" required/>

                                    <label for="languages">Language Spoken:</label>
                                    <input type="text" name="languages" class="form-control" required/>

                                    <label for="nationality">Nationality:</label>
                                    <input type="text" name="nationality" class="form-control" required/>

                                    <label for="dob">Date Of Birth:</label>
                                    <input type="date" name="dob" class="form-control" required/>

                                    <label for="pob">Place Of Birth:</label>
                                    <input type="text" name="pob" class="form-control" required/>
                                </div>
                                <div class="form-section">
                                    <label for="phone_1">Mobile Phone:</label>
                                    <input type="text" name="phone_1" class="form-control" required/>

                                    <label for="phone_2">Home Phone:</label>
                                    <input type="text" name="phone_2" class="form-control" required/>

                                    <label for="email">E-mail Address:</label>
                                    <input type="email" name="email" class="form-control" required/>

                                    <label for="province">Province:</label>
                                    <input type="text" name="province" class="form-control" required/>

                                    <label for="state">State:</label>
                                    <input type="text" name="state" class="form-control" required/>

                                    <label for="region">Region:</label>
                                    <input type="text" name="region" class="form-control" required/>

                                    <label for="city">City:</label>
                                    <input type="text" name="city" class="form-control" required/>

                                    <label for="town">Town:</label>
                                    <input type="text" name="town" class="form-control" required/>

                                    <label for="residence">Residence Address</label>
                                    <input type="text" name="residence" class="form-control" required/>

                                    <label for="region">Work Address:</label>
                                    <input type="text" name="region" class="form-control" required/>
                                </div>
                                <div class="form-section">
                                    <label for="occupation">Occupation:</label>
                                    <input type="text" name="occupation" class="form-control" required/>

                                    <label for="company">Company:</label>
                                    <input type="text" name="company" class="form-control" required/>

                                    <label for="position">Position:</label>
                                    <input type="text" name="position" class="form-control" required/>

                                    <label for="employer">Company Representative:</label>
                                    <input type="text" name="employer" class="form-control" required/>

                                    <label for="employer-contact">Company Representative:</label>
                                    <input type="text" name="employer-contact" class="form-control" required/>
                                </div>
                                <div class="form-section">
                                    <label for="educationstatus">Educational Status:</label>
                                    <input type="text" name="eductionstatus" class="form-control" required/>

                                    <label for="educationlevel">Educational Level:</label>
                                    <input type="text" name="eductionlevel" class="form-control" required/>

                                    <label for="oldschool">Name of Last School Attended:</label>
                                    <input type="text" name="oldschool" class="form-control" required/>

                                    <label for="addressofschool">Address of Last School</label>
                                    <input type="text" name="addressofschool" class="form-control" required/>
                                </div>
                                <div class="form-section">
                                    <label for="marital-status">Marital Status:</label>
                                    <input type="text" name="marital-status" class="form-control" required/>

                                    <label for="typeofmarriage">Type of Marriage:</label>
                                    <input type="text" name="typeofmarriage" class="form-control" required/>

                                    <label for="nameofspouse">Name of Spouse:</label>
                                    <input type="text" name="nameofspouse" class="form-control" required/>

                                    <label for="spouse-status">Spouse Status:</label>
                                    <input type="text" name="spouse-status" class="form-control" required/>

                                    <label for="addressofspouse">Address of Spouse:</label>
                                    <input type="text" name="addressofspouse" class="form-control" required/>

                                    <label for="numberofchildren">How Many Children Do you Have:</label>
                                    <input type="text" name="numberofchildren" class="form-control" required/>

                                    <label for="children">Name of Child/Children:</label>
                                    <input type="text" name="children" class="form-control" required/>

                                    <label for="jobofspouse">Occupation of Spouse:</label>
                                    <input type="text" name="jobofspouse" class="form-control" required/>

                                    <label for="spouse-jobposition">Position:</label>
                                    <input type="text" name="spouse-jobposition" class="form-control" required/>

                                    <label for="religionofspouse">Religion of Spouse:</label>
                                    <input type="text" name="religionofspouse" class="form-control" required/>

                                    <label for="spouses-pow">Spouses Place of Worship:</label>
                                    <input type="text" name="marital-status" class="form-control" required/>

                                    <label for="marital-status">Marital Status:</label>
                                    <input type="text" name="marital-status" class="form-control" required/>


                                    <label for="fathers-title">Father's Title:</label>
                                    <input type="text" name="fathers-title" class="form-control" required/>

                                    <label for="fathers-name">Father's Name:</label>
                                    <input type="text" name="fathers-name" class="form-control" required/>

                                    <label for="fathers-address">Father's Address</label>
                                    <input type="text" name="fathers-address" class="form-control" required/>

                                    <label for="status">Father's Status</label>
                                    <input type="text" name="status" class="form-control" required/>

                                    <label for="mother-title">Mother's Title:</label>
                                    <input type="text" name="mother-title" class="form-control" required/>

                                    <label for="mothers-name">Mother's Name:</label>
                                    <input type="text" name="mothers-name" class="form-control" required/>

                                    <label for="mothers-address">Mother's Address</label>
                                    <input type="text" name="mothers-address" class="form-control" required/>

                                    <label for="status">Mother's Status</label>
                                    <input type="text" name="status" class="form-control" required/>
                                </div>
                                <div class="form-section">
                                    <label for="old-church">Name of Former Church:</label>
                                    <input type="text" name="old-church" class="form-control" required/>

                                    <label for="dateofnewbirth">Date of New Birth:</label>
                                    <input type="date" name="dateofnewbirth" class="form-control" required/>

                                    <label for="placeofnewbirth">Place of New Birth:</label>
                                    <input type="text" name="placeofnewbirth" class="form-control" required/>

                                    <label for="dateofbaptism">Date of Baptism</label>
                                    <input type="date" name="dateofbaptism" class="form-control" required/>

                                    <label for="placeofbaptism">Place of Baptism</label>
                                    <input type="text" name="placeofbaptism" class="form-control" required/>

                                    <label for="pohsb">Place of Holy Spirit Baptism</label>
                                    <input type="text" name="pohsb" class="form-control" required/>

                                    <label for="firstworship">Date of First Worship</label>
                                    <input type="date" name="firstworship" class="form-control" required/>

                                    <label for="church-position">Church Position</label>
                                    <input type="text" name="church-position" class="form-control" required/>

                                    <label for="church-groups">Your Church Groups</label>
                                    <input type="text" name="church-groups" class="form-control" required/>

                                    <label for="talents">What Gifts/talents Do you have?</label>
                                    <input type="text" name="talents" class="form-control" required/>

                                    <label for="ministries">In Which of these Ministries Can You Be Most Effective?</label>
                                    <input type="text" name="ministries" class="form-control" required/>
                                </div>
                                <div class="form-navigation">
                                    <button type="button" class="previous btn btn-info float-left">Previous</button>
                                    <button type="button" class="next btn btn-info float-right">Next</button>
                                    <button type="submit" class="btn btn-success float-right">Submit</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</body>
</html>

Members.php(Model)

<?php

namespace App\Models\Members;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Member extends Model
{
    use HasFactory;
}

MemberController.php

<?php

namespace App\Http\Controllers\Members;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class MemberController extends Controller
{
   public function index(){
       return view ('members.member');
   }

   public function formSubmit(Request $request){
    return $request->all();
    }
}

web.php(routes)

<?php
use App\Http\Controllers\Members\MemberController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/members',[MemberController::class,'index']);
Route::post('/members',[MemberController::class,'formSubmit'])->name('member.formSubmit');
Nov
20
5 days ago
Activity icon

Started a new Conversation Membership System (Advice And Process Needed)

Hello so i wanna create a multi-tenancy system with the following features;

membership system (with a unique id(e.g: CHM/GT/000 for each member)where *CHM* is initials of the church *GT* is the branch and *000* is the number of the member. Also member should be able to belong to a group or more groups example "Employee" while as maybe can also belong to finance...

forum module ```forum should be such that a guest can create a discussion and so can a member but all post must be reviewed by the forum master before accepted, also forum users should be able to post for admin or forum masters eyes only.

blog module ```(Can upload video and audio) under various categories such as (sermons, teachings, events,) includes subcategories too)```

mail module ```(Manages mailes of all users with emails with the church.
finance module(Transactions, Income; Tithes, Donations, Offerings, Expense etc```

event/program module ```(list all weekly, monthly and annual events from a predefined calendar. featuring cureent or next event.```

so i want the website to be as lite and fast as possible. Now my hustle is do i code it from scratch or what admin panel is well recommended for such a system. the application is a church management system.

Any advice is much appreciated
Nov
03
3 weeks ago
Activity icon

Replied to Can't Access My Home Page Because Of This Error

breaking_news_category_id is being used in the following pages;

Setting.php, SettingController.php, AppServiceProvider.php, breaking-news.blade.php, 2018_10_26_154819_create_settings_table.php

I have added them to the gist please

Activity icon

Replied to Can't Access My Home Page Because Of This Error

Hi please this is the gist for the news portal; https://gist.github.com/brandsafric/9598b2b9b72ddbc60557938379769a7b

I am currently adding all the files where breaking_news_category_id is being used, Thanks a lot

Activity icon

Replied to Can't Access My Home Page Because Of This Error

Yes Sir that's what i am doing now however there is no slider within this project. sir

Activity icon

Replied to Can't Access My Home Page Because Of This Error

and here is my CategoryController.php

<?php

namespace App\Http\Controllers;

use App\Category;
use Illuminate\Http\Request;

class CategoryController extends Controller
{

    public function index()
    {
        $categories = Category::latest()->get();

        return view('backend.category.index', compact('categories'));
    }


    public function create()
    {
        return view('backend.category.create');
    }


    public function store(Request $request)
    {
        $request->validate([
            'name'   => 'required|unique:categories|max:255',
            'image'  => 'required|image|mimes:jpg,png,jpeg'
        ]);

        if(isset($request->status)){
            $status = true;
        }else{
            $status = false;
        }

        if ($request->hasFile('image')) {
            $imageName = 'category-'.time().uniqid().'.'.$request->image->getClientOriginalExtension();
            $request->image->move(public_path('images'), $imageName);
        }

        Category::create([
            'name'   => $request->name,
            'slug'   => str_slug($request->name),
            'image'  => $imageName,
            'status' => $status
        ]);

        return redirect()->route('admin.category.index')->with(['message' => 'Category created successfully!']);
    }


    public function show(Category $category)
    {
        //
    }

 
    public function edit(Category $category)
    {
        $category = Category::findOrFail($category->id);

        return view('backend.category.edit', compact('category'));
    }


    public function update(Request $request, Category $category)
    {
        $request->validate([
            'name'   => 'required|max:255',
            'image'  => 'image|mimes:jpg,png,jpeg'
        ]);

        if(isset($request->status)){
            $status = true;
        }else{
            $status = false;
        }

        $category = Category::findOrFail($category->id);

        if ($request->hasFile('image')) {

            if(file_exists(public_path('images/') . $category->image)){
                unlink(public_path('images/') . $category->image);
            }

            $imageName = 'category-'.time().uniqid().'.'.$request->image->getClientOriginalExtension();
            $request->image->move(public_path('images'), $imageName);

        }else{
            $imageName = $category->image;
        }

        $category->update([
            'name'   => $request->name,
            'slug'   => str_slug($request->name),
            'image'  => $imageName,
            'status' => $status
        ]);

        return redirect()->route('admin.category.index')->with(['message' => 'Category updated successfully!']);
    }


    public function destroy(Category $category)
    {
        $category = Category::findOrFail($category->id);

        if(file_exists(public_path('images/') . $category->image)){
            unlink(public_path('images/') . $category->image);
        }

        $category->delete();

        return back()->with(['message' => 'Category deleted successfully!']);
    }
}

Activity icon

Replied to Can't Access My Home Page Because Of This Error

Please here is my master.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>News - @yield('title')</title>
    <link rel="stylesheet" href="{{ asset('frontend/css/breaking-news-ticker.css') }}">
    <link rel="stylesheet" href="{{ asset('frontend/css/style.css') }}">
</head>
<body>
    
    <header>

        @include('frontend.layout.partials.header')

        @include('frontend.layout.partials.mainmenu')
            
    </header>

    @yield('content')

    <footer>

        @include('frontend.layout.partials.footer')

    </footer>

    <!-- jQuery 3 -->
    <script src="{{ asset('backend/components/jquery/dist/jquery.min.js') }}"></script>
    <script src="{{ asset('frontend/js/breaking-news-ticker.min.js') }}"></script>

    @stack('scripts')

    <script>
        $(function(){
            $('#breakingnewsticker').breakingNews({radius: 0});
        });
    </script>
    
</body>
</html>
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

ok boss Thanks a lot, will get back to you with my end result

Activity icon

Started a new Conversation Can't Access My Home Page Because Of This Error

ErrorException (E_ERROR)
Trying to get property 'breaking_news_category_id' of non-object (View: C:\laragon\www\news\resources\views\frontend\layout\master.blade.php) (View: C:\laragon\www\news\resources\views\frontend\layout\master.blade.php)
Previous exceptions
Trying to get property 'breaking_news_category_id' of non-object (View: C:\laragon\www\news\resources\views\frontend\layout\master.blade.php) (0)
Trying to get property 'breaking_news_category_id' of non-object (0)
C:\laragon\www\news\app\Providers\AppServiceProvider.php
        if (! $this->app->runningInConsole()) {
 
            view()->composer(
                [
                    'frontend.layout.partials.header',
                    'frontend.layout.partials.footer'
                ], 
                function($view) {
                $view->with('headersettings', Setting::first());
                $view->with('headerads', Advertisement::get());
            });
 
            view()->composer('frontend.layout.partials.mainmenu', function($view) {
                $menus = Menu::all()->groupBy('parent_id');
                $view->with('mainmenus', $menus);
            });
 
            view()->composer('frontend.layout.partials.header', function($view) {
                $categoryid = Setting::first();
                $newstickers = News::latest()->whereHas('category')->where('category_id',$categoryid->breaking_news_category_id)->where('status',1)->get();
                $view->with('newstickers', $newstickers);
            });
 
            view()->composer('frontend.layout.partials.footer', function($view) {
                $view->with('footernewscategorylist', Category::has('newslist')->withCount('newslist')->orderBy('name','desc')->where('status',1)->get());
            });
 
            view()->composer('frontend.pages.sidebar', function($view) {
 
                $newscategory_two   = News::latest()->whereHas('category')->where('category_id',5)->where('status',1)->take(3)->get();
                
                $newstabspopular    = News::orderBy('view_count','DESC')->whereHas('category')->where('status',1)->take(5)->get();
                $newstabsrecent     = News::latest()->whereHas('category')->where('status',1)->take(5)->get();
                $newsinRandomOrder  = News::inRandomOrder()->whereHas('category')->where('status',1)->first();
                $newscategory_list  = Category::has('newslist')->withCount('newslist')->orderBy('name','desc')->where('status',1)->get();
 
                $view->with( compact(
                    'newscategory_two',
 
                    'newstabspopular',
Arguments
"Trying to get property 'breaking_news_category_id' of non-object (View: C:\laragon\www\news\resources\views\frontend\layout\master.blade.php) (View: C:\laragon\ ▶"

Kindly assist please

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica Hello Thanks a lot, now I can see the images at the front end however The images donot slide but they spreadout or stack over one another. I am not sure if that is a css issue or or it's within the laravel, qalso I tried adding a bootstrap slide sample with it's css however it did not have any effect even after i run "npm run dev" Also I had wanted the title to be on top of the slide however i noticed it was used as an "alt" in the home-slider.blade.php. or if possible can a description sector be added? Thanks again

Oct
31
3 weeks ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica I have update the gist with the followng files;

GlobalTemplateServiceProvider.php
AppServiceProvider.php
composer.json

I also did not call the laravelCollection/html in my composer at all, Thanks

Oct
30
3 weeks ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica Hello boss hope you doing well, anyway I have worked on the forms by imitating the category forms and here is my results; https://gist.github.com/brandsafric/999f14ebc494bc9999f35a8fe0f5df47. I get error when i visit the create page:

ErrorException (E_ERROR)
Class 'Form' not found (View: C:\laragon\www\laracom\resources\views\admin\slides\create.blade.php)
Previous exceptions
Class 'Form' not found (0)
C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php
     * @param  array   $__data
     * @return string
     */
    protected function evaluatePath($__path, $__data)
    {
        $obLevel = ob_get_level();
 
        ob_start();
 
        extract($__data, EXTR_SKIP);
 
        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            include $__path;
        } catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        } catch (Throwable $e) {
            $this->handleViewException(new FatalThrowableError($e), $obLevel);
        }
 
        return ltrim(ob_get_clean());
    }
 
    /**
     * Handle a view exception.
     *
     * @param  \Exception  $e
     * @param  int  $obLevel
     * @return void
     *
     * @throws \Exception
     */
    protected function handleViewException(Exception $e, $obLevel)
    {
        while (ob_get_level() > $obLevel) {
            ob_end_clean();
        }
 
Arguments
Symfony\Component\Debug\Exception\FatalThrowableError {#1462 ▶}
1

and I get a blank page when I try visiting the edit.blade.php page meanwhile it throws the following errors at source in the browser.

Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.
edit:1 Unchecked runtime.lastError: The message port closed before a response was received.

Please boss kindly assist. If possible I want the slides such that when one image is uploaded the it will be so as to behave like a landing page. Thanks in advance

Oct
28
4 weeks ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

okay i won't use it i will build the form with the default adminlte theme used here

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

laravelcollective/html (https://github.com/LaravelCollective/html) but i will very much want to use the default html so as to avoid conflicts, or what do you think?

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

Hello Good Morning, I had a blackout in my area, Please I can now access the admin.slides.index, however the following error is seen when I try accessing the create page

ErrorException (E_ERROR)
Class 'Form' not found (View: C:\laragon\www\laracom\resources\views\admin\slides\create.blade.php)
Previous exceptions
Class 'Form' not found (0)
C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php
     * @param  array   $__data
     * @return string
     */
    protected function evaluatePath($__path, $__data)
    {
        $obLevel = ob_get_level();
 
        ob_start();
 
        extract($__data, EXTR_SKIP);
 
        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            include $__path;
        } catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        } catch (Throwable $e) {
            $this->handleViewException(new FatalThrowableError($e), $obLevel);
        }
 
        return ltrim(ob_get_clean());
    }
 
    /**
     * Handle a view exception.
     *
     * @param  \Exception  $e
     * @param  int  $obLevel
     * @return void
     *
     * @throws \Exception
     */
    protected function handleViewException(Exception $e, $obLevel)
    {
        while (ob_get_level() > $obLevel) {
            ob_end_clean();
        }
 
Arguments
Symfony\Component\Debug\Exception\FatalThrowableError {#1477 ▶}
1

Also I get a blank page when I try to access the edit page, I noticed the show function in the controller, How would I make use of that please. Gist Updated, Thanks boss

Oct
24
1 month ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

Thank's that moved me forward, I got got a little stop with the migration of tables but i have done that successfully however I got stuck with yet another error;

ErrorException (E_ERROR)
Route [admin.slide.create] not defined. (View: C:\laragon\www\laracom\resources\views\admin\slides\index.blade.php)
Previous exceptions
Route [admin.slide.create] not defined. (0)
C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\UrlGenerator.php
               ! ($expires && Carbon::now()->getTimestamp() > $expires);
    }
 
    /**
     * Get the URL to a named route.
     *
     * @param  string  $name
     * @param  mixed   $parameters
     * @param  bool  $absolute
     * @return string
     *
     * @throws \InvalidArgumentException
     */
    public function route($name, $parameters = [], $absolute = true)
    {
        if (! is_null($route = $this->routes->getByName($name))) {
            return $this->toRoute($route, $parameters, $absolute);
        }
 
        throw new InvalidArgumentException("Route [{$name}] not defined.");
    }
 
    /**
     * Get the URL for a given route instance.
     *
     * @param  \Illuminate\Routing\Route  $route
     * @param  mixed  $parameters
     * @param  bool   $absolute
     * @return string
     *
     * @throws \Illuminate\Routing\Exceptions\UrlGenerationException
     */
    protected function toRoute($route, $parameters, $absolute)
    {
        return $this->routeUrl()->to(
            $route, $this->formatParameters($parameters), $absolute
        );
    }
 
    /**
Arguments
"Route [admin.slide.create] not defined. (View: C:\laragon\www\laracom\resources\views\admin\slides\index.blade.php)"

I have modified the gist. I am trying to access the admin pages for the slide properties.

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica , I have updated slideController, however i still get the following error;

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Class 'App\Http\Controllers\Admin\Slides\Controller' not found
C:\laragon\www\laracom\app\Http\Controllers\Admin\Slides\SlideController.php
<?php
 
namespace App\Http\Controllers\Admin\Slides;
 
 
use App\Shop\Slides\Slide;
use Illuminate\Http\Request;
 
class SlideController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    // index function
    public function index()
    {
        $Slides = Slide::orderby('id', 'desc')->paginate(10);
        return view('slides.index', compact('slides'));
    }
 
    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return  view ('admin.slides.create');
    }
 
    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
Arguments
"Class 'App\Http\Controllers\Admin\Slides\Controller' not found"

My model is Slide.php now

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica Not yet I haven't been able to make it work yet, I will create the gist, right now

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

@automica, Hope you're doing well?, So i noticed that I'am suppose to add some code in the sliderController public function update(UpdateSlideRequest $request, $id) { $slide = slide::find($id); $this->validate($request, array( 'title'=>'required|max:225', 'photo'=>'required|image' ));

but this line public function update(UpdateSlideRequest $request, $id) is throwing the error

syntax error, unexpected 'public' (T_PUBLIC)

Please boss any assistance or direction will be match appreciated

Oct
23
1 month ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

I saw the views/layouts/front/home-slider.blade.php However i did not see any controllers or models that makes it visible, also from the code in home-sider.blade.php I saw only a single banner there. However I want to be able to upload sliders from the admin panel so they can be visible at the front end. I should also be able to change the text for each slider. Kindly assist

Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

I can't seem to figure out how to make it work but the slider controller and all extra code in regards to slides or slider, I just added recently

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Hello @automica pardon me but i was trying to create sliders but got stuck midway, care to check for me full details here; https://laracasts.com/discuss/channels/laravel/creating-laravel-57-dynamic-sliders-in-laracom-ecommerce?page=1#reply=656632

Oct
22
1 month ago
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

Thanks

 public function update(Request $request, $id)
    {
        $slider = slider::find($id);
        $this->validate($request, array(
         'title'=>'required|max:225',
         'photo'=>'required|image'
      ));
Activity icon

Replied to Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

Thanks I have put the ethe brace there however my public function update(Request $request, $id){} has been highlighted with error syntax error, unexpected 'public' (T_PUBLIC) can you kindly assist? Thanks

Activity icon

Started a new Conversation Creating Laravel 5.7 Dynamic Sliders In Laracom Ecommerce

Hi i am trying to add dynamic sliders in Laracom Ecommerce package by @jsdecena on github. I have created all the necessary spaces but I am getting the following error, when I try accessing the project.test/admin/slides page;

Symfony\Component\Debug\Exception\FatalThrowableError thrown with message "syntax error, unexpected 'public' (T_PUBLIC)"

C:\laragon\www\laracom\app\Http\Controllers\Admin\slides\SliderController.php
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        {
            $slider = slider::findorfail($ID);
            return view('admin.slides.edit', compact('slider'));
    }
 
    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        $slider = slider::find($id);
       @$this->validate($request, array(
         'title'=>'required|max:225',
         'photo'=>'required|image'
      ));
 
       $slider = slider::where('id',$id)->first();
 
       $slider->title = $request->input('title');
 
       if ($request->hasfile('photo')) {
        $photo = $request->file('photo');
        $filename = 'slide' . '-' . time() . '.' . $photo->getclientoriginalextension();
        $location = public_path('images/');
        $request->file('photo')->move($location, $filename);
 
        $oldfilename = $slider->photo;
        $sliders->photo= $filename;
        IF(!EMPTY($slider->photo)){
Arguments
"syntax error, unexpected 'public' (T_PUBLIC)"

Below is my SlidersController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Shop\Slider\Slider;
use App\Shop\Categories\Requests\UpdateCategoryRequest;

class SliderController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    // index function
    public function index()
    {
        $sliders = Slider::orderby('id', 'desc')->paginate(10);
        return view('sliders.index', compact('sliders'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return  view ('admin.slides.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $this->validate($request, array(
            'title'=>'required|max:225',
            'photo'=>'required|image',
          ));
          $slider = new Slider;
          $slider->title = $request->input('title');
          if ($request->hasFile('photo')) {
            $photo = $request->file('photo');
            $filename = 'slide' . '-' . time() . '.' . $photo->getClientOriginalExtension();
            $location = public_path('images/');
            $request->file('photo')->move($location, $filename);

            $slider->photo = $filename;
          }
          $slider->save();
          return redirect()->route('admin.slides.index');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        {
            $slider = slider::findorfail($ID);
            return view('admin.slides.edit', compact('slider'));
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(UpdateSlideRequest $request, $id)
    {
        $slider = slider::find($id);
       @$this->validate($request, array(
         'title'=>'required|max:225',
         'photo'=>'required|image'
      ));

       $slider = slider::where('id',$id)->first();

       $slider->title = $request->input('title');

       if ($request->hasfile('photo')) {
        $photo = $request->file('photo');
        $filename = 'slide' . '-' . time() . '.' . $photo->getclientoriginalextension();
        $location = public_path('images/');
        $request->file('photo')->move($location, $filename);

        $oldfilename = $slider->photo;
        $sliders->photo= $filename;
        IF(!EMPTY($slider->photo)){
          storage::delete($oldfilename);
        }
      }

      $slider->save();

      return redirect()->route('slides.index',
          $slider->id)->with('success',
          'slider, '. $slider->style.' updated');
      }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        $slider = slider::findorfail($id);
        storage::delete($slider->photo);
        $slider->delete();
      
        return redirect()->route('admin.slides.index')
                ->with('success',
                 'Slide has been successfully deleted');
}

my slider model (slider.php)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Slider extends Model
{
    //
    protected $fillable = [
        'title', 'photo',
     ];
}

views/admin/slides/index.blade.php

<a href="{{ route('admin.slide.create') }}">Add New Slide</a>

<div style="margin-top:30px;">

@foreach($sliders as $slider)

    <
    <img src="{{url('images')}}/{{$slider->photo}}" alt="{{$slider->title}}" width="250" height="150">

<a href="{{ route('admin.slide.edit', $slider->id) }}" class="btn btn-block btn-info">Edit Slide</a>

{!! form::open(['method' => 'delete', 'route' => ['admin.slides.destroy', $slider->id] ]) !!}
  
  <button class="btn btn-block btn-danger" type="submit">Delete</button> 
{!! form::close() !!}

<br>

@endforeach
</div>

views/admin/create.blade.php

{{ Form::open(array('route' => 'slides.store', 'files' => true)) }}

  {{ Form::label('title', 'Title') }}

  {{ Form::text('title', null, array('class' => 'form-control')) }}


  {{ Form::label('photo', 'Photo') }}

  {{ Form::file('photo', array('class' => 'form-control')) }}


  {{ Form::submit('Add', array('class' => 'pull-right btn btn-primary')) }}

{{ Form::close() }}

views/admin/edit.blade.php;

{{ FORM::MODEL($SLIDER, ARRAY('ROUTE' => ARRAY('SLIDES.UPDATE', $SLIDER->ID), 'METHOD' => 'PUT', 'FILES' => TRUE)) }}

{{FORM::LABEL('TITLE', 'TITLE')}}
{{FORM::TEXT('TITLE', NULL, ARRAY('CLASS' => 'FORM-CONTROL'))}}
<BR>

{{FORM::LABEL('PHOTO', 'PHOTO')}}
{{FORM::FILE('PHOTO', ARRAY('CLASS' => 'FORM-CONTROL'))}}

<BR>
<IMG SRC="{{URL('IMAGES')}}/{{$SLIDER->PHOTO}}" ALT="IMAGE">

<BR><BR><BR>

{{ FORM::SUBMIT('UPDATE SLIDE', ARRAY('CLASS' => 'BTN BTN-SUCCESS')) }}

{{FORM::CLOSE()}}

Any assistance will be greatly appreciated. Thanks

Oct
21
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Okay, I will surely tag you.

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

okay, Thanks a lot. I will note that.

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

yeah earlier i was running the laracom there i put an opencart there recently. However to host the laravel i used a a structure like these

../myapp
	/app
	/
../public_html
	/css
	/js
	/img
	/vendor
	index.php

however am told its not advisable and also the system could not access my uploaded images.

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

ok

However I have found why I had the error, earliar while trying to solve the issue myself i called the @include('layouts.front.category-nav') in place of @include('layouts.front.home-slider') and that was giving me the error earlier. Am really sorry I disturbed you. But it's working fine now. I would be glad if you can assist me in hosting the project.

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

I get the error when I try visit the main url as in "laracom.test" so I presume that should be the index.blade.php page

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

I cross checked and recopied and pasted the code but the error persists, below is my globaltemplateserviceprovider code;

app/Providers/GlobalTemplateServiceProvider.php

<?php

namespace App\Providers;

use App\Shop\Carts\Repositories\CartRepository;
use App\Shop\Carts\ShoppingCart;
use App\Shop\Categories\Category;
use App\Shop\Categories\Repositories\CategoryRepository;
use App\Shop\Employees\Employee;
use App\Shop\Employees\Repositories\EmployeeRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;

/**
 * Class GlobalTemplateServiceProvider
 * @package App\Providers
 * @codeCoverageIgnore
 */
class GlobalTemplateServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function boot()
    {
        view()->composer([
            'layouts.admin.app',
            'layouts.admin.sidebar',
            'admin.shared.products'
        ], function ($view) {
            $view->with('admin', Auth::guard('employee')->user());
        });

        view()->composer(['layouts.front.app', 'front.categories.sidebar-category'], function ($view) {

            $view->with('categories', $this->getCategories());

            $view->with('rootCategories', $this->getRootCategories());

            $view->with('cartCount', $this->getCartCount());

        });

        /*
         * breadcrumbs
         */
        view()->composer([
            "layouts.admin.app"
        ], function ($view) {
            $breadcrumb = [
                ["name" => "Dashboard", "url" => route("admin.dashboard"), "icon" => "fa fa-dashboard"],
            ];

            $paths = request()->segments();
            if (count($paths) > 1) {
                foreach ($paths as $key => $pah) {
                    if ($key == 1)
                        $breadcumb[] = ["name" => ucfirst($pah), "url" => request()->getBaseUrl() . "/" . $paths[0] . "/" . $paths[$key], 'icon' => config("module.admin." . $pah . ".icon")];
                    elseif ($key == 2)
                        $breadcumb[] = ["name" => ucfirst($pah), "url" => request()->getBaseUrl() . "/" . $paths[0] . "/" . $paths[1] . "/" . $paths[$key], 'icon' => config("module.admin." . $pah . ".icon")];
                }
            }
            $view->with(
                [
                    "breadcumbs" => $breadcumb
                ]
            );
        });


        view()->composer(['layouts.front.category-nav'], function ($view) {
            $view->with('categories', $this->getCategories());
        });
    }

    /**
     * Get all the categories
     *
     */
    private function getCategories()
    {
        $categoryRepo = new CategoryRepository(new Category);
        return $categoryRepo->listCategories('name', 'asc', 1)->whereIn('parent_id', [1]);
    }

   /**
     * Get all the root categories
     * @return Collection
     */
    private function getRootCategories()
    {
        $categoryRepo = new CategoryRepository(new Category);

        return $categoryRepo->rootCategories();
    }

    /** 
     * @return int
     */
    private function getCartCount()
    {
        $cartRepo = new CartRepository(new ShoppingCart);
        return $cartRepo->countItems();
    }

    /**
     * @param Employee $employee
     * @return bool
     */
    private function isAdmin(Employee $employee)
    {
        $employeeRepo = new EmployeeRepository($employee);
        return $employeeRepo->hasRole('admin');
    }
}

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Hi so I followed your fix above and came across the following errors

ErrorException (E_ERROR)
Undefined variable: rootCategories (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php) (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php)
Previous exceptions
Undefined variable: rootCategories (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php) (0)
Undefined variable: rootCategories (0)
ErrorException thrown with message "Undefined variable: rootCategories (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php) (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php)"

Stacktrace:
#65 ErrorException in C:\laragon\www\laracom\storage\framework\views\b3d9023cdec816e7a088eb0630a2731da1490179.php:1
#64 Illuminate\View\Engines\CompilerEngine:handleViewException in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php:45
#63 Illuminate\View\Engines\CompilerEngine:handleViewException in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php:45
#62 ErrorException in C:\laragon\www\laracom\storage\framework\views\b3d9023cdec816e7a088eb0630a2731da1490179.php:1
#61 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in C:\laragon\www\laracom\storage\framework\views\b3d9023cdec816e7a088eb0630a2731da1490179.php:1
#60 include in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php:43
#59 Illuminate\View\Engines\PhpEngine:evaluatePath in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php:59
#58 Illuminate\View\Engines\CompilerEngine:get in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:142
#57 Illuminate\View\View:getContents in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:125
#56 Illuminate\View\View:renderContents in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:90
#55 Illuminate\View\View:render in C:\laragon\www\laracom\storage\framework\views97dd650a1661e3952c8200e4a3b4e7cf3f6be9.php:6
#54 include in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php:43
#53 Illuminate\View\Engines\PhpEngine:evaluatePath in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php:59
#52 Illuminate\View\Engines\CompilerEngine:get in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:142
#51 Illuminate\View\View:getContents in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:125
#50 Illuminate\View\View:renderContents in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\View.php:90
#49 Illuminate\View\View:render in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Http\Response.php:42
#48 Illuminate\Http\Response:setContent in C:\laragon\www\laracom\vendor\symfony\http-foundation\Response.php:205
#47 Symfony\Component\HttpFoundation\Response:__construct in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:750
#46 Illuminate\Routing\Router:toResponse in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:722
#45 Illuminate\Routing\Router:prepareResponse in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:682
#44 Illuminate\Routing\Router:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#43 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php:41
#42 Illuminate\Routing\Middleware\SubstituteBindings:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#40 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php:75
#39 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#37 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php:49
#36 Illuminate\View\Middleware\ShareErrorsFromSession:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#34 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php:63
#33 Illuminate\Session\Middleware\StartSession:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#31 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php:37
#30 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#29 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#28 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php:66
#27 Illuminate\Cookie\Middleware\EncryptCookies:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#26 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#25 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:104
#24 Illuminate\Pipeline\Pipeline:then in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:684
#23 Illuminate\Routing\Router:runRouteWithinStack in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:659
#22 Illuminate\Routing\Router:runRoute in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:625
#21 Illuminate\Routing\Router:dispatchToRoute in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Router.php:614
#20 Illuminate\Routing\Router:dispatch in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:176
#19 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
#18 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\fideloper\proxy\src\TrustProxies.php:57
#17 Fideloper\Proxy\TrustProxies:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#15 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:31
#14 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#12 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:31
#11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#9 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php:27
#8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#6 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php:62
#5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:163
#4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
#3 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:104
#2 Illuminate\Pipeline\Pipeline:then in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:151
#1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in C:\laragon\www\laracom\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:116
#0 Illuminate\Foundation\Http\Kernel:handle in C:\laragon\www\laracom\public\index.php:53
C:\laragon\www\laracom\storage\framework\views\b3d9023cdec816e7a088eb0630a2731da1490179.php
<?php $__currentLoopData = $rootCategories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $category): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <?php if($loop->first): ?>
        <ul class="list-unstyled list-inline nav navbar-nav">
            <?php endif; ?>
            <li>
                <?php if($category->children()->count() > 0): ?>
                      <?php echo $__env->make('layouts.front.category-sub', ['subs' => $category->children], \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>
                <?php else: ?>
                    <a <?php if(request()->segment(2) === $category->slug): ?> class="active"
                       <?php endif; ?> href="<?php echo e(route('front.category.slug', $category->slug)); ?>"><?php echo e($category->name); ?> </a>
                <?php endif; ?>
 
            </li>
            <?php if($loop->last): ?>
        </ul>
    <?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
Arguments
"Undefined variable: rootCategories (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php) (View: C:\laragon\www\laracom\resources\views\layouts\front\category-nav.blade.php) ◀"

Kindly assist me. Thanks in Advance

Oct
20
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

@automica, I totally agree with your suggestion, That's exactly how I will expect the top and side-menu to display. I'm very glad for your assistance.

Oct
19
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

@automica Hello so please using the script you gave me earliar the menu was visible but not styled. I wanted to know if the is a way I can let it replace the current menu options so as to move forward with this current system?

Oct
16
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

hello @automica , please did you find any solutions to the menu and category issue? the supporters at the laracom github page are late to respond.

Oct
14
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

@automica Okay sir Thanks a lot, I managed to add a simple payment system in laracom hence why i wanna use it. Your assistance will be much appreciated.

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Hello @automica , Thanks for your assistance so far anyway I've tried doing as you stated above but nothing happens. I also noticed that the code for the menus has already been implemented but they aren't working either.

Below are the file in relation to the pro;

../views/layouts/front/category-nav.blade.php

<ul class="list-unstyled list-inline nav navbar-nav">
    @foreach($categories as $category)
        <li>
            @if($category->children()->count() > 0)
                @include('layouts.front.category-sub', ['subs' => $category->children])
            @else
                <a @if(request()->segment(2) == $category->slug) class="active" @endif href="{{route('front.category.slug', $category->slug)}}">{{$category->name}} </a>
            @endif
        </li>
    @endforeach
</ul>

../views/layouts/front/category-sidebar-sub.blade.php

@foreach($subs as $sub)
    <a href="{{ route('front.category.slug', $category->slug) }}">{{ $category->name }}</a>
    <ul class="list-unstyled sidebar-category-sub">
        <li @if(request()->segment(2) == $sub->slug) class="active" @endif ><a href="{{ route('front.category.slug', $sub->slug) }}">{{ $sub->name }}</a></li>
    </ul>
@endforeach

views/layouts/front/category-sub.blade.php

<div class="dropdown">
    <a @if(request()->segment(2) == $category->slug) class="active" @endif href="{{route('front.category.slug', $category->slug)}}" class="dropdown-toggle" id="{{$category->slug}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{{$category->name}} <span class="caret"></span></a>
    <ul class="dropdown-menu" aria-labelledby="{{$category->slug}}">
        @foreach($subs as $sub)
            <li><a href="{{route('front.category.slug', $sub->slug)}}">{{$sub->name}}</a></li>
        @endforeach
    </ul>
</div>

views/layouts/front/header-cart.blade.php

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
    @include('layouts.front.category-nav')
    <ul class="nav navbar-nav navbar-right">
        @if(auth()->check())
            <li class="visible-xs"><a href="{{ route('accounts', ['tab' => 'profile']) }}"><i class="fa fa-home"></i> My Account</a></li>
            <li class="visible-xs"><a href="{{ route('logout') }}"><i class="fa fa-sign-out"></i> Logout</a></li>
        @else
            <li class="visible-xs"><a href="{{ route('login') }}"> <i class="fa fa-lock"></i> Login</a></li>
            <li class="visible-xs"><a href="{{ route('register') }}"> <i class="fa fa-sign-in"></i> Register</a></li>
        @endif
        <li id="cart" class="menubar-cart visible-xs">
            <a href="{{ route('cart.index') }}" title="View Cart" class="awemenu-icon menu-shopping-cart">
                <i class="fa fa-shopping-cart" aria-hidden="true"></i>
                <span class="cart-number">{{ $cartCount }}</span>
            </a>
        </li>
        <li>
            <!-- search form -->
            <form action="{{route('search.product')}}" method="GET" class="form-inline" style="margin: 15px 0 0;">
                <div class="input-group">
                    <input type="text" name="q" class="form-control" placeholder="Search..." value="{!! request()->input('q') !!}">
                    <span class="input-group-btn">
                        <button type="submit" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i> Search</button>
                    </span>
                </div>
            </form>
            <!-- /.search form -->
        </li>
    </ul>
</div><!-- /.navbar-collapse -->

../views/layouts/front/app.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id={{ env('GOOGLE_ANALYTICS') }}"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());

        gtag('config', '{{ env('GOOGLE_ANALYTICS') }}');
    </script>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{{ config('app.name') }}</title>
    <title>Kessela Cosmetics</title>
    <meta name="description" content="A Ghanaian Online Cosmetics Shop">
    <meta name="tags" content="modern, e-commerce, free, kessela, shopping, responsive, fast, Mtn, Money, storefront">
    <meta name="author" content="Tom Collins">
    <link href="{{ asset('css/style.min.css') }}" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="{{ asset('https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js')}}"></script>
    <script src="{{ asset('https://oss.maxcdn.com/respond/1.4.2/respond.min.js')}}"></script>
    <![endif]-->
    <link rel="apple-touch-icon" sizes="57x57" href="{{ asset('favicons/apple-icon-57x57.png')}}">
    <link rel="apple-touch-icon" sizes="60x60" href="{{ asset('favicons/apple-icon-60x60.png')}}">
    <link rel="apple-touch-icon" sizes="72x72" href="{{ asset('favicons/apple-icon-72x72.png')}}">
    <link rel="apple-touch-icon" sizes="76x76" href="{{ asset('favicons/apple-icon-76x76.png')}}">
    <link rel="apple-touch-icon" sizes="114x114" href="{{ asset('favicons/apple-icon-114x114.png')}}">
    <link rel="apple-touch-icon" sizes="120x120" href="{{ asset('favicons/apple-icon-120x120.png')}}">
    <link rel="apple-touch-icon" sizes="144x144" href="{{ asset('favicons/apple-icon-144x144.png')}}">
    <link rel="apple-touch-icon" sizes="152x152" href="{{ asset('favicons/apple-icon-152x152.png')}}">
    <link rel="apple-touch-icon" sizes="180x180" href="{{ asset('favicons/apple-icon-180x180.png')}}">
    <link rel="icon" type="image/png" sizes="192x192"  href="{{ asset('favicons/android-icon-192x192.png')}}">
    <link rel="icon" type="image/png" sizes="32x32" href="{{ asset('favicons/favicon-32x32.png')}}">
    <link rel="icon" type="image/png" sizes="96x96" href="{{ asset('favicons/favicon-96x96.png')}}">
    <link rel="icon" type="image/png" sizes="16x16" href="{{ asset('favicons/favicon-16x16.png')}}">
    <link rel="manifest" href="{{ asset('favicons/manifest.json')}}">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="{{ asset('favicons/ms-icon-144x144.png')}}">
    <meta name="theme-color" content="#ffffff">
    @yield('css')
    <meta property="og:url" content="{{ request()->url() }}"/>
    @yield('og')
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="{{ asset('https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js') }}"></script>
</head>
<body>
<noscript>
    <p class="alert alert-danger">
        You need to turn on your javascript. Some functionality will not work if this is disabled.
        <a href="https://www.enable-javascript.com/" target="_blank">Read more</a>
    </p>
</noscript>
<section>
    <div class="hidden-xs">
        <div class="container">
            <div class="clearfix"></div>
            <div class="pull-right">
                <ul class="nav navbar-nav navbar-right">
                    @if(auth()->check())
                        <li><a href="{{ route('accounts', ['tab' => 'profile']) }}"><i class="fa fa-home"></i> My Account</a></li>
                        <li><a href="{{ route('logout') }}"><i class="fa fa-sign-out"></i> Logout</a></li>
                    @else
                        <li><a href="{{ route('login') }}"> <i class="fa fa-lock"></i> Login</a></li>
                        <li><a href="{{ route('register') }}"> <i class="fa fa-sign-in"></i> Register</a></li>
                    @endif
                    <li id="cart" class="menubar-cart">
                        <a href="{{ route('cart.index') }}" title="View Cart" class="awemenu-icon menu-shopping-cart">
                            <i class="fa fa-shopping-cart" aria-hidden="true"></i>
                            <span class="cart-number">{{ $cartCount }}</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <header id="header-section">
        <nav class="navbar navbar-default">
            <div class="container">
                <!-- Brand and toggle get grouped for better mobile display -->
                <div class="navbar-header col-md-2">
                    <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="{{ route('home') }}">{{ config('app.name') }}</a>
                </div>
                <div class="col-md-10">
                    @include('layouts.front.header-cart')
                </div>
            </div>
        </nav>
    </header>
</section>
@yield('content')

@include('layouts.front.footer')

<script src="{{ asset('js/front.min.js') }}"></script>
<script src="{{ asset('js/custom.js') }}"></script>
@yield('js')
</body>
</html>

../views/front/index.blade.php

@extends('layouts.front.app')

@section('og')
    <meta property="og:type" content="home"/>
    <meta property="og:title" content="{{ config('app.name') }}"/>
    <meta property="og:description" content="{{ config('app.name') }}"/>
@endsection

@section('content')
    @include('layouts.front.home-slider')
    @if($cat1->products->isNotEmpty())
        <section class="new-product t100 home">
            <div class="container">
                <div class="section-title b50">
                    <h2>{{ $cat1->name }}</h2>
                </div>
                @include('front.products.product-list', ['products' => $cat1->products->where('status', 1)])
                <div id="browse-all-btn"> <a class="btn btn-default browse-all-btn" href="{{ route('front.category.slug', $cat1->slug) }}" role="button">browse all items</a></div>
            </div>
        </section>
    @endif
    <hr>
    @if($cat2->products->isNotEmpty())
        <div class="container">
            <div class="section-title b100">
                <h2>{{ $cat2->name }}</h2>
            </div>
            @include('front.products.product-list', ['products' => $cat2->products->where('status', 1)])
            <div id="browse-all-btn"> <a class="btn btn-default browse-all-btn" href="{{ route('front.category.slug', $cat2->slug) }}" role="button">browse all items</a></div>
        </div>
    @endif
    <hr />
    <[email protected]('mailchimp::mailchimp')-->
@endsection

../views/front/categories/category.blade.php

@extends('layouts.front.app')

@section('og')
    <meta property="og:type" content="category"/>
    <meta property="og:title" content="{{ $category->name }}"/>
    <meta property="og:description" content="{{ $category->description }}"/>
    @if(!is_null($category->cover))
        <meta property="og:image" content="{{ asset("storage/$category->cover") }}"/>
    @endif
@endsection

@section('content')
    <div class="container">
        <hr>
        <div class="row">
            <div class="category-top col-md-12">
                <h2>{{ $category->name }}</h2>
                {!! $category->description !!}
            </div>
        </div>
        <hr>
        <div class="col-md-3">
            @include('front.categories.sidebar-category')
        </div>
        <div class="col-md-9">
            <div class="row">
                <div class="category-image">
                    @if(isset($category->cover))
                        <img src="{{ asset("storage/$category->cover") }}" alt="{{ $category->name }}" class="img-responsive" />
                    @else
                        <img src="https://placehold.it/1200x200" alt="{{ $category->cover }}" class="img-responsive" />
                    @endif
                </div>
            </div>
            <hr>
            <div class="row">
                @include('front.products.product-list', ['products' => $products])
            </div>
        </div>
    </div>
@endsection

../views/front/categories/sidebar-category.blade.php

<ul class="nav sidebar-menu">
    @foreach($categories as $category)
        @if($category->children()->count() > 0)
            <li>@include('layouts.front.category-sidebar-sub', ['subs' => $category->children])</li>
        @else
            <li @if(request()->segment(2) == $category->slug) class="active" @endif><a href="{{ route('front.category.slug', $category->slug) }}">{{ $category->name }}</a></li>
        @endif
    @endforeach
</ul>

../app/http/controllers/front/HomeController.php

<?php

namespace App\Http\Controllers\Front;

use App\Shop\Categories\Repositories\Interfaces\CategoryRepositoryInterface;

class HomeController
{
    /**
     * @var CategoryRepositoryInterface
     */
    private $categoryRepo;

    /**
     * HomeController constructor.
     * @param CategoryRepositoryInterface $categoryRepository
     */
    public function __construct(CategoryRepositoryInterface $categoryRepository)
    {
        $this->categoryRepo = $categoryRepository;
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        $cat1 = $this->categoryRepo->findCategoryById(2);
        $cat2 = $this->categoryRepo->findCategoryById(3);

        return view('front.index', compact('cat1', 'cat2'));
    }
}

../app/http/controllers/front/CategoryController.php

<?php

namespace App\Http\Controllers\Front;

use App\Shop\Categories\Repositories\CategoryRepository;
use App\Shop\Categories\Repositories\Interfaces\CategoryRepositoryInterface;
use App\Http\Controllers\Controller;

class CategoryController extends Controller
{
    /**
     * @var CategoryRepositoryInterface
     */
    private $categoryRepo;

    /**
     * CategoryController constructor.
     *
     * @param CategoryRepositoryInterface $categoryRepository
     */
    public function __construct(CategoryRepositoryInterface $categoryRepository)
    {
        $this->categoryRepo = $categoryRepository;
    }

    /**
     * Find the category via the slug
     *
     * @param string $slug
     * @return \App\Shop\Categories\Category
     */
    public function getCategory(string $slug)
    {
        $category = $this->categoryRepo->findCategoryBySlug(['slug' => $slug]);

        $repo = new CategoryRepository($category);

        $products = $repo->findProducts()->where('status', 1)->all();

        return view('front.categories.category', [
            'category' => $category,
            'products' => $repo->paginateArrayResults($products, 20)
        ]);
    }
}

../app/Providers/GlobalTemplateServiceProvider.php

<?php

namespace App\Providers;

use App\Shop\Carts\Repositories\CartRepository;
use App\Shop\Carts\ShoppingCart;
use App\Shop\Categories\Category;
use App\Shop\Categories\Repositories\CategoryRepository;
use App\Shop\Employees\Employee;
use App\Shop\Employees\Repositories\EmployeeRepository;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;

/**
 * Class GlobalTemplateServiceProvider
 * @package App\Providers
 * @codeCoverageIgnore
 */
class GlobalTemplateServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function boot()
    {
        view()->composer([
            'layouts.admin.app',
            'layouts.admin.sidebar',
            'admin.shared.products'
        ], function ($view) {
            $view->with('admin', Auth::guard('employee')->user());
        });

        view()->composer(['layouts.front.app', 'front.categories.sidebar-category'], function ($view) {
            $view->with('categories', $this->getCategories());
            $view->with('cartCount', $this->getCartCount());
        });

        /**
         * breadcumb
         */
        view()->composer([
            "layouts.admin.app"
        ], function ($view) {
            $breadcumb = [
                ["name" => "Dashboard", "url" => route("admin.dashboard"), "icon" => "fa fa-dashboard"],
            ];
            $paths = request()->segments();
            if (count($paths) > 1) {
                foreach ($paths as $key => $pah) {
                    if ($key == 1)
                        $breadcumb[] = ["name" => ucfirst($pah), "url" => request()->getBaseUrl() . "/" . $paths[0] . "/" . $paths[$key], 'icon' => config("module.admin." . $pah . ".icon")];
                    elseif ($key == 2)
                        $breadcumb[] = ["name" => ucfirst($pah), "url" => request()->getBaseUrl() . "/" . $paths[0] . "/" . $paths[1] . "/" . $paths[$key], 'icon' => config("module.admin." . $pah . ".icon")];
                }
            }
            $view->with(
                [
                    "breadcumbs" => $breadcumb
                ]
            );
        });


        view()->composer(['layouts.front.category-nav'], function ($view) {
            $view->with('categories', $this->getCategories());
        });
    }

    /**
     * Get all the categories
     *
     */
    private function getCategories()
    {
        $categoryRepo = new CategoryRepository(new Category);
        return $categoryRepo->listCategories('name', 'asc', 1)->whereIn('parent_id', [1]);
    }

    /**
     * @return int
     */
    private function getCartCount()
    {
        $cartRepo = new CartRepository(new ShoppingCart);
        return $cartRepo->countItems();
    }

    /**
     * @param Employee $employee
     * @return bool
     */
    private function isAdmin(Employee $employee)
    {
        $employeeRepo = new EmployeeRepository($employee);
        return $employeeRepo->hasRole('admin');
    }
}

So observed the above files and notice that the menu is already imported however I can't find why neither functions are working. Please Assist. @automica, Stay Blessed. Thanks again

Oct
13
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

@automica Hi Thanks a lot the menu is now showing at the frontend however it the stylesheets aren't affect it also, by sidebar; I am referring to the sidebars on the left side of the category pages. it is also a call to all the categories. Thanks

Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Hi @automica I just did the changes but I am getting this error;

ErrorException (E_NOTICE) compact(): Undefined variable: categories

C:\laragon\www\laracom\app\Http\Controllers\Front\HomeController.php private $categoryRepo;

/**
 * HomeController constructor.
 * @param CategoryRepositoryInterface $categoryRepository
 */
public function __construct(CategoryRepositoryInterface $categoryRepository)
{
    $this->categoryRepo = $categoryRepository;
}

/**
 * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
 */
public function index()
{
    $cat1 = $this->categoryRepo->findCategoryById(2);
    $cat2 = $this->categoryRepo->findCategoryById(3);

    return view('front.index', compact('cat1', 'cat2','categories'));
}

}

Arguments "compact(): Undefined variable: categories"

any help please

Oct
11
1 month ago
Activity icon

Replied to Laracom Ecommerce, Routes And Menus

Hi, i searched every where and this is the only documentation I found https://shop.laracom.net/docs/1.4.6/overview, however I came across this instructions this instruction on https://gitter.im/larac0m/Lobby.

***Dalkyel @Dalkyel Mar 12 2019 01:07 Hello... I got a question... does the project have a sidebar category? if it does how can I make it visible? Thanks

Jeff Simons Decena @jsdecena Mar 12 2019 02:36 @Dalkyel you can do that. Just pass the categories from the controller to the view

Dalkyel @Dalkyel Mar 12 2019 14:09 thanks Jeff... it worked, now the problem is I don't know how to render de side bar.***

unfortunately the the above is about the sidebar. However I want to add both the main menu and sidebar too.

I can send my code if required.

Oct
10
1 month ago
Activity icon

Started a new Conversation Laracom Ecommerce, Routes And Menus

Hi i just installed laracom ecommerce (a laravel ecommerce web application), However i can't get the menu to appear in the frontend. here is my project https://www.kesselacosmetics.com. I'm told that i am suppose to pass a category route at to the frontend but i am quite new here. Any assistance is very much appreciated. Thanks in Advanced