Code Monkey home page Code Monkey logo

Comments (2)

JeffreyWay avatar JeffreyWay commented on August 29, 2024

This is a non-issue. Both mean the same thing.

from laravel-4-generators.

codebyray avatar codebyray commented on August 29, 2024

While it may mean the same thing the first one will produce an error if you try and use it. Such as:

The below will only insert the VERY LAST entrty 'Classics' into the DB table not all:

$cartypes = array(
            'type' => 'Sedans',
            'type' => 'Coupes',
            'type' => 'Convertibles',
            'type' => 'Luxury Cars',
            'type' => 'Pickup Trucks',
            'type' => 'SUVs / Crossovers',
            'type' => 'Minivans / Vans',
            'type' => 'Green / Hybrids',
            'type' => 'Classics'

        );

This one will not insert anything. Which I figured it would not. Just produces an error:

$cartypes = array(
            'Sedans',
            'Coupes',
            'Convertibles',
            'Luxury Cars',
            'Pickup Trucks',
            'SUVs / Crossovers',
            'Minivans / Vans',
            'Green / Hybrids',
            'Classics'

        );

Produces the following error:

  [Exception]
  SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: insert into `cartypes` (`0`, `1`,
  `2`, `3`, `4`, `5`, `6`, `7`, `8`) values (?, ?, ?, ?, ?, ?, ?, ?, ?)) (Bindings: array (
    0 => 'Sedans',
    1 => 'Coupes',
    2 => 'Convertibles',
    3 => 'Luxury Cars',
    4 => 'Pickup Trucks',
    5 => 'SUVs / Crossovers',
    6 => 'Minivans / Vans',
    7 => 'Green / Hybrids',
    8 => 'Classics',
  ))



db:seed [--class[="..."]] [--database[="..."]]

Works properly.

$cartypes = [
            ['type' => 'Sedans'],
            ['type' => 'Coupes'],
            ['type' => 'Convertibles'],
            ['type' => 'Luxury Cars'],
            ['type' => 'Pickup Trucks'],
            ['type' => 'SUVs / Crossovers'],
            ['type' => 'Minivans / Vans'],
            ['type' => 'Green / Hybrids'],
            ['type' => 'Classics']  
        ];

They may be the same but they are not working the same. Please test it and you will see that it is not working as intended.

Regards,
Ray

from laravel-4-generators.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.