deansatch

deansatch

Member Since 2 Years Ago

Experience Points 46,590
Experience Level 10

3,410 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 203
Lessons
Completed
Best Reply Awards 35
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.

27 Jun
2 weeks ago

deansatch left a reply on Failed To Authenticate Email

Are there any symbols in your password? If so wrap it in "password". Also check to see if outlook has 2 factor auth which may need to whitelist your app ip

deansatch left a reply on How To Retrieve A Data GroupBy(every 3 Months) From Laravel

I think your best bet would be to do a single query for the last 18 months then format the collection afterwards

21 Jun
3 weeks ago

deansatch left a reply on Is It Good To Use Queue In Laravel For Mails?

@GOUSEFEROZ - If you change your worker conf file you will have to reread, update and start supervisor again

deansatch left a reply on Is It Good To Use Queue In Laravel For Mails?

@GOUSEFEROZ - Did you fill in your worker file correctly and start supervisor?

deansatch left a reply on Is It Good To Use Queue In Laravel For Mails?

@GOUSEFEROZ - You need to run it as a background process otherwise it will be killed when you exit terminal. Look at the supervisor link - it will take care of that and ensure it restarts if anything goes wrong

deansatch left a reply on Carbon Date/Time Limits On Functions Such As AddDays()

@AURAWINDSURFING - Hopefully in 10 years time the timestamp column type will have been “upgraded”

deansatch left a reply on Carbon Date/Time Limits On Functions Such As AddDays()

@AURAWINDSURFING - It would seem that way yes. If you can insert a 2045 date in a timestamp column I’d like to know how you did it. I think there is an assumption that we won’t be using MySQL by then but I wouldn’t count on that

deansatch left a reply on Carbon Date/Time Limits On Functions Such As AddDays()

You are hitting the y2k bug in mysql. I suspect your column is TIMESTAMP which will only allow up to year 2037. Change to DATETIME if you want to allow further into the future

deansatch left a reply on Many To Many Relationships Attach/sync The Same Model

Sounds like you need to rethink the relationship. So you are saying you want to attach a product to an invoice several times with a pivot table? That would result in a table like:

Invoice_id Product_id 1 3 1 3

Which would be pointless. No way to query it. I think you need more of an “invoice_item” relationship and invoice hasMany invoice_item, and invoice_item hasOne product

20 Jun
3 weeks ago

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - Let’s see your show method (function) in your controller so we can see what you are doing.

Are you saying you don’t want any html formatting stored in the database?? Then just don’t use a rich text editor and use a plain text area instead

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - Ok that looks correct. You must be doing something between retrieving from the database and outputting

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - The database looks correct. It should have tags if you are using a rich text editor. Then when you show it in your view as {!!$post->body!!} it should render as html

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - No I mean in phpmyadmin if you double click on a cell with the tags in it it should turn into a textarea so you will see exactly what is in there

And I just don’t understand why it isn’t $post->body instead of $post->body_html. Are you doing some processing on the content before sending it to the view??

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - I just notice your column is called body but you are outputting body_html. What is going on there?

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

You’re still seeing it rendered in the browser on phpmyadmin. Click on one of the bad fields so it displays in an unformatted text box and see how it looks

deansatch left a reply on Body Data Is Including The HTML When It's Input To My PhpMyAdmin...

@FORTEIRP - look at the raw text in the database and see if it is encoded or not. I see your text is still formatted as though it is wrapped in the correct tags but also has encoded tags too.

deansatch left a reply on Fetch First Image From Foreign Key Table

You should create a relationship if you haven't already then:


$secondpost = DB::table('posts')
        ->with(['images'=>function($q){$q->first();}])
        ->orderBy('id', 'desc')
        ->skip(1)
        ->take(8)
        ->get();
return view('pages.index', compact('firstp', 'secondpost', 'fph'));


@foreach ($secondpost as $secondp)
  <div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 post-ab">
              <div class="row">
                  <img src="{{url($secondp->images->filename)}}" class="imgpost" alt="">
                <div class="bottomleft">
                  <p class="ab-desc">{{$secondp->marca}} {{$secondp->model}}</p>
                  <p class="ab-desc">{{$secondp->pret}} Eur</p>
                </div>
              </div>
            </div>
 @endforeach
19 Jun
3 weeks ago

deansatch left a reply on Intervention Image Not Resizing Image Greater Than 15mb

Because it is a 500 error it will not be the laravel log file, it will be your server log file

deansatch left a reply on Intervention Image Not Resizing Image Greater Than 15mb

@AJITHLAL - did you try adding $img->destroy(); to see if that helps?

Other than that you may have to look at the error logs to see what the reason for the 500 is

deansatch left a reply on Intervention Image Not Resizing Image Greater Than 15mb

Post your code - maybe you are performing so many transformations even 1000MB isn't enough memory.

Also try freeing up memory immediately after save

$img->save('image.jpg'); $img->destroy();

deansatch left a reply on Intervention Image Not Resizing Image Greater Than 15mb

have you checked phpinfo() to see if your settings are being recognised? Reloaded server etc..?

deansatch left a reply on Where != Foo Also Excludes Null

@NASH - oh no...I wonder how many sites are out there unknowingly missing a few posts because of that little bit of awkwardness!

deansatch left a reply on Where != Foo Also Excludes Null

@NASH - What I mean is I am getting all results and it is correctly excluding those rows where foo=bar, but it seems to also exclude rows where foo is null...even though I never asked it to.

deansatch started a new conversation Where != Foo Also Excludes Null

Is it normal for Model::where('foo', '!=', 'bar')->get(); to return all results apart from those where foo = bar (obviously) but also to not return results where foo is null??

deansatch left a reply on "This Site Can’t Be Reached"

@NOMGUY - Yes I was just wondering if the issuers one was maybe causing some sort of memory issue causing the local server to panic and reboot so appear down for that page but then back up for any other page. Failing that, it could be the chrome bug so I would eliminate that first by trying in safari or FF

deansatch left a reply on "This Site Can’t Be Reached"

You can pass in the model too.

Well the error you are getting suggests that there is no site at that domain so is it not just that your local server is temporarily down?

Can you load the home page at the same time as getting that error?

deansatch left a reply on "This Site Can’t Be Reached"

Is your site actually running on that address? I see a domain in the address bar. Is it not just that your download link is referencing your localhost setup instead of your domain?

Also those two functions are identical apart from the file name. Why not use one and pass the file name in as an argument

18 Jun
3 weeks ago

deansatch left a reply on JSON - Undefined Property: StdClass Only On Underscored Variables...

Do all $properties have that property? The first one in the array clearly does but what about the rest? If one has no lot_size the whole thing will fail.

deansatch left a reply on JSON - Undefined Property: StdClass Only On Underscored Variables...

What happens if you dd() the $response before the view?

deansatch left a reply on Set Object Child As Parent

Post more code

deansatch left a reply on Set Object Child As Parent

Instead of

Return $comment

Do

Return $comment->comment

deansatch left a reply on Multiple Clicking On Submit Button

Only js disabling the button can totally prevent a second submit. But to avoid unnecessary dB inserts you can pass a unique token (maybe even use the csrf token) on submit. Store it in the session for that visitor in an if statement. Sorry I am on my phone and can’t find the back tuck key to do a code sample but something like

If isset( $_SESSION[‘thecsrftoken’]) Redirect back Else set the above session and continue

deansatch left a reply on Add A + 1 To WithCount()

@PICKAB00 - Yes, as when you use withCount it adds a new “column” with _count appended to the end. So if you did a normal query withCount(‘id’) and dumped it you would see it appears as though there is a column called id_count. This resulting column can then be the subject of a mutator. E.g. getIdCountAttribute()

So in your case guestpaxes will be unaffected by the mutator, but the new column (generated by withCount) “guestpaxes_count” will be affected by the mutator

deansatch left a reply on Add A + 1 To WithCount()

@PICKAB00 - It’s just the naming convention that makes the mutator recognised as such. So CommentsCount just refers to the property comments_count. So if you are mutating $model->first_name, you would name it getFirstNameAttribute().

The “get” part means you are mutating on retrieval of the property

So to mutate any column in your query you are basically going to do getColumnNameAttribute()...where ColumnName is the actual column_name.

Hope that makes more sense

deansatch left a reply on Register Event With Slash Or Not

@LEGENDARYIN - I am not really sure as to why without digging into the laravel core code to see what it does with those properties but I would expect that they may be relative to a namespace in the core where they are used, so perhaps add the first slash would make your reference then be starting from somewhere inside the vendor directory rather than the root of the app. I'll have a little dig now but maybe someone else might be able to give the exact reason.

deansatch left a reply on Register Event With Slash Or Not

So if you reference a file/class from within a class which is on namespace "App"...

\App\MyCLass would be referencing a file path of App/App/MyClass

App\MyClass would be referencing a file path of App/MyClass

17 Jun
4 weeks ago

deansatch left a reply on Laravel 5.7 SelectRaw Array Binding Is Not Working (in MySQL Full Text Search Query)

Ok...how about trying this?

$result = DB::table('register')
            ->select(['nimi', 'kood'])
            ->selectRaw("MATCH(nimi) AGAINST (? IN BOOLEAN MODE) AS score")
            ->having('score', '>', 0)
        ->setBindings([$term])
            ->orderBy('score', 'desc')
            ->get();


deansatch left a reply on Laravel 5.7 SelectRaw Array Binding Is Not Working (in MySQL Full Text Search Query)

@NAKOV - yeah just thought maybe the double quotes around the whole statement may matter?

deansatch left a reply on Laravel 5.7 SelectRaw Array Binding Is Not Working (in MySQL Full Text Search Query)

I'm sure this is the correct syntax (no quotes around ?) but perhaps Nakov is onto something with double vs single quotes but instead around the whole statement?

->selectRaw("MATCH(nimi) AGAINST (? IN BOOLEAN MODE) AS score", [$term])

deansatch left a reply on Changing Currency On Blade

I've recently done something along these lines using localization.

Basically just using app()->isLocale($locale) or app()->getLocale() to compare against a locale column in a locale_settings database table. i.e. you can have a table with columns locale, currency, currency_symbol, vat_rat etc...

e.g. (in a very basic sense)


$localesettings = LocaleSetting::where('locale', app()->getLocale() )->first();
return $localesettings->currency_symbol;

Alternatively you could hard code it in the config/laravellocaization.php file. So just add the currency & symbol to each uncommented country in the array...that way you have access to them with...


$locales = \LaravelLocalization::getSupportedLocales();

            foreach ($locales as $key => $val) {
                if ($key == app()->getLocale() ) {
                    $currency_symbol = $val['currency_symbol'];
                    break;
                }
            }

deansatch left a reply on Unable To Do Php Artisan Migrate

check your config/database.php file near the top and see if it says:


    'default' => env('DB_CONNECTION', 'mysql'),


if it doesn't it might just say something like:


'default' => 'mysql',

In which case your DB_CONNECTION constant is completely ignored in .env

deansatch left a reply on Group By Subcollection (belongTo Relationship)

@ARISTAIN7 - Did you try my last answer? I tested this on a one of my own models User::with('posts') and it worked exactly as expected.

deansatch left a reply on BelongsTo Inverse Results

@ARISTAIN7 - I gave you the answer to this in your other thread. If you have the relationship set up it will work https://laracasts.com/discuss/channels/eloquent/group-by-subcollection-belongto-relationship?page=1#reply-518020

deansatch left a reply on Compact(): Undefined Variable

@KISH77 - Just for your future reference if you want to use compact, you should use it like this:


return view('company.invoice')
    ->compact(
        'order_totals', 
                'order_items', 
                'orderNum',  // so in blade this would be {{$orderNum}} not {{$orders}}
                'other_fee',
                'gct',
                'processing_fee',
                'bank_fee',
                 'Invoice' // in blade this would be {{$invoice}} not {{$title}}
        );

The idea is, if your variables are named the same as what you want them to be in your view you can use compact() to cut your code down. So in your case just the title and orderNum would either need variables renaming in your controller, or in your view, whichever you prefer.

deansatch left a reply on How To Get Same Values Only Once From Db

Ok, I honestly think you’ve jumped in the deep end too quick with this. If this is a learning project for yourself then at least watch some of the laracast tutorials. You don’t appear to have watched any yet. The laravel from scratch series is free afaik and even just the first 5-6 episodes should get you through this

If this is for a paying client I strongly suggest you hire a freelancer to complete the job

Trying to help you on here is just going round in circles

deansatch left a reply on How To Get Same Values Only Once From Db

so again...you have written an $array and passed that to the view too so just use that:


@foreach ($array as $data)
            <option value="">Select Highest {{ $data->Battery}}</option>
            @endforeach 

I can't tell you what to set the values as since I don't know what you are trying to achieve as the only information you have given is that you want a dropdown with those 4 options in it

deansatch left a reply on How To Get Same Values Only Once From Db

We’ve already gone over this again and again in your last thread: https://laracasts.com/discuss/channels/javascript/filter-results-from-dropdown-in-laravel

I have already posted the code to achieve that drop down with no values filled in which clearly can’t be want you want anyway. I have asked you several times to paste the expected output code with the values filled in and you ignore this every time.

Bobby is telling you the exact same thing about the file_id. Nobody can help you until you understand this or paste your expected output as I said