david19

david19

Member Since 10 Months Ago

Experience Points
3,160
Total
Experience

1,840 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
8
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
3,160 XP
Mar
26
3 days ago
Activity icon

Replied to Blade @include Via Controller

For POST or any api requests :)

$myLayout1 = "@include('somelayout')";

In Blade 7 you have the same problem with

<x-mylayout />

Maby the only way for this, is Artisan calls.

Activity icon

Started a new Conversation Blade @include Via Controller

Hello Team. I try this,

public function index(){

    $test = "@include('test')";

    return view('welcome')->with('test',$test);
  }
{!!$test!!}

Laravel output this as a string in the blade file. Its not include the "test.blade.php".

Mar
11
2 weeks ago
Activity icon

Replied to Fetch Json In Config File

Hehe, no problem :)

I have a form. There i can update my values. But without database. After submit, i have a updated Json file. But for caching, i need this values in my config.php file. If i use one file for each component, that works fine!

'COMPONENT1' => fgets(fopen('myfile.txt','r')),

But i like save multiple components in a (text.file) or (json.file). I can save multiple Components in the same file, but i can not grap each component with "fgets". :(

Activity icon

Replied to Fetch Json In Config File

@jlrdw Many thanks for your help. This code which i writed is decoded in json. The problem is, fetch this in the config.php file. :(

I can not fetch a Item with file_get_contents. I mean i think...

Activity icon

Started a new Conversation Fetch Json In Config File

Hello Team. I have a Json File in my root folder.

I can see the json in the url:

http://localhost/myfile.json
{"component1":"dog","component2":"cat"}

Now i will use this components in my config file, but it doesnt work :( I dont know how i can fetch this components.

<?php

return [

    'COMPONENT1' => '?',
    'COMPONENT2' => '?',

];

Many thanks :)

Activity icon

Replied to How This Page Builder Works?

@braunson Many thanks. Do you mean json format in a database, or a json file in directory? But now i understand the approach :)

Activity icon

Started a new Conversation How This Page Builder Works?

Hello team. I have a question. All knows this pagebuilders , Elementor,GrapesJS and more..

How this builders save all the data for the page? In Database? Or they put a css file in the directory? Many thanks :)

Mar
03
3 weeks ago
Activity icon

Replied to UPDATE Data In The Config.php (no Database)

No, this app is only for my Applications. But i have more themes for testing, and i switch this on some days. All themes are in the public folder. I will try this solution which i posted before, maby it works.

Activity icon

Replied to UPDATE Data In The Config.php (no Database)

@sti3bas Yes, but not for the backend. I can not cache my backend. I can change my backend theme,too :)

BACKEND_THEME=mybackendtheme1
Activity icon

Replied to UPDATE Data In The Config.php (no Database)

@sinnbeck No, i like switch the theme for public,too :)

Activity icon

Replied to UPDATE Data In The Config.php (no Database)

I can change my "theme files" in my env file.

FRONTEND_THEME=mytheme1

That works! But i like a form, for update "mytheme1". But not via the database, because it will load on every refresh in the browser.

I like update this in the file without database. I found this solution, but maby better?

config(['YOUR-CONFIG.YOUR_KEY' => 'NEW_VALUE']);
$text = '<?php return ' . var_export(config('YOUR-CONFIG'), true) . ';';
file_put_contents(config_path('YOUR-CONFIG.php'), $text);
Activity icon

Started a new Conversation UPDATE Data In The Config.php (no Database)

Hello Team. I have a form. I would like update a #variable in the config/env file, not in Database. For this option, i should use the storage folder?

SOME_VARIABLE=test
'change me via a form' => [
'test' => env('SOME_VARIABLE')]
Jan
29
2 months ago
Activity icon

Started a new Conversation Forge And Mail Service As Developer

Hello Team. I like some ideas for mail service. Forge is very great tool, but you have allways the mail problem.

Some ideas:

  1. Create a Mail Server with Virtualmin. Its very easy, and free. I need 2 month for trusted my ip.
  2. Cpanel or plesk, same as virtualmin.
  3. Use external services Mailgun or other....

Some other ideas???

Jan
10
2 months ago
Activity icon

Started a new Conversation Laravel Package Add Button

Hello Team. I would like add a button with my composer package, in the view. (View of App).... I can make new views, but not elements :( There are a little trick?

Jan
07
2 months ago
Activity icon

Replied to Difference Between Websocket And VUEX

Because here in germany, the courses are really bad. I watch only courses in english on laracasts, youtube or udemy. I love this method for learning, and i get better and better with laravel. I posted over 30 questions in this forum, and i get allways nice answers, which put me to the right way :)

You need a basic knowhow on vuex and websockets. After that, you can choose your next step.

Activity icon

Started a new Conversation Difference Between Websocket And VUEX

I saw many courses with laravel websockets or vuex. You can create realtime apps with this.

You can create a realtime chat with a websocket or with Vuex. Vuex storeing the data in a container.

What is the better approach? I dont know this, because i am new in Vuex, and i am new for websockets :)

Activity icon

Started a new Conversation Laravel Forge Websocket For All Clients

Hello Team, simple Question:

  1. I will buy a extra server on digital ocean via forge. On this server i will install only the laravel websocket (beyondco).

  2. I will buy a second server for my projects. Can i use this websocket for all projects which stands on other server?

If yes, how difficult is that? Because then, i will use only pusher.com. Its not free, but very easy. And i can use for all projects.

Activity icon

Started a new Conversation Laravel Backend API + Multiple Clients

Example: Maby we are a Developer. We create a Laravel Backend API with Passport.

It would be nice, only 1 Laravel Backend for all clients. The Problem is the databases. Every Client need a extra database. All clients use the api, but a extra database. For the developer its great, because he create only 1 Laravel Backend API.

There are a easy simple way for that? Many thanks :)

Jan
06
2 months ago
Activity icon

Started a new Conversation Fastest Technique For Loadspeed And User Smoothness

Its not easy, find good informations. Maby some members here find a answere.

1. Standart: Laravel + Blade + Cache + CDN  Backend: "Laravel" Frontend: "Laravel" little vue or react or angular
2.  Laravel + Vue + Vuex + Vrouter + Cache + CDN  Backend: "Laravel" Frontend: "Vue,Vuex,Vrouter"
3. Laravel + Nuxt.js + CDN Backend: "Laravel Api with Passport or JWT" Frontend: "Nuxt only"

What is the fastest technique for Loadspeed and User smoothness? I know, this question is not easy, but we can all put our experience here.

Dec
16
3 months ago
Activity icon

Replied to Why Laravel + Vue

Many thanks for answers :) Okay i understand now.

Activity icon

Started a new Conversation Why Laravel + Vue

Hello Team,

On Youtube and Udemy i watch many videos with Laravel backend + Vue Frontend. It is becoming popular. The Vue Frontend use the backend laravel Api for show posts or something.

My question is, why this combination is popular? Why not use Laravel for frontend,too.? Or Laravel with a little bit vue as combination.

In the videos i saw "routes" with the VUE Routing. Thats nice but why? And can google all read the js.code? (googlebot). Thanks for answers :)

Dec
12
3 months ago
Activity icon

Replied to Package (add Lines On Default)

Thanks for your answere. I try a little trick now, but it doesnt work :(

I created a package with only controllers. Example: mypackage/src/Http/Controllers/LoginController

This Controller should extend the Login Controller from the Auth Package and add this function:

<?php


namespace Extrem16\Auth\Http\Controllers;


use App\Http\Controllers\Auth\LoginController;



class AuthExtrem16Controller extends LoginController

{
  public function showLoginForm()
  {

      return 'my package work';

  }
}
Dec
11
3 months ago
Activity icon

Started a new Conversation Package (add Lines On Default)

Hello team,

i will create packages. I can make views, controllers,models,routes. This works. But how i can add functions in views, which are default?

Example Package: Add this function in /app/Http/Controllers/Auth/LoginController

public function showLoginForm()
    {

        return view('vendor.mytheme.auth.login');
        
    }

For this function i can not create a extra controller, because its the default laravel auth package.

Dec
03
3 months ago
Activity icon

Replied to (PHP) After Unzip Redirect

Yes!! Many thanks Sinnbeck :D

Activity icon

Replied to (PHP) After Unzip Redirect

Sorry its not work :( Yes i can access the url manually.

<?php
$file = 'my-dev.zip';
$path = pathinfo(realpath($file), PATHINFO_DIRNAME);
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
  $zip->extractTo($path);
  $zip->close();
  
header("Location: http://localhost/install.php");

} else {
  echo "Die Datei $file konnte nicht gefunden/ge&ouml;ffnet werden.";
}
exit;
?>

I dont understand :(

Activity icon

Replied to (PHP) After Unzip Redirect

Its not work :( After unzip all files, stands on the current site :( Maby its the .htaccess?

RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/ [L]
Activity icon

Started a new Conversation (PHP) After Unzip Redirect

Hello Team. With this php, i will unzip my laravel folders. But after this, i will redirect to a other php file. The redirect doesnt work :(

<?php



$file = 'my-dev.zip'; //Dateiname entsprechend ´┐Żndern

$path = pathinfo(realpath($file), PATHINFO_DIRNAME);

$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
  $zip->extractTo($path);
  $zip->close();
  
header('/install.php');

} else {
  echo "Die Datei $file konnte nicht gefunden/ge&ouml;ffnet werden.";
}

exit;
?>
Dec
01
3 months ago
Activity icon

Replied to Git Init (not Found) On CMD Windows

Solved: I found gitbash :D

Activity icon

Started a new Conversation Git Init (not Found) On CMD Windows

Hello Team. I am a littlebit i'm confused :(

I will test laravel forge. All its fine. Setup the server and all works nice :) I made a fresh laravel app via composer on my windows10. Now i will put this new laravel app, to my git repository. If i type the first command:

git init

or

git status

My cmd on win10 doesnt found the commands. All tutorials which i see, its on mac or linux. My new Server on Forge works, but i can not push my laravel app to github :P

Nov
28
4 months ago
Activity icon

Started a new Conversation Chunk Collection With A @Include

Hello Team. I love the chunk method, for build a collection in the views. But now i have a @include, and i get error. I try use chunk in a card-deck.

<div class="card-deck">
@foreach ($product_categories as $product_category)
          <li>{{ $product_category->name }}</li>
          <ul>
          @foreach ($product_category->childrenCategories as $childCategory)
          @include('admin.shop.category.child_category', ['child_category' => $childCategory])
          @endforeach
          </ul>
          @endforeach
</div>

The problem is this @include file:

{{ $child_category->name }}
@if ($child_category->product_categories)
    <ul>
      @foreach ($child_category->product_categories as $childCategory)
          @include('admin.shop.category.child_category', ['child_category' => $childCategory])
      @endforeach
    </ul>
@endif
</div>
@foreach($product_categories->chunk(3) as $chunk)
@foreach ($chunk as $product_category)

Maby its not possible use chunk with @include :(

Activity icon

Replied to Dont Find The Right Query

@tisuchi Holy Shit, This works!!!!!!!!!!!!!!!!!!!!!

public function sub_categories($category_slug)
    {
$categories = Category::where('category_slug',$category_slug)->with('childrenCategories')->get();
return $categories;

    }
    
0   
id  20
created_at  "2019-11-28 05:32:53"
updated_at  "2019-11-28 05:32:53"
name    "Men"
parent_id   null
category_slug   "men"
description null
image   null
title   "Men"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
children_categories 
0   
id  22
created_at  "2019-11-28 05:34:25"
updated_at  "2019-11-28 05:34:25"
name    "Jeans"
parent_id   20
category_slug   "jeans"
description null
image   null
title   "Jeans"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
product_categories  
0   
id  24
created_at  "2019-11-28 05:37:31"
updated_at  "2019-11-28 05:37:31"
name    "Blue Jeans"
parent_id   22
category_slug   "blue-jeans"
description null
image   null
title   "Blue Jeans"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null

Soo many thanks :D

Activity icon

Started a new Conversation Dont Find The Right Query

Hello Team, sorry i need help again.

I have a categories table with unlimited subcategories.

ID##Name                ##Parent_ID          ##Category_slug
20##Men                 ##Null                     ##men
21##Women           ##Null                     ##women
22##Jeans               ##20                        ##jeans
23##Leggings        ##21                        ##jeans
24##Blue Jeans          ##22                        ##jeans
25##Red Leggings     ##23                        ##jeans

I made a route for the Shop View, which works fine :)

Route::get('/shop', 'Shop\Category\[email protected]_categories')
public function all_categories()
    {
      $categories = Category::whereNull('parent_id')->get();

      return $categories;
    }
0   
id  20
created_at  "2019-11-28 05:32:53"
updated_at  "2019-11-28 05:32:53"
name    "Men"
parent_id   null
category_slug   "men"
description null
image   null
title   "Men"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
1   
id  21
created_at  "2019-11-28 05:33:03"
updated_at  "2019-11-28 05:33:03"
name    "Women"
parent_id   null
category_slug   "women"
description null
image   null
title   "Women"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null

Now i will try get only the subcategories.

Route::get('/shop/{category_slug}', 'Shop\Category\[email protected]_categories')
public function sub_categories(Category $category_slug)
    {

      $categories = Category::whereNotNull('parent_id')->get();

      return $categories;

    }
I visit localhost/shop/men (or women)

But i get all subcategories :(

0   
id  22
created_at  "2019-11-28 05:34:25"
updated_at  "2019-11-28 05:34:25"
name    "Jeans"
parent_id   20
category_slug   "jeans"
description null
image   null
title   "Jeans"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
1   
id  23
created_at  "2019-11-28 05:34:54"
updated_at  "2019-11-28 05:34:54"
name    "Leggings"
parent_id   21
category_slug   "leggings"
description null
image   null
title   "Leggings"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
2   
id  24
created_at  "2019-11-28 05:37:31"
updated_at  "2019-11-28 05:37:31"
name    "Blue Jeans"
parent_id   22
category_slug   "blue-jeans"
description null
image   null
title   "Blue Jeans"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null
3   
id  25
created_at  "2019-11-28 05:37:45"
updated_at  "2019-11-28 05:37:45"
name    "Red Leggings"
parent_id   23
category_slug   "red-leggings"
description null
image   null
title   "Red Leggings"
alt_img null
canonical_org   null
canonical_new   null
robots  1
meta_description    null

The View if "men" should only show "Jeans". Sorry for the long text :(

Nov
27
4 months ago
Activity icon

Started a new Conversation Why @foreach Override My Textarea

Hello Team. I dont understand why PHP do that. Because i am a beginner. I have a Edit View with 2 Formgroups:

<div class="form-group">
          <div class="card bg-darkblue text-white border border-white">
          <div class="card-header bg-darkblue text-white">
          CHANGE PARENTCATEGORY?
          </div>
          <div class="card-body bg-darkblue text-white">
          <label for="exampleFormControlSelect1"></label>
          <select  name="parent_id" class="form-control bg-darkblue text-white" id="exampleFormControlSelect1">
          <option value="0">No</option>
          @foreach($product_categories as $product_category)
          <option value="{{$product_category->id}}">{{$product_category->name}}</option>

          @endforeach
          </select>
          </div>
          <div class="card-footer bg-darkblue text-white">
          </div>
          </div>
          </div>
<div class="form-group">
          <div class="card bg-darkblue text-white border border-white mt-5">
          <div class="card-header bg-darkblue text-white">
          CATEGORY DESCRIPTION
          </div>
          <div class="card-body bg-darkblue text-white">
          <textarea class="form-control" id="summernote" rows="3" name="description" value="{{$product_category->description}}">{{$product_category->description}}</textarea>
          <script>
          $('#summernote').summernote({
          placeholder: '',
          tabsize: 2,
          height: 100
          });
          </script>
          </div>
          <div class="card-footer bg-darkblue text-white">
          </div>
          </div>
          </div>

Why this foreach loop override my Textvalue in the Textarea? I closed the loop before, i dont understand. If i change the loop name:

@foreach($product_categories as $product_cat)
          <option value="{{$product_category->id}}">{{$product_cat->name}}</option>

          @endforeach

it will works, but then it will not save the parent category.

Nov
25
4 months ago
Activity icon

Replied to DoesntHave Query

@tisuchi Many thanks :D

Activity icon

Started a new Conversation DoesntHave Query

Hello Team.

I have a categorie Table with unlimted Subcategories

Id### Name###Parentid
1 ### Car ### Null
2 ###Bmw### 1
3 ###Ford###  1

When i go to my "EDIT" Page, i can choose my parent category. But the problem is, when i go to the "Ford" Edit Page, i can set "Ford" as Parent. But this is not correct. Ford can not a parent of Ford. Now i try to fix this, but i can not fix this. I need all categories which as not the "ID", which i edit. This is what i try now:

$category = category::find($id);
$categories = category::doesntHave('????')->get();
Nov
24
4 months ago
Activity icon

Started a new Conversation Laravel NodeJs After DEV

Hello Team, I have a question.

For compile styles i need npm. Example: I will add a bootstrap Root:Class Color. After that i compile this with NPM. All its good.

Now i will put my laravel on the live server. Should i unistall all NPM Files via composer? Or its that not necessary?

Activity icon

Started a new Conversation Very Much @include Performance?

Hello Team,

How much reduce includes the performance in blade files? I like this example here, because its much more readable and very clean. I mean put all cards via includes :)

@extends('layouts.app')
@section('inline-css')
<style></style>
@endsection
@section('main-css')
<link href="{{ asset('assets/css/bootstrap.min.css') }}" rel="stylesheet">
@endsection
@section('content')
<div class="container bg-light rounded text-white">
<div class="row">
@include('admin.layouts.sidebar')
<div class="col-xs-12 col-sm-12 col-md-10 col-lg-10 col-xl-10">
@include('card.1')
@include('card.2')
@include('card.3')
@include('card.4')
@include('card.5')
@include('card.6')
@include('card.7')
</div>
</div>
</div>
@endsection
@section('scripts')
<script src="{{ asset('assets/js/jquery-3.4.1.min.js') }}"></script>
<script src="{{ asset('assets/js/bootstrap.min.js') }}"></script>
@endsection
Nov
23
4 months ago
Activity icon

Replied to Radio Button Uncheck (best Way?)

@tray2 Yes, the checkbox are better, but checkbox allows multiple selects. Can you show me a example with <18 or >18 please?

Activity icon

Replied to Radio Button Uncheck (best Way?)

I found a very go way for me. I think its the best. Put this over the @foreach in the radio form:

<input type="radio" class="radio" name="parent_id" value="0" checked> No Parent Category

In the controller:

if($request->parent_id == 0)
      {
        $category->parent_id = NULL;
      }

Thats it! :D

Activity icon

Started a new Conversation Radio Button Uncheck (best Way?)

Hello Team, I use Laravel 6 with Bootstrap: I saw a new problem. I have Categories with Parent Categories. If i check a radio button, then i can not uncheck in my form.

Yes, i can make a standart category_base, and make a if statement and set parent_id to "NULL". But the problem is, in the future i loaded allways this category_base in my "foreach" blade files. I think that is not the best solution.

How you deal with this? Do you make this with javascript, all what is the best way? Many thanks.

Nov
21
4 months ago
Activity icon

Started a new Conversation Laravel Tutorial (Create A Installer)

There are any tutorial for create a installer for a laravel application? You know the installers of wordpress or october cms. Maby laracasts?? But i dont find a tutorial. There are a package on github, but this is only for the migrations.

Activity icon

Replied to Category_Slug For Subviews

I think this works:

 $categories = category::where('category_slug',$category_slug)->with('categories')->get();
Activity icon

Replied to Category_Slug For Subviews

Thanks Nakov, i know. But now i get only "cars" without Subcategories.

localhost/shop/cars
0   
id  1
name    "Cars"
parent_id   null
category_slug   "cars"
created_at  "2019-11-21 00:00:00"
updated_at  "2019-11-21 00:00:00"

But i need all subcategories in cars.

0   
id  2
name    "BMW"
parent_id   1
category_slug   "bmw"
created_at  "2019-11-21 00:00:00"
updated_at  "2019-11-21 00:00:00"
1   
id  3
name    "Ford"
parent_id   1
category_slug   "ford"
created_at  "2019-11-21 00:00:00"
updated_at  "2019-11-21 00:00:00"

That is the problem if i use RouteKeyName :(

Activity icon

Started a new Conversation Category_Slug For Subviews

Hello Team, sorry for the question again, but i tryed many hours before :)

ID 1: Cars = parent_id = NULL
ID 2: BMW = parent_id = 1
ID 3: Ford = parent_id =  1
ID 4: Bikes = parent_id = NULL
ID 5: Cross-Bike = parent_id = 4

With this Line i get all subcategories with the id.

public function subcategories($id)
    {
      $categories = category::where('parent_id',$id)->get();
      return $categories;

    }
localhost/shop/1
0   
id  2
name    "BMW"
parent_id   1
category_slug   "bmw"
created_at  "2019-11-21 00:00:00"
updated_at  "2019-11-21 00:00:00"
1   
id  3
name    "Ford"
parent_id   1
category_slug   "ford"
created_at  "2019-11-21 00:00:00"
updated_at  "2019-11-21 00:00:00"

Instead of ID, i like the category_slug "cars".

localhost/shop/cars
Route::get('/shop/{category_slug}', 'Shop\Product\[email protected]')
public function subcategories($category_slug)
    {
      $categories = category::where('parent_id',$category_slug)->get();
      return $categories;

    }

I get nothing :(

Activity icon

Replied to Query Show Sub-category

Yes that works. Many thanks! But when i go to localhost/shop/bikes, i get BMW and Ford, because i use parent_id = 1. I use RouteKeyName

Yes, i can make a new line for the Bikes, but it is possible in automatic? I can not make a new line for all Subviews :)

Activity icon

Started a new Conversation Query Show Sub-category

Hello Team,

ID 1: Cars = parent_id = NULL
ID 2: BMW = parent_id = 1
ID 3: Ford = parent_id =  1
ID 4: Bikes = parent_id = NULL
ID 5: Cross-Bike = parent_id = 4

I would like a view with only BMW and Ford. But i get allways with the Cross Bike :( Relationship Category Model

return $this->hasMany('App\Category', 'parent_id');
public function subcategories()
    {
      $categories = Category::where('parent_id')->???->get();
    }

Nov
19
4 months ago
Activity icon

Replied to URL With RouteKeyName And Eloquent

Ohh sorry Sinnbeck. Now it works!! I tryed before this:

Public function product( Category $category, Product $product, $id )

But the ID must stay on first place.

public function product($id, Category $category, Product $product)

Sinnbeck you are my men! Many thanks :D

Activity icon

Replied to URL With RouteKeyName And Eloquent

Yes, exactly! If i use this, i get the url witout view, because i need a Eloquent.