Dalma

Dalma

Member Since 2 Years Ago

Vancouver

Experience Points
24,470
Total
Experience

530 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
126
Lessons
Completed
Best Reply Awards
12
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 5
24,470 XP
Nov
07
5 days ago
Activity icon

Replied to Route List Not The Same As Web.php

I once had a similar issue but I found that I had syntax error in my web.php file.

Nov
01
1 week ago
Activity icon

Replied to Model With Many Attributes: One Or Multiple Models?

I would personally create 4 models.

  • Article
  • News
  • Sports
  • Food

Article would have all of the common data and they for the unique attributes the other three models would be used.

Oct
31
1 week ago
Activity icon

Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries

I'm assuming that your flight model already has an eloquent relation called 'aircraft', if this is true then yes.

Activity icon

Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries

Sorry this logic would go in your controller and not in the model. I was trying to guess the controller logic that you may be using.

Activity icon

Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries

In the typical N+1 discussion its expected that you add the 'with' clause to your main query.

Example something like:

Flights = 'App\Flight'::where('criteria', '=', x)
                -> with(['aircraft' => function($query){ $query->where('arrival_time',null);}])->get();

I may have some misplaced punctuation here.

Activity icon

Replied to Repeatably Accessing Attribute From Blade Resulting In Additional Database Queries

I suspect that it is and therefor you hitting the N+1 senario. For a moment change your code to return a hard coded or DB table value to see if the DB reads go away.

Oct
30
1 week ago
Activity icon

Replied to Database Table Size

FYI

MySQL has hard limit of 4096 columns per table

Oct
28
2 weeks ago
Activity icon

Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class

Can you try?

@extends('layout.app')

@section('content')

<div class="row">

        <div class="col-12 text-center">
            <h2> Page caption</h2>
        </div>
</div


<div class ="row">

        <div class="col-sm-6 col-md-4">
            <div class="card border-white">
                <div class="card-header">Heading 1</div>
                    <div class="card-body">
                        <p class="card-text">Some quick example text to build on the card 
                        title and make up the bulk of the card's content.</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-6 col-md-4">
            <div class="card border-white">
                <div class="card-header">Heading 2</div>
                    <div class="card-body">
                        <p class="card-text">Some quick example text to build on the card 
                        title and make up the bulk of the card's content.</p>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-6 col-md-4">
            <div class="card border-white">
                <div class="card-header">Heading 3</div>
                    <div class="card-body">
                        <p class="card-text">Some quick example text to build on the card 
                        title and make up the bulk of the card's content.</p>
                    </div>
                </div>
            </div>
        </div>

</div>

@endsection

Activity icon

Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class

Can you repost your blade file now that you have made the changes?

Activity icon

Replied to [L5] Create 3 Columns For Cards Using Bootstrap Row Class

Try ending the row immediately after your 12 column caption and then create a new row below it for your cards.

Oct
04
1 month ago
Activity icon

Replied to Managing DB Schema Changes On A Production Database

I use a github repository along with Forge to manage my production site. With Forge when you run a deployment from their UI it pulls the most recent copy from my github account and automatically runs a migration.

It's just like magic. :)

Oct
01
1 month ago
Activity icon

Replied to Using AND/OR Operators Together In Controller

I think you were on the right track as I have similar code in one of my projects to bracket the ands & ors.

Below I have reformatted your code a bit (to make it easier for me to read) and to pull the get() statement out of the second query. I have not tested to see that this is syntactically correct but when you have a chance please try this.

 $single_contact_add = Datainfo::where(function ($query) 
    { $query->where('uploaded_by', '=', Auth::user()->id)
        ->orWhereIn('uploaded_by', '=', Auth::user()->getchild(Auth::user()->id)); 
    })

    ->where(function ($query) 
    { $query->where('id', '!=', $group_contacts)
        ->orderBy('id', 'DESC');
    })

    ->get();
Activity icon

Replied to 3 Tier Architecture

Normally the Presentation tier is the load balancer. Even if your client wishes to internally host I still recommend the series as it discusses all of the basics in setting up a multi-tier Laravel application.

Activity icon

Replied to 3 Tier Architecture

Hi Zacky this type of configuration usually results in a load balancer -> one or more app servers -> one or more db servers.

If you would like to view a video series that walks you through the steps there is one here on laracasts : https://laracasts.com/series/learn-laravel-forge

Sep
26
1 month ago
Activity icon

Replied to Strange Password In My Database

Is there any chance that the user in question might have two accounts, one with a hashed pwd and then this one?

Activity icon

Replied to Strange Password In My Database

I would suggest that this password was not updated via your Registration Controller as it would be hashed like the others. I think you likely have a security issue where someone has write access to your database either through some form of SQL injection, application bug or directly from another DB management tool.

Sep
23
1 month ago
Activity icon

Replied to Blade Indent/autocomplete Plugin Is Not So Good In Phpstorm

  • 1

I would like to find a solution to this as well.

Sep
19
1 month ago
Activity icon

Replied to Dropped Queries By ~29,980 But Still 30+ Seconds To Load...

I assume that your queries are running against tables with significant number of records in them. Are you filtering the data with where statements and if so do you have indexes on the fields being queried?

Sep
16
1 month ago
Activity icon

Replied to After Copying A Laravel Project Blade Views Not Reflecting Changes

Perhaps your domain name/ server instance is not pointing to the code base that you think it is?

Activity icon

Replied to CSS Not Working !

Using the same tool if you you select any element and explore the attached sytles what do you see? If you are not seeing an error I would then think that your css styles are being overriden?

Also using the developer tool you should be able to explore your html document and in the header where you see your stylesheet being applied it should be a link where you can click on it and see that you in fact do have content in your attached stylesheet.

The most common issues are:

  1. Your style sheet does not load at all which should trigger an error visible in the console.
  2. Your styles are being overridden by another stylesheet.
  3. Your sass build is in fact creating an empty or malformed file.
Activity icon

Replied to CSS Not Working !

If you use Google Chrome and visit > More tools > Developer tools do you see any errors in the console tab?

Sep
13
1 month ago
Activity icon

Replied to Query Efficiency

With Eloquent queries there is a concept called Eager Loading where in the Eloquent query you specify which other records to load using a 'with' statement. I recommend that you read up on this.

https://laravel.com/docs/5.8/eloquent-relationships#eager-loading

Sep
12
2 months ago
Activity icon

Replied to Forge Down?

I understand that this is being addressed now: https://twitter.com/themsaid/status/1172166429648543744

Activity icon

Replied to FORGE IS DOWN

I understand that this is being addressed now: https://twitter.com/themsaid/status/1172166429648543744

Sep
11
2 months ago
Activity icon

Replied to User Specific Alerts With Many Filters

Lets call the data that people are uploading Opportunites.

I would look to create your system like this.

Let people upload Opportunities and as they are uploaded you set a flag on their record saying not processed.

On a timer, lets say once per hour you kick off a job that walks through all of your users and for each of them you run a routine that compares their filters against the new Opportunities and sends notifications as needed. Once done all of the Opportunities you just processed are flagged as complete.

As new Users join your system you set a flag on their saying not processed.

On a timer, lets say once per day you kick off a job that walks through the new users and for each of them you run a routine that compares their filters against ALL Opportunities and sends them notifications as needed.

For the 'flag' on Opportunities and Users I would use an numeric integer batch number that you increment just before kicking off your long running jobs such that you don't have a new Opportunity or User created while your job is running that is accidentally skipped.

Sep
10
2 months ago
Activity icon

Replied to Laravel Datatables Search Error

Is this a production machine or are you testing this via 'php artisan serve' server?

Sep
09
2 months ago
Activity icon

Replied to Updating Database On JQuery.ajax Call

Something like:

foreach ($pages as $page) {
  foreach($page->children as $children) {
 
    // your update logic here
    // start with a dd($page,$children) to dump the values returned to your controller

   }
}
Activity icon

Replied to Using Related Model True/false Functions In Eloquent Queries

The definition of the Accessor requires specific naming structure.

In your case it would be GetLatestassignmentAttribute the Get and Attribute portion of the naming performs some Larvel magic.

Defining An Accessor To define an accessor, create a getFooAttribute method on your model where Foo is the "studly" cased name of the column you wish to access. In this example, we'll define an accessor for the first_name attribute. The accessor will automatically be called by Eloquent when attempting to retrieve the value of the first_name attribute:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    /**
     * Get the user's first name.
     *
     * @param  string  $value
     * @return string
     */
    public function getFirstNameAttribute($value)
    {
        return ucfirst($value);
    }
}
Activity icon

Replied to Using Related Model True/false Functions In Eloquent Queries

Typically you would use an Accessor for this type of dynamic field generation.

Have you reviewed: https://laravel.com/docs/5.8/eloquent-mutators

Sep
06
2 months ago
Activity icon

Replied to Percentage Difference Between Dates

Basically you would need at least three dates to create a percentage as a percentage is a ratio.

As an example you if you wanted to know today as a percentage of days in the month. You would need the start date, end date and today's date.

Aug 1 -> Aug 30 is 30 days Aug 1 ->Aug 6 is 6 days

Your percentage comes as 6/30 = .2 or 20%

Date calculation example https://laracasts.com/discuss/channels/general-discussion/difference-between-two-carbon-dates

Aug
28
2 months ago
Activity icon

Started a new Conversation Forge Branch

Hi I have both a production site and testing site maintained via Forge. Until today both production and testing were set up to use my Master branch which was based on Laravel 5.7. I want to move to Laravel 5.8 so I created a branch (called Upgrade-to-5.8) and with my IDE worked through the various issues.

I now have both Master and Upgrade-to-5.8 branches available on Github.

In Forge I accessed my test server site and changed the Deployment Branch from Master to Upgrade-to-5.8 and ran Deploy Now. Below is a portion of the deployment log where it appears that the master branch was deployed rather than my Upgrade-to-5.8 branch.

Is there something else that I need to do to change my branch on this site?

Wed Aug 28 21:12:57 UTC 2019
From github.com:XXXXXX(Changed for security purposes)
 * branch            master     -> FETCH_HEAD
Already up to date.
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
Aug
20
2 months ago
Activity icon

Replied to How To Sync Attributes In A Specific Order ?

On my pivot tables I always add an id field and make it the primary index just like every other table used within Laravel. This would provide you with a method to sequence your records if you managed the sequence when they are created via the previously described ->attach method.

Aug
06
3 months ago
Activity icon

Replied to Error In Migrate In Laravel 5.5

Can you also share your migration file?

Aug
01
3 months ago
Activity icon

Replied to Tips For Seeding Production Tables From Devel Environment

That is a great idea thank you!

Activity icon

Started a new Conversation Tips For Seeding Production Tables From Devel Environment

What are others doing to seed tables when they are created in production environment.

I'm in the progress of moving from a hardcoded menuing structure to a table driven one using brand new tables. My development environment has the menus populated but as I release my code to production these tables will need to be populated immediately. Are you doing something at a database utility level or creating seeders?

Jul
16
3 months ago
Activity icon

Replied to Laravel 5.7 | External Server Router Error

Are you using composer on this install, if so have you run composer update?

Jul
15
3 months ago
Activity icon

Replied to Forge: Script For Adding Column To Production Database Table

If you have run composer require xxx/xxx in your development environment then this will update composer.json and composer.lock which when pushed to your repository via git will be pulled when the forge script runs.

git pull origin master <--- will download all of your changes including composer.json and composer.lock composer install --no-interaction --prefer-dist --optimize-autoloader <--- will download xxx/xxx package on your server

Jul
10
4 months ago
Activity icon

Replied to Elegant Way To Fix Duplicated Many To Many Relationships

Okay I have figured this out so I thought I would share

$users = User::all();
foreach($users as $user){
  $roles = $user->roles->unique()->pluck('id');
  $user->roles()->sync([]);   // to clear old association
  $user->roles()->sync($roles);
}
Activity icon

Started a new Conversation Elegant Way To Fix Duplicated Many To Many Relationships

Hi everyone I'm looking for some elegant way to correct an issue I created. I have a Roles table which is a Many-to-many relationship with Users. Due to a bug in my code I now have Users that have the same Role attached 6 or 7 times.

I'm looking for an elegant way to code an update to fix the following example

User: Jim Jones
Role: Technician
          Technician
          Technician

User:Peter Smith
Role: Technician
          Coordinator
          Designer
          Designer
          Designer

I guess basically I'm wanting to return a list of unique attached roles and then perform a sync of these ids

Activity icon

Replied to Failed To Parse Dotenv File Due To An Invalid Name.

Could your file be in the wrong location?

Jul
08
4 months ago
Activity icon

Replied to Pulling ID Into Form Within Modal

I expect that you are getting the last id listed?

You are building your modal after your foreach list has completed which means the value you have in $game->id is the last one. You will need to use some javascript to read the id from your table.

      {!! Form::model($game, ['method' =>'PATCH', 'action'=> ['[email protected]', $game->id], 'files'=>true, 'enctype'=>'multipart/form-data']) !!}
      
Jul
03
4 months ago
Activity icon

Replied to Random Schedule Cron

I would also vote that you stagger your backup's but assign each machine a specific time.

Activity icon

Replied to Queue Processing - How It Works

Hi Ruborg, you start an OS command that is a queue worker. Details are here: https://laravel.com/docs/5.7/queues

Jun
19
4 months ago
Activity icon

Replied to Deployment Log

Sorry I didn't think to search first. Thank you for your help.

Activity icon

Started a new Conversation Deployment Log

I see that the forge interface shows the latest deployment request directly on the UI. Is there an underlying log file with a series of deployments, if so does anyone know the file name and location?

Something happened yesterday on my site where existing code used for email notification events is suddenly not working today. This code has been running in production for two months and now today is throwing 'not property of object' errors. Using tinker I can pull up the object and it works correctly so I want to see if an install of one application program as triggered a laravel or symphony update when it was released through forge.

Jun
05
5 months ago
Activity icon

Replied to Invalid Argument Supplied For Foreach()

Try changing your first() to get() and see if the error goes away.

Activity icon

Replied to Scheduled Tasks In Laravel 5.7 App Triggered At Wrong Time

For my schedules I specify the timezone. Below is an example from the Laravel docs

$schedule->command('foo')
          ->weekdays()
          ->hourly()
          ->timezone('America/Chicago')
          ->between('8:00', '17:00');
May
27
5 months ago
May
10
6 months ago
Activity icon

Replied to Is It Me Or Laravel Is Really Hard To Tame For Beginners?

This series is long but it builds step by step. I followed the entire series and then have viewed about another 100 posted on here and with each I was able to grow in my understanding.