Member Since 8 Months Ago

Experience Points 1,940
Experience Level 1

3,060 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 9
Best Reply Awards 0
Best Reply
  • start-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-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-token Created with Sketch.


    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.


    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

28 Jan
6 months ago

davestead left a reply on Not Seeing How To Disable Caching Locally

@SNAPEY - Virtually? That can still mean you've had to or did run them. I've had to run php artisan config:cache for a few changes that wouldn't update, like running php artisan db:seed --class=WhateverTableSeeder (while following a tutorial).

So some things are cached and modifying or adding things will not refresh the cache so it has to be cleared to run properly (otherwise I get fatal errors).

I simply don't want these caches during development (until it becomes a performance issue), as there's a handful of cache-clearing commands, I'm not sure what exactly they clear nor when exactly I need to use them during development or deployment (on deployment I would love an automated solution so I don't have to run cache commands or wait for timers to run them).

25 Jan
6 months ago

davestead started a new conversation Not Seeing How To Disable Caching Locally

I'm just trying to develop and experiment with Laravel, but I keep having to running cache-clearing commands, and I'm not seeing either one command for all or a setting to just disable caching locally (or for a dev box).

16 Jan
7 months ago

davestead left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

@JLRDW - To put it simply: I want PHPStorm to follow Laravel code style on Laravel projects...

As stated, the closest Code Style predefined specification is PSR-1/PSR-2, which I've seen is not consistent with those PSRs nor Laravel's code style (whether buggy or design flaw, I don't know).

It appears I can define most of the styles manually but it appears to be missing some ability to do them.

Yes I can import some things built by some nice developers... and I'm still researching or trying that along with all of the other things I have to do for the project.

The issue is there's already commits in the project so I'm trying to minimize commits just for changing code styling (non-functional diff changes).

Anyways, the request was simple; I think I've gotten enough info to get (at least mostly) what I need, I just need to weigh how it will affect the project.

15 Jan
7 months ago

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

Here's how MySQL Workbench displays "schemas" - as the things that holds the tables:


If I expand a schema, it shows the tables; if I expand the tables, it shows the columns.


There's a button at the top that looks like a pancake stack (like the Sequel Pro app icon, which is also the icon for "database") to add a new schema:


So MySQL Workbench at least follows what I've learned in my career with other developers that a schema holds the tables (and can also refer to the table structures), and a database is merely supposed here to be a more general term that can refer to a server or the thing that holds the tables.

There's my clarification so I can refer to this permalink if someone gets confused on what I mean by database or schema.

14 Jan
7 months ago

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

Another example of "schemas" in MySQL as "the thing that holds the tables in the database":


I just installed MAMP and opened up the MySQL database viewer (phpMyAdmin), and it shows me the different "schemas", when I expand them, it shows their tables.

However, the "Database" tab has a "Create Database" form, making it ambiguous again (especially since it's in a database connection), but in MySQL Workbench, right-clicking in the "databases" list (the things that hold the tables) shows Create Schema, which then lets me create another one of the things that holds the tables (which then gives me an Alter Schema option when right-clicking that).

So yes I still think I'm OK calling the things that hold the tables "schemas" and expecting MySQL users (especially PHP coders, where MySQL is the most popular database technology to use with it) to know what I'm talking about.

Hopefully we can use this to minimize ambiguity, as too often people I'm seeing people mix up what they mean or think someone means by "database".

davestead left a reply on Should I Really Be Gitignoring The Vendor Folder?

@JLRDW - I know how the vendor folder works... if GitHub is down or not working for some reason, then nothing in the vendor folder from GitHub can be installed can they? I am going off Snapey's comments above in regards to that.

I know how composer works too... I'm not confused about how vendor or composer or GitHub works here. I'm not picking at anything.

The question is whether there may be a reason to not have vendor on gitignore... I gave some possible reasons, so did Snapey and Alex Bilbie... I recommend you read those again.

I know how to do backups; not everything you're saying here is common sense as has been explained previously. I'm afraid you may have misunderstood so I simply recommend reading the previous comments or considering them more carefully. I've gotten enough info from this thread anyways, thank you and goodbye.

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

@D9705996 - No reason to argue, I'm just trying to clarify with Laravel people what is meant by MySQL 'database' and 'schema' as a conversation got derailed by people not knowing what I meant when I was using MySQL/Oracle terminology...

I shouldn't have to clarify, but that's why this thread is here, to get an idea of what is actually thought of with these terms, but it seems there's resistance to using these terms the way MySQL/Oracle uses them.

In any case I'll continue to use them as MySQL/Oracle does, as it's perfectly clear to me (non-ambiguous), makes sense, and I will simply clarify if someone gets confused. Most developers in real life have known what I meant by at least "schema" when talking about MySQL; I think "database" is too synonymous with multiple things (like server or schema), but the MySQL/Oracle people do clarify in their tool dialogues, which I'm grateful for.

davestead left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

@CRONIX - I'm trying to follow Laravel's coding standard (style?) partly to have consistency among the app and our team... Laravel out of the box comes with a certain style (which should be PSR-2/4 as they state), and running make creates files that appear to follow that standard.

Our editors should not be creating inconsistencies that could cause unnecessary or automatic changes like spaces being changed to tabs or braces moving to different lines or things like this as they cause a history that may cause people going down unnecessary search holes or merge conflicts for stupid things like tabs/spaces/newlines...

I'm sure there's other reasons but bottom line is I'm just trying to get our editors to be code style consistent with Laravel so we're not being irritated or hampered by odd changes or fighting with the code unnecessarily; there's just no reason to go against the standard when it's already baked into Laravel and its generators.

davestead left a reply on Should I Really Be Gitignoring The Vendor Folder?

@SNAPEY - "... recommended committing vendor to git ..."

This is why I ask... most other projects I've worked on (with frameworks) just committed everything and did not put vendor(s) on ignore.

I understand their reasons but with a new project in Laravel, I'm not sure composer/git/Laravel is robust enough to not have to worry about vendor being on ignore.

The vendor folder is 57 megabytes whereas the rest of the laravel folder is less than 10... so that's a significant difference, but it might nice to see what actually changed in various composer updates or just have a hard version that can be installed from elsewhere.

Would it be worth making vendors a sub-module in git that we could make commits and push with after a composer install/update? Could that be automated? Or is that more work than it's worth?

11 Jan
7 months ago

davestead left a reply on Should I Really Be Gitignoring The Vendor Folder?

@CLICK - I don't understand what you mean by only start a new deployment... I can't continually start a new deployment on a live server after we've updated on our local computers.

I'll read the link, but if we run composer update on our local boxes (whenever?), commit the new composer.json / .lock files, why would we never run composer update on a prod server?

I'm just curious what you do in your situation. Right now we have multiple developers, a QA test box, and a Production box.

davestead left a reply on Should I Really Be Gitignoring The Vendor Folder?

Clarification: When trying out different 3rd-party repos, I want to try to not have a weird junked-up mess that's hard to manage, or have bugs/behavior only happen on certain boxes and not others because vendors is different across computers even though the repo files are the same.

davestead started a new conversation Should I Really Be Gitignoring The Vendor Folder?

I know it's recommended, but in the past (before composer), working with Zend Framework and the like, EVERYTHING was included (except certain temp or CMS files and folders), including any vendor folder.

This honestly this made versioning easy, in the sense that if we moved servers or had to reinstall on a prod/qa/dev computer, we didn't have to hunt down the correct versions, and allowed seeing easily what was actually changed there even when (gasp) customizing code in those folders (which I'm against anyways).

So, moving forward, on a team that's new to Laravel and composer, is composer really good enough when installing/uninstalling/updating/downgrading on prod/qa/dev environments, or is there too much risk in losing code or changes or time by ignoring all of this source code in the vendor folder and simply relying on composer to "make everything right" if something has to be reinstalled/reverted/updated?

EDIT: Here's an example of our current .gitignore file, tailored to Laravel Mac PHPStorm basically:


davestead left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

@CRONIX - The plugin is enabled... which I think is https://github.com/Haehnchen/idea-php-laravel-plugin

I think I saw https://github.com/barryvdh/laravel-ide-helper once, but it says it's for auto-completion, which I'm not sure is the same as code style... and I'm not seeing any mention of that in the Readme.

Are you sure those plugins make your code style PSR-2/4 compliant? Or what are you actually doing to make it compliant? I can deal with manually configuring it if I have to, but I think it will just take a long time and I'm not 100% familiar with all of the terminology (and I think it's missing some settings).

davestead left a reply on Not Seeing How To Get Laravel Code Style In PHPStorm

@S4MUEL - Thank you! I'll check that out.

davestead started a new conversation Not Seeing How To Get Laravel Code Style In PHPStorm

I've already brought this to the PHPStorm forum, and they either are having trouble figuring it out or the program's pre-defined styles aren't compliant or are buggy.

Laravel's documentation states: "Laravel follows the PSR-2 coding standard and the PSR-4 autoloading standard."


In PHPStorm > Preferences (Mac) > Editor > Code Style > PHP, there's nothing in there about Laravel, and I'm not finding where I could get this (I've already installed the Laravel Plugin), so I either have to manually configure it when I'm not familiar with all of the terminology (and it appears to be missing some necessary settings).

If I set Scheme to Project, then "Set from" to Predefined Style > PSR-1/PSR-2, it tosses function/for params on their own lines and separates parentheses on their own lines... it's not PSR-1/2 compliant and appears to be buggy.

Has someone made a Laravel 5.7 PSR-2/PSR-4-compliant code style configuration for PHPStorm? I'm using version 2018.3.2 right now, so if you've done this, please export it and attach it as a file somewhere so I can try this, or let me know how to make it compliant.

I'm really surprised nobody's made this automatically work in the most-popular PHP editor for the most-popular PHP framework.

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

@D9705996 - So you're saying MySQL and Oracle are wrong? Check this image again:


Notice where it says "browse your database schemas" and "work with database objects"...

In "browse your database schemas", what do you think is meant by "database" and "schemas"? Do you think "database" in that context refers to "the thing that contains the tables" or do you think "schemas" means that?

In "work with database objects", what do you think "database" and "objects" mean? The same thing as "database" in the previous statement?

Their intro also says "migrate schemas and data from other database vendors"... so what do you think "schemas" and "database" means in this context? They're obviously different things, and from every migration I've ever done or read about, you migrate the data in tables contained inside "the thing that contains the tables", which I've known specifically as "schemas" and generally synonymously (and incorrectly in my opinion) as "databases".

In MySQL's own context, "database" refers to "the thing that stores the schemas that you connect to with an IP/domain that is a server that is also a host for your data", and "schemas" refers to "the thing that contains your tables".

So I'm really curious how you can explain away MySQL's own usage of the terms "database" and "schema" just in the context of their own workbench intro...

10 Jan
7 months ago

davestead left a reply on Not Seeing How To Do Simple Code Blocks In Markdown Here

@JLRDW - That's the code block I was saying I was trying to avoid in code that's just a handful of lines (5 or less).

I think the issue I'm describing of each single-newline being removed is typical of GitHub-style markdown, so I'll just assume it's intended behavior... though I don't see why it's necessary, and it's definitely counter-intuitive.

davestead started a new conversation Impossible Newline Handling? Can't Do Just One Newline?

Can someone tell me why this forum strips the newline between lines when Shift+Enter is used, but does not strip any newlines at all when just Enter is hit or when Shift+Enter is hit twice in a row?


line 1 then Enter line 2 after Enter

line 3 after two Enters

line 4 after another two Enters

line 5 after two Enters but before one Shift+Enter line 6 after one Shift+Enter

line 7 after two Enters before two Shift+Enters

line 8 after two Shift+Enters

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

@D9705996 - "Schema is the content of you migrations that are used to build the tables, indexes, foreign keys, etc within the configured database."

OK, that's what I mean by schema when I'm talking about a table-containing "database" in MySQL.

In one of my posts people weren't sure what I meant when I said "schema", so that's what I meant, and I hope the Laravel community understands this the same way since that definition is coming from Laracasts.

MySQL database - server/host.

MySQL schema - table-containing "database"

davestead left a reply on Not Seeing How To Do Simple Code Blocks In Markdown Here

@JLRDW - My original post is talking about the GitHub-flavored code... please re-read what I wrote as raw text:


I simply want to be able to do

line 1



in this type of simple code line separated by 1 newline not 0 or 2.

08 Jan
7 months ago

davestead left a reply on Not Seeing How To Specify Dynamic MySQL Schema By Loaded Site

@JLRDW - OK, you said "Seek and ye shall find" so I thought you found the link on Google...

I did address your link above though, not sure if you saw my latest posts.

I will use the class or tenant solutions I've found if I can't find something simpler, I'm just surprised that the simpler solutions I did find aren't working where I try them, but again I don't know where they're supposed to go anyway.

07 Jan
7 months ago

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

@D9705996 - OK, so if a schema refers to the blueprint of a table-containing database, then doesn't that schema have a name? Like a database named client_info would have tables named users and addresses, and its schema would be the blueprint of the client_info table (its tables structure), wouldn't it still be less confusing to call it a schema instead of a database which can also refer to the host/server?

If I'm going off MySQL Workbench's description, a schema refers to a table-containing database regardless of its blueprint or structure.

Also, I was going through a Laravel issue I'm having, and found another reference to table-containing databases being called schemas:


*"If you don’t have it already, download and install SequelPro. Connect as root to your local MySQL server and create a new database name townhousedb.

Create a new user, townhouseadmin, and set the password as secret. Go to Global Privileges tab and click Check All button. Go to Schema Privileges tab and select townhousedb from schema list. Select all Available Privileges by hitting CMD+A keyboard shortcut and click < button to grant all the selected privileges. Finally, click Apply."*

At least in the MySQL world, it seems easier to call table-containing databases schemas... or at least understand what is being referred to when stating "schema" in relation to something containing tables and that doesn't make sense with it referring specifically to the host/server.

I'm really just trying to find a clear way to refer to what I'm talking about here without it causing confusion as it seems to be thought of a little differently here than elsewhere in my experience.

davestead left a reply on Your Understanding Of What A MySQL Schema Is?

@ADAMPRICKETT - If a schema refers to a table-containing DATABASE rather than a server/host database, why use the ambiguous "database" to refer to a table-containing schema?

davestead started a new conversation Your Understanding Of What A MySQL Schema Is?

I learned MySQL schema as the "database" that contains tables inside of the "database server" (which is the connection 'host' in PHP MySQL code), but there's seems to be multiple (mis?)understandings of what "schema" means as opposed to "database" (which is apparently already ambiguous).

So say I have a MySQL host named localhost, which contains multiple "databases" or "schemas" (made using CREATE DATABASE) that each have their own tables; I was taught and have generally heard that "schema" was the specific name for each of those "databases" inside of the "host/server database".

It can be confusing but some people know what I'm talking about when I say "schema", some don't, some people think I mean the server or the database/schema when I say "database"... there just seems to be a terminology issue, but I just discovered that MySQL Workbench (made by the MySQL/Oracle people) refers to each "DATABASE" inside of the server database as the "schemas":

https://imgur.com/PYascR5 (I don't know how to paste/attach a screenshot here)

So I'm going to fall back to the MySQL people and consider a "schema" to mean an individual DATABASE (that contains tables) inside of the database host/server; but I'm curious what you think or how you use the terminology, and maybe there needs to be clarification.

davestead left a reply on Not Seeing How To Specify Dynamic MySQL Schema By Loaded Site

@JLRDW - I already did search for a bunch of solutions that I tried, none of which has worked for our particular situation yet; that's why I posted here. I apparently didn't happen to use the same keywords as you did when you found that, but thanks for posting it.

JeffP's original post has some broken English in it, but I think when he says "database2" he's referring to what I'm calling a "schema"; yes I know the CREATE statement uses DATABASE, but all of our DATABASEs are in our MySQL database (host? that has its own IP), and those DATABASEs are what I'm calling "schemas", named like BOB_Data or "meta_info". The reason I'm using "schema" is because that's the terminology I've heard used for "databases" inside of the "server database" (I should probably call this the 'host')... so I don't know how to better reduce ambiguity or confusion there.

So, we have the MySQL server database (host) with its own IP that all schemas/databases are in, like:

'host' => env('DB_HOST', ''),
'database' => env('DB_DATABASE', 'forge') . '_Data', // like BOB_Data

So, I have one default client "database" like DEF_Data in the env file (just for sandbox/local testing or in case something goes wrong, it won't release sensitive client data to the wrong people), and then the Laravel source code needs to do a SELECT of the requesting domain through the 'meta_info' database to the table client_info and return the client code (like BOB), then change the 'database' value in the 'restaurant' connection to BOB_Data to use with the Client models...

My problem is I just don't know where to put the running code to change the client 'restaurant.database' value once the client code is selected... JeffP's solution link - https://lukevers.com/2015/03/25/on-the-fly-database-connections-with-laravel-5 - looks fine but it doesn't state where to put the running code (like he's got at the bottom of the article)! I can put this in each client model but that seems like a pain... I was hoping to have one place to put this for all client models.

davestead left a reply on Not Seeing How To Specify Dynamic MySQL Schema By Loaded Site

@D9705996 - A MySQL database can have multiple schemas (often people only use one schema and call that the "database"), and we have a schema for each client site, so like site Bob's Burgers has code BOB so will have the schema BOB_Data with their data, and the tables in each client scheme have the same structure (but unique data). Does that make sense?

I did share some example code (highlighted in red), and because I don't know how to code this properly in Laravel, I'm not sure what other example code to share. Our current (legacy) code is really just overly-complicated (and proprietary), so I can't share that, but it basically connects to the DB (which has all these schemas), selects the "parent" schema named like "meta_info" which contains all the client site URLs and site codes (among other things), then will need to make a separate connection for the client site schema (like BOB_Data) to manage all that data.

I know how to handle all of this in PHP but not Laravel... right now I'm creating models in an app/Models/[Schema] folder (like app/Models/MetaInfo or app/Models/Client), but I don't know where to put the connective tissue for the meta/client schemas. It would be nice to either specify the pre-defined connection name (like restaurant) for each of the Client model files (or preferably in one place that they would all automatically use once the client code has been set).

So, it's hard to explain, but maybe I can leave example code here:


        'restaurant' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', ''),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge') . '_Data',
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,

I've been trying to find a place to put the code to check the URL -> fetch the client code from the meta_info schema -> then replace the 'database' value so it's like BOB_Data... I don't know if I'm taking the best approach here or where to put that code (the various places I've tried didn't work or had fatal errors, like with Config::set or config('database.restuarant.database')).

04 Jan
7 months ago

davestead left a reply on Created_at But No Updated_at Column

@SHEZ1983 - That does the same thing as daniyum21's answer of public function getCreatedAtAttribute?

davestead started a new conversation Not Seeing How To Do Simple Code Blocks In Markdown Here

I noticed I could do a simple code block (with GitHub-type markdown) like this:

$var = 'whatever';

But if I wanted to do two or more lines, that would strip the newlines out, putting them all onto one line like this:

$var2 = 'whatever2'; $var3 = 'whatever3';

If I separate each line with two newlines, it doesn't strip out the newlines:

$var2 = 'whatever2';

$var3 = 'whatever3';

If I put them inside a block wrapped in three ticks, it separated the lines but made this giant colorful block that's a bit much for small chunks:

$var = 'whatever';
$var2 = 'whatever2';
$var3 = 'whatever3';

I'm not seeing how to just show the simple inline code formatting with just a few lines that doesn't show too few or too many newlines! Is this possible?!

davestead started a new conversation Not Seeing How To Specify Dynamic MySQL Schema By Loaded Site

We have dozens of client sites that use various schemas in our database, but each one of them has their own specific schema where the first several characters of the schema name is an alphanumeric code of their name. Those models would contain:

protected $connection = 'restaurant'; // using schema BOB_Data

So like if client named bobsburgers is loaded, it will first go a schema like 'codenames', fetch the code name BOB based on the domain, then select schema BOB_Data and use that as the primary (default?) schema for all models etc (there should be no cross-pollution) but still be able to select from the other statically-named schemas (which I've set up as separate connections in config/database.php and will be specified in their related models).

I'm seeing a bunch of various "solutions" online but they don't specify where to put them and they cause fatal errors when I try them in various files (like bootstrap/app.php) that seem correct (like using Config::whatever or config(whatever))... so I'm at a loss with our odd (but probably not unusual) situation.

davestead left a reply on Using Table Prefixes In Laravel?

@PMALL - That's not helpful; we need a dynamic schema name prefix or some other solution for our database, based on client site.

You don't state why prefix is useless.

We're using Laravel 5.7 and I'm new to Laravel.

02 Jan
7 months ago

davestead left a reply on Created_at But No Updated_at Column

I guess I should have specified that adding/updating the columns isn't feasible right now due to our database structure and the amount of code changes in our legacy code that that would require.

What I'm trying to figure out (without having to go through too much of Laravel's code/libraries) is just how to get Laravel to work with our existing database schemas where maybe one or more table has created_at and/or updated_at but the majority either do not have these columns or they're not named that way or they aren't in the format Laravel expects...

I'd like to be able to write custom code in my models to handle "best-of" scenarios, like being able to specify which column is created_at or updated_at, or whether either of those just don't exist (so that it won't try to insert/update one or both of them), and be able to specify the data format if it's not the expected one.

I know I can specify the column names, like:

const CREATED_AT = 'created_date';
const UPDATED_AT = 'modified_at';

or just disable timestamps like:

public $timestamps = false;

But I'm not finding yet how to say just "disable created_at" or "disable updated_at" or "make created_at this data format" or "make updated_at this format" etc.

28 Dec
7 months ago

davestead started a new conversation Created_at But No Updated_at Column

So I'm trying to get Laravel to work with our old ginormous MySQL 5 database created by multiple developers over time, and some of our tables have created/updated columns of varying datatype formats (DATE, DATETIME, TIMESTAMP, INT Linux timestamp, etc), some columns are named created_at, some updated_at, some other things (like date_created)...

I'm seeing how to disable timestamp handling, but not how to customize it per table... I would like to specify in each model what the custom column name is, which one it's for, whether to ignore one or the other, and preferably the format if it's not Laravel's default.

26 Dec
7 months ago

davestead left a reply on OK So Tabs Have Been Outlawed...

Oh look, Dmitry of PHPStorm got it immediately, stated it wasn't available, and gave me a link to submit a feature request:


So I am switching to 4-space indents per latest Laravel standard, and will subsequently deal with the pain in the a$% that is 4-space indent navigation with arrow keys and missed mouse clicks or having to hit Home (which is still not as easy as left/right arrow and far more prone to mistake or me having to look at the keyboard after hitting up/down).

It really is a simple suggestion (to have an editor option to have indents behave as tabs but save as spaces), but maybe we're not ready for that yet.

21 Dec
7 months ago

davestead left a reply on OK So Tabs Have Been Outlawed...

Alright, I guess my point was missed; editors that would treat indents as tabs while editing but save as spaces would simply end the tabs vs spaces war. It means the primary reason spaces are bothersome becomes moot because they behave like tabs in the editor, and the spaces standard is upheld by the file saving the indents as spaces.

The other solutions suggested are still more work than editors just having a new option as a standard; disagree? I haven't often seen developers argue against an editor option in their favor... but if you want to please be my guest.

So to say the issue doesn't matter and nobody wants it blatantly untrue because people are still irritated at having to navigate around spaces with the arrow keys and the inaccuracy or extra clicks of the mouse missing the end or beginning of the indent.

I don't know how many times I've seen people in videos miss the beginning or end of the indent with a mouse click, or multi-tap arrow keys to get to the beginning or end of an indent, when this doesn't happen when the character is a tab... again, if the indent behaved like a tab character while editing but saved as standard spaces, it solves the irritations of using spaces or tabs.

I'm really surprised anyone thinks these have not been irritations or are irrelevant when the irritations are still continuously brought up. The editor option I described (that they should all have) would actually make these irritations moot.

davestead left a reply on OK So Tabs Have Been Outlawed...

@JLRDW - @jlrdw So, that's the same setting as @d9705996 stated... it just makes tabs generate 4 spaces... you still navigate around them with the keyboard and mouse as spaces, not as indents.

Again, I've yet to find an editor that allows treating indents as one solid block with the keyboard and mouse (whether 4 spaces or 2 spaces), as opposed to just x-number of spaces per tab indent.

See the difference?

davestead left a reply on OK So Tabs Have Been Outlawed...

@MARKLL - @markll Yes, I think you do understand the predicament, though I'm not sure what you mean by turning off the visual display of special characters... spaces aren't special characters, and I actually want to see special characters (like @ or # or $ etc).

The issue is not really solved with the Home key... yes it will take me to the beginning of the line or text, but if I'm navigating the code with up/down and I just want to go over by one tab (like when going to a line that is inside a block), the home key is still more work.

So saying "change is inevitable"... not sure what you mean there. Again, the editors could solve the tabs vs spaces war just by having an option to have x-space indents behave as tabs in the editor but save as spaces, so really, the change that should be inevitable is the editors evolving to support this behavior (I see no reason why they shouldn't).

davestead left a reply on OK So Tabs Have Been Outlawed...

@D9705996 - @d9705996 All of those VS Code settings you specify are already the default in my VS Code, and they don't do what I'm describing; all they do is set the Tab size to 4 spaces, have tabs generate 4 spaces, and then make it so the editor can automatically detect an "indent"...

But no matter what is set there, an indent is treated as spaces while editing... meaning using the arrow keys makes the cursor move between each space not each indent, and clicking between the beginning and end of the indent puts the cursor at the beginning of one of the spaces, not at either end of the indent.

The whole point is to not have to navigate through all those spaces and have each indent behave like a tab but save as a space...

I just tested this in new files in a new project in VS Code with different variations of the settings you specified, and they don't do what I've been describing... so I've yet to find any editor that treats indents sanely.

Here's the actual descriptions of those settings (they don't even describe that they will treat indents like tabs but save them as spaces):

// The number of spaces a tab is equal to. This setting is overridden based on the file contents when editor.detectIndentation is on. "editor.tabSize": 4,

// Insert spaces when pressing Tab. This setting is overridden based on the file contents when editor.detectIndentation is on. "editor.insertSpaces": true,

// Controls whether editor.tabSize# and #editor.insertSpaces will be automatically detected when a file is opened based on the file contents. "editor.detectIndentation": true,

20 Dec
7 months ago

davestead left a reply on OK So Tabs Have Been Outlawed...

@d9705996 The question was never tabs vs spaces, nor how to use my editor, as PHPStorm doesn't have the option to treat 4-space indents as a tab while editing but save as spaces... all it does is let me set whether a tab converts into spaces and how many.

.editorconfig only sets the indent type, and if tab, how many spaces that tab will occupy; that matches every editor I've used, and is not the same as an editor treating an x-space indent (even if generated by the Tab key) like a tab while editing... no editor I've used does that nor have I seen a setting for that. If you've seen that, please, post a screenshot.

If you notice from my original post, I'm already past accepting Laravel's PSR-2 standard of space indents... that's not the issue. The issue is that working with spaces is a pain in the arse and I simply want an editor to treat x-space indents as tabs while editing but save the indents as x spaces (per the settings specification).

I'm honestly baffled how few people understand the desire for this or even any explanation. I'd think this would be a #1 convenience for people disliking working with space indents, as it conforms to the formatting standard and solves the inconvenience issue.

davestead left a reply on OK So Tabs Have Been Outlawed...

@shez1983 When working with tab indents, navigating with arrow keys and mouseclick becomes easy. When I have to deal with spaces, moving the cursor around becomes a giant pain. Maybe not everyone can understand this.

@d9705996 The main issue here is not how git will handle anything... as I said, I'd like the editor to save indents as spaces to the file, but while editing have my cursor/arrow key/mouseclick behave as if the 4- (or 2)-space indents are 1 tab. Not sure that anyone is understanding this yet.

This means if my indents are set as 4 spaces, they will save that way, and a group of 4 spaces will behave in the editor as a tab, which requires only one tap of the left- or right-arrow key to go from the beginning to the end of the indent (or vice versa), and clicking in between the first and last space will put the character at the beginning or end of the group based on which one the mouse cursor is closest to...

This also would mean if I hit the Tab key, it will add 4 spaces (and save that way) yet still behave in the editor as if those 4 spaces were 1 Tab.

davestead left a reply on OK So Tabs Have Been Outlawed...

@shez1983 @cronix didn't understand my post. Every IDE (and most text editors) I've used allow me to switch indenting between a tab of x spaces or just use spaces. That's not the issue.

What I haven't seen yet is for me to set 4-space tab indents which are saved as 4 spaces in the file but treated like tabs while editing the file so that the arrow keys and mouse clicks act as if there is a tab there even though there is actually 4 spaces there. This is a matter of MAJOR convenience, as it's generally a pain in the butt to navigate indents using arrow/mouse buttons (as I either have to hit the keys a lot or be very accurate with the mouse click).

@jlrdw If you're saying NetBeans does this, I'm not seeing the setting for it.

19 Dec
8 months ago

davestead started a new conversation OK So Tabs Have Been Outlawed...

Yet I still haven't found an editor that will treat 4-space indents as if they are a tab to my keyboard keys (arrows) or mouse clicks while still saving the indents as spaces...

If I can think of how to code the logic for this, so can editor coders.

So am I still dreaming or does any editor do this already to make working with space indents not a pain in the a$S?

13 Dec
8 months ago

davestead started a new conversation Why Is A Function Necessary In Route::get?

I'm watching Laracasts, Laravel from Scratch, and the narrator shows the call in routes/web.php, as:

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

What I'm not understanding is why a function was determined to be the best thing to be in the 2nd param, as opposed to just specifying a view string.

My PHPStorm editor can't find the get function, or the Route class for some reason when I hover over or Ctrl+click them.

29 Nov
8 months ago

davestead left a reply on Laravel New Files Missing Index.html, Index.php, And .htaccess

@LOSTDREAMER_NL - Do you use the reverse proxy for anything? I'm not sure that's useful for Laravel or API hosting.

28 Nov
8 months ago

davestead left a reply on Laravel New Files Missing Index.html, Index.php, And .htaccess

@LOSTDREAMER_NL - Yes, I know .htaccess is only for Apache, thanks, though I'm not sure I should install an extension for nginx to use it.

Can you tell me if you've had experience with both Apache and NGinx with Laravel (not together of course), and which you prefer?

davestead left a reply on Laravel New Files Missing Index.html, Index.php, And .htaccess

OK I guess I didn't get far enough in the documentation to see that index.php is run from the Laravel install's public folder (which I see also has the .htaccess file), which I do see in the homestead app and my own generated test app. I'm a little old-school and new to vagrant and nginx, so thanks for your patience!

27 Nov
8 months ago

davestead started a new conversation Laravel New Files Missing Index.html, Index.php, And .htaccess

Everything I'm reading is saying I need at least one of these files for the server to run... so I'm not seeing how the server ends up running any of the Laravel code.

I'm on Mac OS Sierra with PHP v7.2 and httpd (Apache) 2.4 (no evidence of nginx anywhere, though I am running a homestead vagrant server in its own folder, and php artisan serve works fine even without homestead).

davestead left a reply on Confused On Laravel And/or Homestead Pathing...

OK I discovered the issue... the folders map path just needed to match exactly the folder created by laravel new whatever... one of the tutorials implied that it should point to the "projects" parent folder and then the sub-folders should be named after the site.

Anyways, I've been through a lot of tutorials for various technologies but the Laravel/Homestead docs I think should clarify where to run each command and when, because in several places the context is lost or ambiguous.

davestead left a reply on Confused On Laravel And/or Homestead Pathing...

I was going through Laracasts and ran php artisan serve in the ~/Development/PHP/Laravel/Homestead/Projects/homestead.test folder and it said 'Laravel development server started:' and when I went to in the browser, it showed the expected Laravel page...

Why homestead.test is saying "No input file specified" after vagrant up is run, I don't know.

Just for clarity, my homestead vagrant folder is ~/Development/PHP/Laravel/Homestead/homestead

davestead left a reply on Confused On Laravel And/or Homestead Pathing...

I already have PHP on my Mac as 5.x, but I had to use brew install php to update it to PHP 7 to get composer laravel commands to work...

The Homestead.yaml is (this forum removes a bunch of indentation and newlines for some reason):

ip: "" memory: 2048 cpus: 1 provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys: - ~/.ssh/id_rsa

folders: - map: ~/Development/PHP/Laravel/Homestead/Projects to: /home/vagrant/code

sites: - map: homestead.test to: /home/vagrant/code/public

databases: - homestead

I ran laravel new Laravel in Projects, then changed its name to homestead.test... which still just gave "No input file found" even after running vagrant halt and vagrant up --provision in the homestead folder (which is under the Homestead folder).

I noticed the homestead.test/.env file said APP_NAME="Laravel", so rather than tweak with that I just deleted the homestead.test folder and reran laravel new homestead.test but it gives me an error In NewCommand.php line 99: Application already exists!

So now I'm going down this path... the documentation really seems like it was not written for someone to follow step by step from Homestead to Laravel setup, but by separate people at separate times with a lot of assumptions on the user or the user's environment. I've gone through 3 tutorials so far and even they missed some crucial step in different places.