cmdobueno

Owner/Senior Programmer/Project Manager at Venom Interactive

Hire Me

Experience

27,900

29 Best Reply Awards

  • Member Since 1 Year Ago
  • 66 Lessons Completed
  • 0 Favorites

17th September, 2018

cmdobueno left a reply on Login No Longer Working In Laravel 5.6.28 • 6 days ago

It would be fantastic if you let the community know what exactly you did to fix it.

This will help others researching their issues.

cmdobueno left a reply on How To Foreach This Data • 6 days ago

Then you need to select @erikverbeek as the correct answer... because it is the correct answer.

14th September, 2018

cmdobueno left a reply on How To Foreach This Data • 1 week ago

^^^ This right here should be the correct answer.... just saying.

cmdobueno left a reply on Datebase Design • 1 week ago

No, generally it is not.

Pivot tables are great for that... if you provide some more details I can help a bit more.

cmdobueno left a reply on How To Foreach This Data • 1 week ago

Additionally, logic you are doing should not be done in a blade... generally speaking that is wrong... so I will be nice and give you a real answer... its not for you, its for somebody that may someday use this to solve their problem, and I dont want them doing it how you are doing it... pivot is the best answer, but you dont have that so here is how things should go

Your function in your controller

public function view(){
    $unfiltered_genres = []; //You have to fill in where your genres come from... I have no idea....

    $genres = [];

    foreach( $unfiltered_genres as $genre ){

        foreach( explode($genre,',') as $g ){
            $genres[] = trim($g);
        }

    }


    return view('path-to-your-view')
        ->withGenres($genres); //Add whatever else you need
}

Now in your blade it would look like this:

@foreach($genres as $genre)
    <a href="{{ url('cinema/movies/genre/'.$thisGenre) }}" class="item">{{ $thisGenre }}</a>
@endforeach 

This method is done because generally speaking the only purpose of a blade is display your already processed data.

Now please understand there is a much better way to get this all working. I have no idea the context of genres, nor where they come from. This is the proper way, and it also allows for easier maintaining of the code at later times.

cmdobueno left a reply on How To Foreach This Data • 1 week ago

@foreach($genres as $genre)
    @foreach(explode($genre,',') as $genreName)
        <a href="{{ url('cinema/movies/genre/'. trim($genreName)) }}" class="item">{{trim($genreName)}}</a>
    @endforeach 
@endforeach 

He forgot the delimiter (in this case a comma)

I additionally added trim, because the names are probably like this:

name 1, name 2, name 3

Trim will remove the leading and ending spaces so as to not break your urls.

cmdobueno left a reply on SEO Questions About Using Blade To Show Whole Page Vue.js Components In MPA • 1 week ago

Since the whole page content is rendered via javascript won't this affect negatively SEO?? afaik search engones crawlers won't fetch the content displayed by javascript.

This is a MASSIVE mis-understanding that people have about vue (and other js frameworks). As long as your data is given to the page on load (meaning that the data is not pulled their a get request from an api through ajax or axios) most crawlers can read your page....

Google, facebook, and the major players all have (and have had for years now) the ability to render javascript for seo and purposes. I have tested this many times, across many different networks.

If you are highly concerned (or if you are pull some/most/all of data from an api) then you will need to look into server side rendering for VueJs <-- google that... lots and lots and lots of cool resources.

As for your first question, you in this case will most likely be using props to pass the data to vuejs.

Super small example of a component with a prop My Awesome Component

<template>

    <div>
  
        <span>Results: </span>
        <span v-html="myFantasticProperty"></span>
  
    </div>

</template>

<script>

    export default {
        name:       'something-something-dark-side',
        props: {
            myFantasticProperty:{
            type: String,
            default: 'This is a magical propery'
        }
    };
</script>

<something-something-dark-side my-fantastic-property='Some Really Awesome String'></something-something-dark-side>

cmdobueno left a reply on Login No Longer Working In Laravel 5.6.28 • 1 week ago

It would be rather fantastic if you provided us even the tiniest bit of code to go on...

So as a general rule of thumb, I can pretty easily guess you changed something, and now it doesnt work. Code doesnt just stop working one day.

13th September, 2018

cmdobueno left a reply on Correct Approach To Import Data Into Mysql From Large Csv. (rows > 100k) • 1 week ago

Ummmm sure I guess?

I suggest reading:

https://laravel.com/docs/5.7/queues

before going down any path. Laravel queues are literally built into laravel. All you need to do is install something like supervisor to run them all the time...

though, like I said read the docs and pick which ever solution you feel works best for you. I generally do not use outside services, be it free or paid, when I can accomplish the same thing from within my own server.

12th September, 2018

cmdobueno left a reply on There Is Two Package.json File. What Should I Do? • 1 week ago

Use webpack to merge them?

cmdobueno left a reply on Data Lost After Some Hour • 1 week ago

I can nearly say at a 99.999% success rate (you random internet statistics are always correct) that the server did not lose the data. That just is not very common.

You said eloquent delete, how/where/when/CODE for that... because it sure could delete something, just depends how it was written....

cmdobueno left a reply on There Is Two Package.json File. What Should I Do? • 1 week ago

Combine the package.json. You really dont have any other choice...

Im sure somewhere there is a cool tool to do it for you, but worst case you just manually merge the two files into a super awesome cool file... then run npm install

nodE_models means nothings, they will get a fresh copy installed.

cmdobueno left a reply on Console.log Not Working • 1 week ago

He is in theory triggering it on submit, but Id say to try to click of the button by its ID

so:

$(document).on('click','#save-communicated-teachers',function(e){
    console.log("Test");
    e.preventDefault();

    //and more stuff....
});

cmdobueno left a reply on Console.log Not Working • 1 week ago

I am guessing you action is not happening.

Do you have other javascript errors?

cmdobueno left a reply on Table Bootstrap • 1 week ago

Just remove the id attribute on the table...

cmdobueno left a reply on Apis • 1 week ago

So I will do some assuming since you provided NO information here


public function someUnknownMethodNameIsGoingToBeUsedHereBecauseICan(){

    return response()
        ->json(
            [
                'hereIsTheArrayKeyToHoldMyQueryResultsWhereILiterallyJustAddPaginateToMyQuerySoThatICanSendItBack' => MyModelHereHasAReallyReallyLongNameAsWellIAmStartingToNoticeATrend::paginate()
    );

}


cmdobueno left a reply on How To Delete After A Given Lapse Period If Status Isnt Updated • 1 week ago

I am not a fan of whereDate anyway, i just use normal where clauses. Glad it is working.

cmdobueno left a reply on Apis • 1 week ago

Is this a question or a statement?

No one on earth (not even yourself), knows what you want here.

cmdobueno left a reply on How To Delete After A Given Lapse Period If Status Isnt Updated • 1 week ago

You have to have the heart beat for laravel added to your cron tab... without that... the schedule can not and will not run.

https://laravel.com/docs/5.7/scheduling#introduction

cmdobueno left a reply on How To Delete After A Given Lapse Period If Status Isnt Updated • 1 week ago

protected function schedule(Schedule $schedule)
{
    $schedule->call(function () {

    //Faster Way
    Task::whereDate('expires_at', '<', now() )->delete();

    //Slower Way      
        //$currentDate = date("m-d-Y H:i:s");
        //$tasks = Task::all();
        //foreach ($tasks as $task) {
        //    if($date->expires_at < $currentDate) { // Also i think that $date is typo
        //        $task->delete();
        //    }
        //}
    })->everyMinute();
}

cmdobueno left a reply on Correct Approach To Import Data Into Mysql From Large Csv. (rows > 100k) • 1 week ago

I generally will write these are commands.

That beings said, I also manually run these commands. I have never had much of a reason to allow a user to import that many records to the system.

BUT if that is required, you could also enable queues and workers, and register the import as a job.

I have never had an issue with these two concepts timing out. You are dealing with a long running process, which should probably be done fully on the server side, nginx should not be awaiting a result.

11th September, 2018

cmdobueno left a reply on Displaying Time From Database Query In Vue Without The Seconds. • 1 week ago

You can not do that in computed.

Instead make it a method, be a filter.

This is the issue... because it is literally not a function as computed properties are NOT functions.

cmdobueno left a reply on Vue Problem • 1 week ago

if (this.errors[field] && this.errors[field][0]) 
{
    return this.errors[field][0];
}else{

    //I am guessing this is the issue here, your function must be expecting an object or array and it is not getting that...
}

cmdobueno left a reply on What Are The Difference Between The Laravel 5.6 And 5.7..? • 1 week ago

Here let me google that for you.

https://laravel-news.com/category/laravel-5.7

That was pretty hard to literally type your exact question in good...

cmdobueno left a reply on How To Get Data From Left Join As Separate Array Instead Of Parameters? • 1 week ago

You can still write a model for a table you do not plan on keeping, just make a very simple model, set up the simple relationships, and then run the imports and then delete them.

I have done that countless times. It might seem like more work, but I found generally (when dealing with the requirement of joins or relationships) it is much faster... otherwise I just use DB::table("my_table")->get(); and do my insert that way.

7th September, 2018

cmdobueno left a reply on Admin Panel • 2 weeks ago

Oh no condascendance meant. Its like that magic thing I still havent gotten to try out yet...

cmdobueno left a reply on Run .bat File With Laravel Using Controller • 2 weeks ago

.bat is not your friend. I am huge fan of not bricking my system. I am also a huge fan of security. I would personally never do what you are doing... but if there is no other way... you "can" use the commands lists above... but again... use with extreme amounts of caution as they can explode things super duper easily.

cmdobueno left a reply on Upgrading Laravel • 2 weeks ago

To be honest, I just upgrade it. If it is an application I built, I generally have no issues. I have programmed in laravel for a really long time now, the only major issue I had in the framework was going from 4.2 to 5.0

There were a few little snags in 5.0 and up but nothing major... the upgrade guide explains everything fully, and 95% of the time, those upgrades have 0 impact on my code base. But it all depends on how you do things, what you use, and how your company handles upgrades.

cmdobueno left a reply on Admin Panel • 2 weeks ago

OR just go with this thing called "nova". I guess it does cool stuff...

cmdobueno left a reply on Run .bat File With Laravel Using Controller • 2 weeks ago

This hurts my head... I am not even sure how to respond...

php exec might do the right... or shell_exec

cmdobueno left a reply on Npm Crashes • 2 weeks ago

I did notice that removing a specific node module has helped the situation so far... I am wondering if it is the package or maybe I am at a critical mass... I guess time will tell... still looking for any advise people way have.

Thanks

cmdobueno started a new conversation Npm Crashes • 2 weeks ago

So quick intro:

I have a laravel 5.6 application, build within centos7 running on a dedicated local server. Server's rough stats 12 core ~2.4ghz intel xeon, 32 gigs of ram.

nginx, mariadb, node, npm all at the latest and greatest stable releases.

The application is a business level application dealing with custom built houses and such... it, as I said, uses laravel 5.6, and vuejs for its frontend. It is a spa that uses vue-router to do its stuff.

Now the issue is that npm will crash nearly every single time I run npm run watch. I have no issues with npm run dev, that works fine and has yet to crash. npm run dev is just not very "user" friendly... and provides slow development.

When I run npm run watch, it generally will populate correctly the first time... no major issues. After about 5 minutes or a certain number of "uploads" it will crash saying

0: ExitFrame [pc: 0x2fa6f48427d]
Security context: 0x1f2f1d120769 <JSObject>
    1: stringToBytes [/home/envftp/public_html/envision/node_modules/charenc/charenc.js:~18] [pc=0x2fa7082c262](this=0x8c295e0ce71 <Object map = 0x3ae7daf4f81>,str=0x347c40096861 <Very long string[34835031]>)
    2: md5 [/home/envftp/public_html/envision/node_modules/md5/md5.js:~8] [pc=0x2fa70840bb7](this=0x3781f8b06611 <JSGlobal Object>,message=0x29140750220...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I have (i believe), upped the memory limit on the dev command to 16 gigs...

development: `cross-env --max_old_space_size=16096 NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`

Any suggestions would be awesome.

6th September, 2018

cmdobueno left a reply on Many To Many Insertion Error Laravel 5.5 • 2 weeks ago

yes so as i suggested in my 2nd code block, that makes sure that the collection exists... then life is all better and things work right

cmdobueno left a reply on When To Use Relationship And When To Joins For Fetch Data In Laravel ? • 2 weeks ago

This will be an extremely divided issue. I personally have little use for joins, not to say I never use them, I just use them extremely sparingly.

The use case scenarios are dependent on your code, as most things in laravel.

cmdobueno left a reply on Getting Checkbox To Be Checked In Vue • 2 weeks ago

How I would handle it:

<input 
    type="checkbox" 
    :value="category.active" 
    @click="category.active = !category.active"
>

cmdobueno left a reply on What About A Laravel 5.7 From Scratch Series? • 2 weeks ago

Being there is a from scratch in 5.4, the differences from 5.4 to 5.7 are not ground breaking that would require an entire new from scratch. There are things that go over the new awesome stuff in each subversion... so yeah...

I mean you could always make one yourself, and try and get it posted... that would be fun... and it would keep you busy... which is probably a good thing... you know idle hands are the devils play ground they say...

cmdobueno left a reply on Many To Many Insertion Error Laravel 5.5 • 2 weeks ago

public function addbag(Request $request)
    {
        $collection = Collection::find($request->input('collection_id'));
        
        $bagcollect = Bagcollect::create([
            'bag_id' => $request->input('bag_id'),
            'weight' => $request->input('weight')
        ]);
        
        
        
        $collection->bagcollects()->attach($bagcollect->id);
        
  
        
        return redirect()->route('collections.show', ['collection'=> $collection->id]);
        
    }

It appears that during your addbag function $collection is coming back as null. I would suggest making sure the collection_id is set properly. It appears directly dealing with your collection_id from what I can see... maybe add some dumps for the $request->input('collection_id') before you get the collection to make sure it actually exsists each time

An additional measure would be to this:

public function addbag(Request $request)
    {
        $collection = Collection::find($request->input('collection_id'));
        
        $bagcollect = Bagcollect::create([
            'bag_id' => $request->input('bag_id'),
            'weight' => $request->input('weight')
        ]);
        
        if( $collection ){
         $collection->bagcollects()->attach($bagcollect->id);
    } else {
        //Handle the error because the collection does not exist...
        return redirect()->back()->withErrors('something')->withInput();
        //Just a quick example... make fit your needs
    }
        
       
        
  
        
        return redirect()->route('collections.show', ['collection'=> $collection->id]);
        
    }

cmdobueno left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 2 weeks ago

@jlrdw yes i totally understand, never said it wasnt "plain" javascript. Maybe you are misunderstanding what people are saying. Eloquent is not plain mysql/pdo. It is wrapped and like anything if you wrap something it can be bloated. jQuery is bloated. jQuery is slower than vue (and most other js frameworks). You are only see what you want from what is being said.

@ruudvangeelen as I said, just because it is past its prime does not mean it is not still widely used. There are tons of sites built using php 5.4 (or lower), it is also past its prime.

Tons of websites use wordpress, again there are security issues they have clearly stated they will not fix in that system. It is just not possible for them to repair.

Additionally as I said, jQuery is fine, but there are better options now a days.

All this thread is, is people seeing and reading only what they want what others have said.

The fact is simple, if you dont want to use vue, dont. If you want to do something else do it. Its all in documentation of laravel. New devs are not forced to do anything... they just do not read the documentation.

cmdobueno left a reply on Vps With Cent Os • 2 weeks ago

Well since I dont have to explain how to do it... just install webmin or virtualmin or buy cpanel and install it.

5th September, 2018

cmdobueno left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 2 weeks ago

@ruudvangeelen

No you do not understand. If I buy windows, it comes with nothing...

You are missing a very key point...

Laravel != Windows

PHP == Windows

Laravel == Some Packaged Computer (EG Dell)

Additionally is it better they only know jQuery? An extremely floated javascript "helper". jQuery is sadly past its prime... it did well with what it did at its time... high level developers are over it. I can not explain how many are totally removing all usage of jQuery as soon as they can, either in favor of plain js or some other framework.

I will say it right now... hate all you want... but deep down you all know its true... jQuery is dying. Its not dead, and it will not just vanish... but I have had 0 use for jquery since moving over to a framework (I like vue personally).

Also, is it wrong to point somebody new down a specific path? Thats like saying here learn programming... and pointing a person to c++, or c#, or php, or java, or python... thats all that is happening. If "new" laravel developers do not read the documentation, where it clearly talks about the scaffolding... that is on them. It is not on anybody else.

cmdobueno left a reply on Which Hosting Server Is Best For Laravel Project? • 2 weeks ago

I am peronsally partial to linode or digital ocean...but that is literally my person choice.

Anything that gives you full ssh access is always a good thing... just do not go down the shared hosting path haha... its horribly there... its kinda like in star wars where luck is tempted by the dark side path when he is chilling with Yoda...

Every good response should have a star wars reference... it is a good way to live life.

cmdobueno left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 2 weeks ago

This thread is effectively useless. People complain about laravel coming with standard support for vue.

There is nothing wrong with vue, there is nothing wrong with angular, there is nothing wrong with ANY of the JS frameworks...

If you do not want them, its simple just run that magic command and boom you have nothing and life is "wonderful".

I find it funny the people complaining about other usings tons of libraries are the ones that ALWAYS suggest using different laravel packages to solve everything...

It is extremely funny. A waste of time and energy.

I mean, if thats the case... might as well just build in plain PHP... who needs a framework right?

hahahaha... useless.

cmdobueno left a reply on File Size To Lorge (instead Of Large!) • 2 weeks ago

It is quite interesting that it says lorge instead of the large though...

cmdobueno left a reply on Laravel Url() Helper Equivalent • 2 weeks ago

Then you have to add project to the url...

cmdobueno left a reply on Laravel Url() Helper Equivalent • 2 weeks ago

The url when not prepended with "/" will append the current url & path.

Prepending the / will tell it to use the "base" url (www.example.com instead of www.example.com/somepage

4th September, 2018

cmdobueno left a reply on Barryvdh Error • 2 weeks ago

Basically what is happening is your installed package is not included in your autoload.

I am not 100% certain what the "standard" practice is for updating things like this because I have never used nor really heard of using laravel without composer...

I would guess (and i mean guess) that you could update your bootstrap.php file, but that kind of seems like a bad idea to me.

Additionally within the "vendor" folder there is an autoload.php file... this seems like the appropriate place to required_once the class loader for the plugin... normally it does all this for you, but you can not use composer dump-autoload

cmdobueno left a reply on Roles/Permissions/Users Review • 2 weeks ago

@ardnor

My end goal is use as few prebuild packages. This is for a system that has a long life, and there will in the end be some very "special" things I have to do with the permission system. The permission system will need to possibly span SaaS, and be bound to certain domain names. I just feel more comfortable customizing something I have built.

I have used the above package to large amounts of success on other projects and it is a very well build package no doubt.

31st August, 2018

cmdobueno started a new conversation Roles/Permissions/Users Review • 3 weeks ago

Hey everybody,

Please review my permission/roles concept. I am very interested in the concept of permissions being able to be grouped by group_slug (see migration). I am not sure if this is better than having a dedicated table or not... let me know your thoughts.

public function up()
    {
        
        Schema::create('roles', function(Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->string("slug")->unique();
            $table->string("name");
            $table->text("description")->nullable();
            $table->boolean("locked")->default(false);
            $table->boolean("all")->default(false);
            
        });
        
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');

            $table->string('first_name');
            $table->string('last_name');

            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');

            $table->unsignedInteger("role_id");
            $table->boolean("disabled")->default(false);

            $table->rememberToken();
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::create('permissions', function(Blueprint $table) {
            $table->increments('id')->unsigned();

            $table->string("name");
            $table->string("slug")->unique();

            /*
             * Rather than having a permissions group table I have opted to be able to use group by on group_slug
             * Interested if this makes more sense than using a dedicated table.
             *
             * Permissions are rarely queried alone, only on the "roles" page.
             */
            $table->string("group");
            $table->string("group_slug");

            $table->text("description");
            $table->timestamps();

        });

        Schema::create('permission_role', function(Blueprint $table) {
            $table->unsignedInteger("permission_id");
            $table->unsignedInteger("role_id");

            $table->foreign('permission_id')->references('id')
                ->on('permissions')
                ->onDelete('cascade');

            $table->foreign('role_id')->references('id')
                ->on('roles')
                ->onDelete('cascade');
        });
    }

cmdobueno left a reply on Ignore $append When Eagerloading • 3 weeks ago

Well, technically yes... but its not the most amazing thing ever...

$products = Product::with(['unit']);

$products->unit->each->setAppends([]);

I have used something similar, you may need to modify it depending on your particular need (if there are other appends that need to stay and so on). But it "does" work.

Edit Your Profile
Update

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