Support the ongoing development of Laravel.io →
Configuration Input Eloquent
Last updated 2 years ago.
0

You set the timestamps property to false like you would any regular php class property, so I'd suggest you learn PHP OOP basics first if you haven't already. You can change your primary key and disable timestamps updates like so:

<?php

class Branch extends Eloquent {
    protected $table = 'setBranch';
    protected $primaryKey = 'your_primary_id';
    protected $timestamps = false;
}

And sorry to be that guy again (for the 4th time today), but you can really just google this stuff and there are usually answers on SO or the old laravel forums:

click on second result: https://www.google.com/search?q=eloquent+set+primary+key

click on third result: https://www.google.com/search?q=laravel+disable+timestamps

Last updated 2 years ago.
0

I find it hard to learn starting from the basics, and I prefer asking in the forums hoping someone will explain in a simple and newbie friendly and if it is against the rules in this forums to ask such questions then I won't do it again.

<?php class Branch extends Eloquent { protected $table = 'setBranch'; protected $primaryKey = 'your_primary_id'; protected $timestamps = false; } i tried the protected $timestamps = false; it gave me the error "Access level to Branch::$timestamps must be public", changed protected to public. it worked
Last updated 2 years ago.
0

It's not against the rules, but a quick look into the docs would have given you the answers: http://laravel.com/docs/eloquent#basic-usage http://laravel.com/docs/eloquent#timestamps

You could've had your answers a lot faster than waiting for someone to reply to your topic here and for something this obvious people might ask themselves why they should invest the time to answer if you can't be bothered to do a little research first.

Last updated 2 years ago.
0

There are things that other people think it's pretty obvious but for others it's like a wild mystery to them. I refer to the forums because sometimes there are people who will explain it in their own way which I may find it more understandable to me, depending on the techniques and terms used. I'm a kind of guy who easily gets lost in documentations and find it hard to understand documentations even in plain simple English :D

I'm sure some people here who was having a hard time on a problem in which they believe it is very hard but later on solved his problem because he searched Google and found an obvious/newbie questions like mine. The more posts like this the more Google results/solutions will show up in the future for other people to choose which is the best for them.

If it is not against the rules in the forums then I will continue to ask questions like this, this is my first time to use a php framework and I'm really determined to learn Laravel whatever it takes.

Last updated 2 years ago.
0

Of course it's not against the rules to ask questions - but you have to remember the people who reply are doing so in their own time and we can be a bit miffed if people don't appear to have had a go at researching first, especially if it's covered in the documentation.

As has been mentioned - the answers to both your questions were already quite high in Google results.

Last updated 2 years ago.
0

I just can't explain myself here. I said earlier I prefer using the forums and I easily get lost in the documentations due to the terms and techniques used that I'm not still able to understand. But people keeps on telling the same thing over and over again.

Last updated 2 years ago.
0

I know you know what works for you best, and I was happy to answer (even without a thank you from your end :) ), but in this situation there were already top google results for both of your questions by just throwing in rough keywords.

  1. I think many people, including myself, would agree that your method is the easiest --- but when it comes to truly learning something at its core, sometimes it really is best to struggle to find the answer. It's the process of bettering yourself as a developer. I spent a gaddam 2 hours today learning how to override the laravel pagination maker by forcing a page number (no comments on that one, please, haha), and I felt pretty stupid the whole time, but I ended up incidentally learning tons of other stuff in the process, mainly through the laravel API pages and source/history on github.

  2. As you become a better developer having hard times on problems do not magically go away. The problems get harder as you get better, and a lot of the time, that relationship is proportional. Might as well start struggling now.

  3. Learning laravel without previous knowledge of OOP basics is a bad idea in my opinion. You're going end up with this schema in your mind of OOP in terms of laravel and not...what it is at its core, if that makes sense. Laravel is an abstraction, and this is important to note. I suggest looking up a tutorial on OOP, classes, objects, inheritance, etc and struggling to code along with it and complete it, as many do.

  4. As shabushabu mentioned, the people that answer your questions want to help, but they're investing time to type their text and code for you to understand. These days, even at my level you can search just about any programming problem and there are already multiple questions and answers to the exact problem. Times are a changin', so asking for your own custom response to your easily searchable question really just hints at inconsideration for others, and laziness, because you'd rather have a stranger give out their free time to you, instead of you having to spend a minute or two decoding the exact question/answer found elsewhere. To be frank.

Sorry if this didn't make sense at all, it's like 4am here.

Last updated 2 years ago.
0

Noted, yeah I forgot to say thanks to those who replied. Thanks! a big help, am learning OOP basics and laravel on the same time because my work requires me to learn and use Laravel in a week and now i'm almost done with what they're asking me. :D

andrewsuzuki said:

I know you know what works for you best, and I was happy to answer (even without a thank you from your end :) ), but in this situation there were already top google results for both of your questions by just throwing in rough keywords.

  1. I think many people, including myself, would agree that your method is the easiest --- but when it comes to truly learning something at its core, sometimes it really is best to struggle to find the answer. It's the process of bettering yourself as a developer. I spent a gaddam 2 hours today learning how to override the laravel pagination maker by forcing a page number (no comments on that one, please, haha), and I felt pretty stupid the whole time, but I ended up incidentally learning tons of other stuff in the process, mainly through the laravel API pages and source/history on github.

  2. As you become a better developer having hard times on problems do not magically go away. The problems get harder as you get better, and a lot of the time, that relationship is proportional. Might as well start struggling now.

  3. Learning laravel without previous knowledge of OOP basics is a bad idea in my opinion. You're going end up with this schema in your mind of OOP in terms of laravel and not...what it is at its core, if that makes sense. Laravel is an abstraction, and this is important to note. I suggest looking up a tutorial on OOP, classes, objects, inheritance, etc and struggling to code along with it and complete it, as many do.

  4. As shabushabu mentioned, the people that answer your questions want to help, but they're investing time to type their text and code for you to understand. These days, even at my level you can search just about any programming problem and there are already multiple questions and answers to the exact problem. Times are a changin', so asking for your own custom response to your easily searchable question really just hints at inconsideration for others, and laziness, because you'd rather have a stranger give out their free time to you, instead of you having to spend a minute or two decoding the exact question/answer found elsewhere. To be frank.

Sorry if this didn't make sense at all, it's like 4am here.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.