Sinnbeck

Sinnbeck

Programmer at Aalund

Member Since 4 Years Ago

Odder

Experience Points
330,430
Total
Experience

0 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
136
Lessons
Completed
Best Reply Awards
506
Best Reply
Awards
  • 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.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    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.

Level 50
330,430 XP
Feb
19
21 hours ago
Activity icon

Awarded Best Reply on Phpunit Overrides My Msqldatabase

Any chance you have manually set $connection on your models?

Activity icon

Awarded Best Reply on How To Create Protfolo With Isotope With Laravel

Good. Try this then. Does anything happen?

 $(document).ready( function() {   
$('#pills-tabContent').isotope();
});
Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Either increase your server timeout (if possible) or run smaller batches manually.

Eg. (run, change the numbers, run again, repeat)

$users = User::whereBetween('id', 1, 200)->get();
Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Oh sorry misread. Should be like this (remove all())

$users = \App\User::chunk(50, function...
Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Yup that looks correct. Did you reset the users? If some are already hashed, you will have a problem.

Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Yes that can be tricky to understand at first. When used inside a class php uses that classes namespace as root. If you are outside then / is root.

So we tell the controller class that it is inside App\Http\Controllers (\App\Http\Controllers). As you the call App\User inside it that means it adds those together (\App\Http\Controllers\App\User)

In the case of use, you are outside of the class (). Add those together and you get \App\User

Activity icon

Awarded Best Reply on How Do You Protect Vapor From DDoS Spin Ups?

The question might be if it took 1 minute for the shield to get the attack under control.

But I think it would be interesting to contact Amazon and hear if there are any guarantees or if you can end up with a huge bill. In cases like that I would personally not trust a "secondary opinion" or hearsay. If someday you have an issue it is nice to have it on paper from the source.

Activity icon

Replied to Bcrypt List Of Existing Text Passwords

You are missing a slash (or import it with use)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Braintree_Gateway;
use Artisan;

class AdminController extends Controller
{
public function hashpasswords() 
    {
        $users = \App\User::all();
            foreach ($users as $user) {
            $user->password = Hash::make($user->password);
            $user->save();
            }
    }
}
Activity icon

Replied to How Do You Protect Vapor From DDoS Spin Ups?

The question might be if it took 1 minute for the shield to get the attack under control.

But I think it would be interesting to contact Amazon and hear if there are any guarantees or if you can end up with a huge bill. In cases like that I would personally not trust a "secondary opinion" or hearsay. If someday you have an issue it is nice to have it on paper from the source.

Activity icon

Replied to How Do You Protect Vapor From DDoS Spin Ups?

Sounds like what aws shield is for

https://aws.amazon.com/shield/

AWS Shield is a managed Distributed Denial of Service (DDoS) protection service that safeguards applications running on AWS

If it actually works, is hard to tell :)

Activity icon

Awarded Best Reply on Bcrypt List Of Existing Text Passwords

Hard to tell. I don't know how your database looks after import. Are you just trying to overwrite the password on the user?

$users = DB::table('users')->get();
    foreach ($users as $user) {
        $user->password = Hash::make($user->password);
        $user->save();
   }
Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Great then my code will do just that

Activity icon

Replied to Auto-update Language Files On Call __()

Great to hear. If it solved the issue, consider marking best post

Activity icon

Replied to Bcrypt List Of Existing Text Passwords

Hard to tell. I don't know how your database looks after import. Are you just trying to overwrite the password on the user?

$users = DB::table('users')->get();
    foreach ($users as $user) {
        $user->password = Hash::make($user->password);
        $user->save();
   }
Activity icon

Replied to Eloquent Model Not Returning Any Data From Table Having Multiple Indexes.

Did you try getting the exact query using clockwork or debug bar?

Activity icon

Replied to Bcrypt List Of Existing Text Passwords

You aren't setting a variable called $password anywhere. Only using it here

$password->user()->fill
Activity icon

Replied to Validation

Can you elaborate? Like the user ID on this table? plataforma_produto

Activity icon

Replied to Is Mixing Javascript With Blade Syntax A Bad Practice?

Well personally I would make a file with closely related code. Like handling users

Activity icon

Replied to Delete With Subquery

Imports::whereBetween('YearMonth', $ranges[0], $ranges[1])
    ->delete();
Activity icon

Replied to Bcrypt List Of Existing Text Passwords

I assume you are missing the bit with the loading of password, but apart from that it seems fine. It is a one off run through the database. If it is alot of users you might want to use chunk

Activity icon

Replied to Is Mixing Javascript With Blade Syntax A Bad Practice?

Well you would add the file under /resources/js and then in the webpack file using script (note that it only minifies when running npm run prod)

mix.scripts([
    'resources/js/myscript.js'
], 'public/js/myscript.js');

Now run npm run watchand it will auto compile when you write code

Once you get comfortable with this you can do all sorts of cool things, like code in es6 and type script.

But for now it might just be a good idea to get used to coding in a js file (without the extra build step)

Activity icon

Replied to Is Mixing Javascript With Blade Syntax A Bad Practice?

Personally I would prefer to have it in js files. Makes it possible to easily reuse functions and such. And it makes it possible to minify (smaller download)

Activity icon

Replied to Is Mixing Javascript With Blade Syntax A Bad Practice?

Try copying the Javascript to a js file and import it into the file instead

<script src="myscripts.js"></script>
Activity icon

Replied to Is Mixing Javascript With Blade Syntax A Bad Practice?

It's really not necessary. You can have all of your Javascript inside a js file. I manage a huge system and there is no Javascript in html files (or php)

Activity icon

Replied to Blade Templating With The @extends

No that should do it :)

Activity icon

Replied to PHP_RENAME Error For Large .zip Files

Could you perhaps show how you are doing it in code, as well as the exact error message

Activity icon

Replied to DataTable Is Not Working To Change Pagination Text

I don't understand what you are saying. What id?

Do you mean it works if you give your table an ID instead of class and use that?

Activity icon

Replied to The POST Method Is Not Supported For This Route. Supported Methods: GET, HEAD

Check your first post. You wrote

productSync.blade

Activity icon

Replied to DataTable Is Not Working To Change Pagination Text

What version of datatables are you running? This was added in 1.10 I believe

Activity icon

Replied to Laravel Registration Issue

You could also copy paste this method to your verificationController and add a login call to it

https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/VerifiesEmails.php#L34

Activity icon

Replied to Laravel Registration Issue

Oh sorry. My my bad! Are you sure verify logs in? I cannot find any code for that. Try it again, but this time logout first

Activity icon

Replied to Laravel Registration Issue

That is indeed strange. Just doing some digging. This is where it logs the user in and it seems to use the correct one

https://github.com/laravel/framework/blob/6.x/src/Illuminate/Foundation/Auth/ResetsPasswords.php#L113

Activity icon

Awarded Best Reply on Primary-key Naming

Yes. When addind relations laravel will try to guess these keys.

You can provide them manually though. The second and third argument is the foreign key and local key (laravel would expect these to be 'product_id', 'id' and defaults to these).

return $this->hasMany(Product::class, 'ProductID', 'ProductID');
Activity icon

Replied to Refactoring Production Database ?

Also.

  1. Take a snapshot of the production database
  2. Import it locally
  3. Run migrations
  4. Test it thoroughly
  5. Test it again
  6. Take a break and rest your eyes
  7. Test again!
  8. Backup production database
  9. Run migrations on production
  10. Repeat 4 to 7 on production
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Well I am still uncertain as to what has to happen. When should isotope run? When you click a button? Or on page load?

Activity icon

Replied to Fill() Array To String Convertion

Do you mean this line?

if(is_null($product))

Or do you mean the fill(). If so try doing this and post the output

$request->all();
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

I updated my last answer with a rewrite of your code.

I dont know how I should help you fix "A bad image"? I am not even sure what that means.

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Great so now it is starting to use isotope I assume? :)

And also the document ready should be outermost (I removed the trigger as ít does not seem to have any reason to be there)

$(document).ready( function() {
    function startIsotope() {
        $('#pills-tabContent').isotope();
    }
    startIsotope();
$('.nav-item .nav-link').on('click', function (e) {
e.preventDefault();
        var id = $(this).attr('id');
//Do stuff
});

});
Activity icon

Replied to Scopes In Join

That is actually not a bad idea! :) I will look into implementing that as a quick test :)

Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Good. Try this then. Does anything happen?

 $(document).ready( function() {   
$('#pills-tabContent').isotope();
});
Activity icon

Replied to Trying To Get Property 'view_count' Of Non-object

If you expect it to work with both, then there is no way that will ever work. Perhaps you should consider adding more to the wildcard url to avoid conflicts

Route::get('content/{menu}/', '[email protected]');
Activity icon

Replied to Changes To Route In Web.php Not Reflected On Shared Hosting

@sti3bas Agreed. If you can spare the 12$ a month :)

Activity icon

Replied to Changes To Route In Web.php Not Reflected On Shared Hosting

Yes is just a clean machine. Kinda like installing ubuntu on you laptop. Took me a bit to learn back in the day, but I am sure you will get it :)

Personally I prefer nginx, but apache2 is quite easy to set up :)

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

Activity icon

Replied to Scopes In Join

@vandan Thanks, but I am trying to do this in laravel using laravel scopes :) The article is regarding ActiveRecord.

https://laravel.com/docs/6.x/eloquent#local-scopes

Activity icon

Awarded Best Reply on Laravel | Displaying Products In A Particular Category

You can pass a variable to a closure using use

categories = Category::where('visible',1)->orderBy('order', 'asc')->with(['products'=>function($q) use ($id) {
            $q->where('category_id', $id)->where('visible', 1)->orderBy('order', 'asc')->get();
        }])->get();
Activity icon

Replied to How To Create Protfolo With Isotope With Laravel

Please start by answering the questions put forth earlier

  1. Does the alert code trigger?
  2. Did you remember to include jquery?
Activity icon

Replied to Laravel | Displaying Products In A Particular Category

You can pass a variable to a closure using use

categories = Category::where('visible',1)->orderBy('order', 'asc')->with(['products'=>function($q) use ($id) {
            $q->where('category_id', $id)->where('visible', 1)->orderBy('order', 'asc')->get();
        }])->get();
Activity icon

Replied to How To Resolve Page Not Found. No Query Results For Model []

Can you try this and check the output (if it is null that will cause issues). In any case you should make sure that you can find a valid id before moving on

$identities = DB::table('appraisal_identity')->select('id')->where('company_id', $userCompany)->where('is_current', 1)->first();
dd($identities->id);
Activity icon

Replied to Getting $ Not Defined Error

And that id is a string a assume? Ids cannot be numbers..

Perhaps you can do

$('#row' + id)

and html

<div id="row{{$something->id}}>Data</div>