cmdobueno

Experience

7,440

7 Best Reply Awards

  • Member Since 9 Months Ago
  • 24 Lessons Completed
  • 0 Favorites

13th June, 2018

cmdobueno left a reply on Converting MySQL Query To Eloquent • 1 month ago

@Cronix

I disagree. And I will your example to explain.

I have this piece of text that is english, and yes, when I do work with the piece of text, that work will be in english. This is where we diverge... because we all know Latin is used in most major languages... at least parts and pieces, and latin is also used in science and other branches of study... so screw all our languages... lets just do everything in latin.

Thats your logic. My logic, is to use the tools of the framework. Laravel has provided us a nice tool in Eloquent, and sure, if you want to go with straight mysql, go for it... but mixing is a bad idea.

My advise to the OP is simple, is this specific query different on your system? As in, is the majority of your application using eloquent or mysql? If it is using eloquent, then I would suggest converting. If you are using mostly mysql... id advise to see what your end goal is... are you going to be converting everything to use eloquent models? OR will it mostly stay as mysql. Do not jump to a conclusion because somebody says the system will convert it... you want uniformity in your code... otherwise you will hate yourself when you must maintain it... trust me... i have learned this from experience.

20th March, 2018

cmdobueno left a reply on Is Having Ads On Your Web Hard To Implement? • 4 months ago

No. Just include the provided javascript in either your default blade or header/footer if they happen to be blade components.

16th March, 2018

cmdobueno left a reply on Once You Master CRUD, What Else Is Key To Know As A Good Coder (Laravel Expert)? • 4 months ago

Ive also mastered breathing. CRUD is by far the simpliest part. Build, rebuild, refractor what you built, optimize. Just when you think you got something down, somebody has a newer, better, and faster way. It is never ending. I got through the laravel docs what feels like daily, and pull something new from it every single time.

cmdobueno left a reply on Does This Matter Route::post('post', '[email protected]'); • 4 months ago

I mean... yes it matters... which of the two endpoints do you plan to use?

I mean they are both "valid" as @m-rk said they are both cool and all but the first is more RESTFUL than the other...

But otherwise I have no real understanding of what you want

cmdobueno left a reply on Why Do People Use DB Instead Of Model? • 4 months ago

@gregrobson

Thanks for the write up, so from what I understand this is exactly what I expected.

Under normal case usage, with simple to moderately complex queries eloquent is what should be used. Given even within simple there are reasons to use to raw for performance and such...

I think main purpose my post (to circle back to a few other comments) is me many needing to better define what I am asking and saying.

Why are people using DB for simple queries that are none-complex, when a model is far more viable? And to further this as to why people do not better explain to those new to the framework that yes, maybe you are used to writing simple queries, there are a plethora of benefits to using eloquent models for your more common day to day actions of within a laravel application.

15th March, 2018

cmdobueno left a reply on Why Do People Use DB Instead Of Model? • 4 months ago

@Stratos

Good response, glad to know it will fail... though please satisfy my curiosity... why?

cmdobueno left a reply on Why Do People Use DB Instead Of Model? • 4 months ago

You guys are still not accounting for the fact that these things are built in. You could recode the entire framework yourself, eloquent is a core building block, and you are all just skating around the fact that eloquent is how LARAVEL does its databasing, yes there are times to use DB::raw or DB in general but the usefulness of eloquent and it being a core building block of laravel... i feel everybody that has posted just does not feel like flowing the framework and learning how ti use it properly.

14th March, 2018

cmdobueno left a reply on Loop Issue • 4 months ago

You do not lose scope on the job.


$job->job_status

cmdobueno left a reply on Why Do People Use DB Instead Of Model? • 4 months ago

But why? What is the reasoning? It is harder read, from what I can tell query wise far less efficient. And is breaks out of the main focus of laravel being an MVC.

I mean MVC, Model, view, controller.

What everybody is basically doing with queries is basically the same as deciding not to use blades.

It has no logical backing, and nobody has explained a reason yet. Because i am more used too writing sql... well I am more used to writing a plain html page.

People are not leveraging the framework properly, and going out and showing those learning to use DB and raw queries instead of using the framework and its tools.

cmdobueno left a reply on Why Do People Use DB Instead Of Model? • 4 months ago

@denismitr

Products::insert($products);
    

So why not use this? Then if I remember right any observers that exist will also fire... but they will not on DB.

So I do not see how your case is better than my case... Mine will also use any and all mutators as defined on the model as well...

Still do not see the benefit.

Is your request "less" server intensive?

cmdobueno left a reply on Laravel Forces Use Of Constructer Like This '__construct'. Wondering Why? • 4 months ago

@Dinesh_dev

We could also just run php version 3 and use that horrific syntax, and deal with horrific load times.

The world changes, if you do not adapt then stop programming. As so many people have said, you must upgrade to __construct not the class name. It is the standard, thats how it is. The world of php will not stop advancing to cater to your needs and desires.

cmdobueno started a new conversation Why Do People Use DB Instead Of Model? • 4 months ago

So I have been looking around laracasts as well as several other help sites. Why do people use DB so such instead of have a model?

I am asking because I feel like I am missing something (but have a feeling that more likely, they are missing the proper understanding of laravel and eloquent.)

I see DB being used to insert, update, and query, then tons of useless joins... why would one not just use a model and relations to do things properly? Even further it seems to so many people in their response/suggestions also use DB instead of explaining that instead of all these intensive joins, why not just use the power of releations?

So am I missing something about this or is it just people not using the framework properly? Obviously I understand there are times to us DB instead of model but under normal (and nearly 99.99% of the time) usage a model vs db seems to be the correct answer.

Any input would be awesome.

22nd February, 2018

cmdobueno left a reply on Increase Font-size In Discussions • 5 months ago

I dunno... i dont have any issues reading things. Seems like a super minor number of people as this is the first time I have ever heard anybody complain about...

21st February, 2018

cmdobueno left a reply on How To Get Array Values In Database • 5 months ago

Array() should not have quotes.

http://php.net/manual/en/language.types.array.php

See Example 4 from php documentation.

Or you can use the shorthand array syntax as showed by @arthurvillar

cmdobueno left a reply on Nginx Does Not Work With Laravel • 5 months ago

I only use nginx and have never had a problem with laravel.

Just looking over your conf file, there are issues. See @elvijs 's response and look at the example nginx files located at the provided link.

6th February, 2018

cmdobueno left a reply on To Display Logged In Username In Top Div. • 5 months ago

Well, then sadly no you have not done it if it is not working as designed.

But back on topic:

here is the documentation for cookies and laravel

https://laravel.com/docs/5.5/requests#cookies

I would strongly advise using the built in auth engine to laravel unless you have a very special reason no too. It is solid and can handle so much via middleware. Otherwise maybe laravel is not the best choice for what you are doing. Session is a much better choice to pass around variables.

https://laravel.com/docs/5.5/session

It might be good to explain the purpose of not using Auth and instead handling the logic manually and possibly showing us how you are doing so manually...

5th February, 2018

cmdobueno left a reply on Laravel Ajax Pagination • 5 months ago

@m-rk

I agree with you 100%. Was just giving him a way to get what he wants... but yes it seems totally pointless and the user will not directly see this pagination link... nor does it actually impact anything they are doing at all...

cmdobueno left a reply on Blade Hidden Field Bug • 5 months ago

It may do nothing, but possible try to change it from {{ to {!! to see if it renders as it should. It could possibly be an issue with html encoding... no promises, but that would be my first step is the process of debugging the issue. I have not had any issues with using Form, but opt to instead use normalized html input rather than using laravel collectives field rendering... but thats a total personal choice.

cmdobueno left a reply on Sharing Photos From Blade To Social Media • 5 months ago

I believe to accomplish this you would need a javascript or jquery plugin.

A quick google search gives me this:

http://js-socials.com/

I am certain there are about a million different solutions and I would suggest consulting google for the solution that best fits your goals.

cmdobueno left a reply on Blade Hidden Field Bug • 5 months ago

Well, how are you passing $given_answers to the blade? Which version of laravel are you dealing with?

Is Live the same version of laravel as Local?

cmdobueno left a reply on Parse Error In One Of The XPath Extension's File • 5 months ago

Couple questions:

Which version of laravel and which version of php?

cmdobueno left a reply on Laravel Ajax Pagination • 5 months ago

Then use post.

https://api.jquery.com/jquery.post/

http://api.jquery.com/jquery.ajax/

Review those two sections and let us know if you have any questions. They are pretty straight forward...

2nd February, 2018

cmdobueno left a reply on Move Outside Php • 5 months ago

Tons of Laravel applications use node, I have even setup a laravel to run on hack/hhvm.

what you are asking/proposing/saying is like somebody thinking the andriod os for smart phones should move out of JAVA, C, and C++ to something else...

This is probably one of the least thought through statements of the year. Just take a framework built totally in the realms of php and up root it to some other language. Because I mean thats easy... all the languages use the same core functions, they all have the same type restrictions, and I mean the core syntax is always the same right? HA HA HA. Some peoples kids...

30th January, 2018

cmdobueno left a reply on Show In Blade • 5 months ago

So... ummm... what?

29th January, 2018

cmdobueno left a reply on Multiple Checkbox Update • 5 months ago

@deansatch

I am trying to be nice, as not everybody has the same knowledge.

That is exactly what the WHERE NOT IN is for.

first you go:

Modal::whereIn('somedbfield',$request->somerequestname)->update(['somefield'=>'somevalue']);

then to get everything else: Modal::whereNotIn('somedbfield',$request->somerequestname)->update(['somefield'=>'someothervalue']);

Tadaaaaa, queue the fireworks... we are now done.

23rd January, 2018

cmdobueno left a reply on First-page Slowness Loading • 5 months ago

Oh no, its fine to come here for sure. Just helps for us to know what we are dealing with, I am certain there a bunches of people that have experience in the October CMS. But knowing what you are dealing with only makes it easier for us to give you a more refined answer. There are sometimes large numbers of factors that go into page speeds. Ranging from the size of images, css, js, and the speed of the server itself. Hopefully a person wtih experience in October CMS can help you pinpoint your issues.

Is it generally every page? Or pages specific the cms itself?

cmdobueno left a reply on First-page Slowness Loading • 5 months ago

A lot depends on the environment and the server stack. A little more background would help us to give more suggestions. Maybe more of what types of pages? Are they database driven pages?

Are the using vue or some js framework or are we dealing with blades?

Kinda of the basics would help us to give a bit more help.

cmdobueno left a reply on Search Filter In Laravel • 5 months ago

This is honestly an extremely broad question and you are basically looking for somebody to totally write your code for you.

@BezhanSalleh provided two very good links that explain and show code examples.

Here is what you need to do in order to provide search on a page:

On page create a form, set its action to a post or get route (take your pick...)

Next put in the fields want with whatever names you desire... eg zipcode

Next insert a submit button...

Then in routes make the required route to post your form data.

In a controller create the needed function

Within that function do something like Model::where("some_table_column","SOME-OPERATOReg:=",$request->somefield)->get();

Send back the data to your a view to display the results.

This is effectively what the provided links say but they do a better job.

22nd January, 2018

cmdobueno left a reply on 301 Moved Permanently • 6 months ago

Not to sounds like a jerk, but honestly... it tells you exactly... the end point has moved permanently. Id advise looking over their api documentation or allow redirects within curl. EG: curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

8th January, 2018

cmdobueno left a reply on Need Advice On Security Checks For Saving Data To Database • 6 months ago

Certainly:

https://laravel.com/docs/5.5/authorization#creating-policies

This is the entire policy engine, lots and lots of good tidbits of info here for sure

https://laravel.com/docs/5.5/requests

This link is all about requests.

If anything is unclear let me know and I can try and explain it abit more.

cmdobueno left a reply on Create An Or In Laravel Validation At Controller • 6 months ago

For what you are looking for, it might be a good idea to create a custom rule as defined here:

https://laravel.com/docs/5.5/validation#custom-validation-rules

This would allow you to do the validation you desire, as I do not believe that the date_format rule allows multi formats (I could be wrong)

cmdobueno left a reply on Group Collection SUM By YEAR • 6 months ago

@shez1983

It is "faster" in some regards, but much harder to debug the data being collected. Unless I am dealing with a large dataset (1000+ records) I prefer to use @burlresearch 's method.

This comes down to the amount of data being processed. The direct query is a very viable solution, and in the simplistics of this query I would not see anything wrong with the query. If it was a more complex query that has many points of error, it is sometimes better to give up a bit of speed and instead go with a more debuggable solution.

cmdobueno left a reply on Need Advice On Security Checks For Saving Data To Database • 6 months ago

Generally speaking you can not stop a user from changing the request. You can hinder this using less explict names on the fields, but thats not really a good security measure. It can help.

I would suggest that in the store method you posted, you do a check to make sure the user is authorized on post within the selected category. This could be done with a policy, with a request class within the authorize method, or even directly within the store method itself, it is really dealers choice. I prefer a combo using a policy within the authorize block of the request. But it is up to you on that.

If you have any more questions let us know

cmdobueno left a reply on Handling Large Dataset (1000+) In VueJS • 6 months ago

You can use use vuejs, a searchable table, and ajax all together to only have to show 10,25,100, all whatever you see fit in the display numbers.

You can also allow a search via ajax just the same as doing lazy loading and allowing pagination. You can also do the same for sort.

You are not limited to just paging with ajax, vue, and laravel. Id advise going down this path. Alternatively (and I advise against) you could use a server side jquery datatable, though I have come to dislike jquery datatables in favor of a custom built vuejs datatable plugin.

4th January, 2018

cmdobueno left a reply on Wordpress As Homepage On A Laravel Application? • 6 months ago

@topvillas

Its simple. A critique is required for every question. If you are not doing something right at the core, you have a bigger issue.

Why allow somebody to do something wrong without showing them there are better ways? How can they learn the difference between a correct and wrong approach to a question? Of course we all do what would be deemed bad programming at times. Without a general background of his intent none of us are correct.

He might have a very good reason, or his logic for this might be fundamentally flawed.

@LaylaBelle

You guys had a good reason, your reason makes sense. But as I said to topvillas, we have no idea if he is attempting this for a good reason. You do not want him to have failed logic in his choices, otherwise he grows as a crap developer that does things backwards and causes good programmers to have nightmares about his horrific life choices.

cmdobueno left a reply on Wordpress As Homepage On A Laravel Application? • 6 months ago

Why is everybody ignoring the core issue with this concept?

Sure you could configure you server to do this, but this is STUPID.

If you want wordpress cool use wordpress...

If you want laravel cool use laravel...

Having both run concurrently in the same environment is not the right approach. How about this

@Trev21 What is the purpose or goal of attempting to sideload wordpress into laravel? What are you trying to accomplish?

29th December, 2017

cmdobueno left a reply on Global Var From 4. To 5.0 • 6 months ago

I first would advise this:

Read this completely...

https://laravel.com/docs/5.0/upgrade

Next, read this fully:

https://laravel.com/docs/5.0/views#view-composers

And then if you have further questions fire away.

cmdobueno left a reply on Multiple Loops To Read Multiple Table And Display In HTML • 6 months ago

Why are you echoing? What ever happened {{ or {!! ?

Else if? Whats before that?

Have you heard of this thing called a model? MVC... its how the framework is built....

If you are asking for a code review I will say that Id fire you if you worked for me.

It is nearly impossible to read, nobody can understand what you are actually trying to do, you are not using prebuilt aspects of the framework.

Sorry if I am blunt (not really), you code review is a failure. Sure it might work... but that does not mean it is correct.

cmdobueno left a reply on Unlink(): Invalid Argument • 6 months ago

Because it does quite literally what it says... It will delete the file.

See further help on the Storage Class with its functions here:

https://laravel.com/docs/5.5/filesystem

cmdobueno left a reply on Unlink(): Invalid Argument • 6 months ago

Why are you not using laravels storage engine to accomplish removing?

Storage::delete($files_path)

You are using the storage engine to save, you should also do the same for deletion.

cmdobueno left a reply on Flatten An Array • 6 months ago

@ejdelmonico but he is in JS. PHP would not help.

Id advise using lodash in this.

cmdobueno left a reply on Unknown Error • 6 months ago

Here is a solution for your issue:

The issue is you are mutating a prop called active1. Props will be overwritten when a component is re-rendered.

The best solution is to create a data prop lets call it active_1 and set that equal to this.active1

cmdobueno left a reply on Type Error • 6 months ago

Tell people here to go to localhost is like telling me to download a file from C:\

Its all local. To be honest if you do not understand that localhost is local and not accessible by the public I wonder if you should even be a programmer. To write good code you have at least understand the basics of the web and how it works. Sorry for the rant, well kind of, it just seems that too many people are trying to have people access via localhost. It is getting old explaining it over and over.

27th December, 2017

cmdobueno left a reply on Call To A Member Function ToArray() On Null In Laravel 5.5 • 6 months ago

You could simply create your own custom base model that all your models extend.

Within this base model, you could then create a function call firstArray() and wrap this check within to either return you an array of the single model or an empty array.

It has more re-usability.

cmdobueno left a reply on Dynamic Routes Handeling • 6 months ago

In the past I have handled this with a catch all route that is LAST to fire (so as to make sure that other routes are not caught un desired like)

Then I handle this all with a controller, if the page is not found (I use slugs similar to wordpress) I call the 404 page.

cmdobueno left a reply on Problems With Hosting - PHP7 • 6 months ago

@devonian

I would suggest using linode or digital ocean. No need to use forge in this realm, it is not required.

Generally when I deal with setting up a fresh server I like to go with

CentOS 7 Nginx PHP 7 (I install from the webtatic repo) MariaDB 10.2 (maybe 3 been about month... but whatever the latest and greatest is) NodeJS & NPM

There are plenty of guides on the install, and sometimes you can even find prebuilt install scripts for both digital ocean and linode. I preffer linode over digitial ocean but both are nearly equal across the board, and as stated there are a few discounts for digital ocean.

The benefit to using these two services are that you effectively have a fully scalable dedicated server that you can grow or shink in side (and cost) as the app goes from dev to live and requires more demand.

22nd December, 2017

cmdobueno left a reply on Why In Heaven Now We Have To Use Webpack? • 7 months ago

@topvillas

Except that webpack is far more feature rich, less buggy, easier to use and is the standard for the framework. But I mean its cool rock out with windows 95.

20th December, 2017

cmdobueno left a reply on Retrieve Data In Several Tabs In The Same Page • 7 months ago

So you want to dynamically load data, but you do not want to use ajax?

I mean you could pass the current tab as a get variable through the page and display the data accordingly... but AJAX is your best friend... get used to ajax... its worth the time to learn and understand.

cmdobueno left a reply on Eloquent Relations Are Not Working. Err: Class Not Found Fatal Exception • 7 months ago

If you changed the APP Name you need to do:

public function user() { return $this->belongsTo('VTSAT/User','user_id'); }

You should also make sure that the namespace is correct on the user model... as in something like

VTSAT\User

cmdobueno left a reply on Carbon Issue • 7 months ago

I am unable to replicate anything like this within Carbon.

I use carbon heavily on server time tracking and shift tracking solutions... this has never happened. Are you dealing with properly formatted dates?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.