Dalma

Dalma

Member Since 2 Years Ago

Vancouver

Experience Points 21,050
Experience Level 5

3,950 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 105
Lessons
Completed
Best Reply Awards 11
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

05 Jun
1 week ago

Dalma left a reply on Invalid Argument Supplied For Foreach()

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

Dalma left a reply on 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');
27 May
2 weeks ago
10 May
1 month ago

Dalma left a reply on 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.

Dalma left a reply on Is It Me Or Laravel Is Really Hard To Tame For Beginners?

I have been a software developer for a long time but had not worked with PHP at all and until recently didn't even know of Laravel. I found the following video series and by the time I was done I was in good shape.

This is on the DevMarketer youtube channel - Called build a blog with Laravel

https://www.youtube.com/watch?v=R8B4og-BeCk&list=PLwAKR305CRO-Q90J---jXVzbOd4CDRbVx&index=1

After following this series I was prepared for Jeff's more focused and advanced videos.

08 May
1 month ago

Dalma left a reply on JQuery Not Working In Blade Template

Are you loading the default bootstrap js as well somewhere, is it required by your library?

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js">

Using the same Chrome inspection tool do you see any output in the Console section as it will show JS errors there?

07 May
1 month ago
06 May
1 month ago

Dalma left a reply on Cannot Read Html Element Data Attribute

I was successful with this format for reading data attributes

var $id = $(this).data('id');

28 Apr
1 month ago

Dalma left a reply on Commit To Forge Server Error

That is great news

27 Apr
1 month ago

Dalma left a reply on Error When Tryining To Delete Mysql Database;

Are you trying to do a drop from a ssh command line? I would suggest that you need to either be the database user via su dbusername or the root user.

Dalma left a reply on Commit To Forge Server Error

I think the issue you are facing is not with composer but with git on the forge server. I have run into this and had to execute a git command to stash my changes.

26 Apr
1 month ago

Dalma left a reply on Odd Image Upload Issue

If you have not already done so, check to see the URL being presented for images that work and those that don't work and compare paths and domain names. Hopefully something should be apparent and from that we can work to better assist you.

24 Apr
1 month ago

Dalma left a reply on I Could Use Some Assistance In Formatting A Query

I found my solution. I needed to wrap the inital or clauses in a closure

        $hightech = ['0' => 'Please Select'] +
            User::where(function ($query) use ($myofficeid) {
                $query->where('office_id','=', $myofficeid)
                      ->orwhereHas('offices', function ($query) use ($myofficeid){
                          $query->where('offices.id', '=', $myofficeid);
                      });
            })->where('status','=', 1)
            ->whereHas('roles', function ($query){
                $query->where('name','=', 'High Tech Coordinator');
            })->orderBy('name')->pluck('name','id')->toArray();

Dalma left a reply on Retrieve Data With Eloquent Relationships

try something like:

'departement_id' => Faculty::find($facultyId)

->whereHas( 'departements', function ($query) use ($request['departementName']) {
    $query->where('name', $request['departementName']);
})
->get()

Dalma started a new conversation I Could Use Some Assistance In Formatting A Query

I have a query that I'm struggling to get to bracket correctly, query appears at the end of this post

I have three relations:

User
User->offices()
User->roles()

The User has a default office id stored in the office_id field and a ManytoMany relationship accessed via the User->offices() relation and ManytoMany relationship accessed via the User->roles() relation.

to pseudocode

if $myofficeid > 0 ( find user where office_id = $myofficeid OR user->offices().id = $myofficeid) AND user->roles() has name = "High Tech Coordinator)

what I'm getting now is effectively

if $myofficeid > 0  find user where office_id = $myofficeid OR (user->offices().id = $myofficeid and user->roles() has name = "High Tech Coordinator)

I assumed that trying to place both of the office related queries in the ->when closure would bracket them together.

$hightech = ['0' => 'Please Select'] + User::where('status','=',1)
                                                    ->when($myofficeid > 0 , function($query) use($myofficeid){
                                                        $query->whereHas('offices', function($query) use ($myofficeid){
                                                            $query->where('offices.id', '=', $myofficeid);
                                                        })
                                                            ->orWhere('office_id','=',$myofficeid);
                                                    })
                                                    ->whereHas('roles', function ($query){
                                                        $query->where('name','=', 'High Tech Coordinator');
                                                    })->orderBy('name')->pluck('name','id')->toArray();
16 Apr
2 months ago

Dalma left a reply on Unexpected Else

No as that is a @if @elseif @else @endif or @if @elseif @endif

Dalma left a reply on Unexpected Else

I see 3 @if but 4 @endif statements??

Dalma left a reply on Blade @if @else

I think that you are missing ->total in your comparison statement.

10 Apr
2 months ago

Dalma left a reply on Remove Error Message After Open Second Time Of Modal

After you have a successful ajax call to populate your database you can in your javascript clear the data from the modal element(s).

09 Apr
2 months ago

Dalma left a reply on Eager Load

How do you have your eloquent relationships defined between your tables?

25 Mar
2 months ago

Dalma left a reply on Change CSS Dynamically

Using JQuery you can easily execute code that based on data embedded in your page can replace existing classes in elements.

If you had a div or field with a class of bg-light you could via JQuery remove bg-light and change it to bg-success as an example.

14 Mar
3 months ago

Dalma left a reply on PHP Confusion

I don't think that laravel loaded Php on your computer, it must have been installed previously. Normally on a windows machine a package like WAMP is installed which provides Php and MySql. I would guess that you already had Php on your machine.

05 Mar
3 months ago

Dalma left a reply on Reusing Codeblocks In Blade

Hi @sergiu17 that worked perfectly.

Dalma left a reply on Reusing Codeblocks In Blade

Would the substituted code then end up as

$$parent

Dalma started a new conversation Reusing Codeblocks In Blade

I have a large blade view file where a section of code is repeated except for a variable name that is table specific.

I have a view with a parent, child, grandchild relationship and within each I have 30 line block of code that repeats except that in each it has a {{$parent->id}} or {{$child->id}} or {{$grandchild->id}} embedded.

I'm trying to pull all 30 lines of code into another blade template and then pass in a variable being the $table name.

Something like

@include('admin.project.scheduleblock', ['table' => '$parent'])

@include('admin.project.scheduleblock', [table => '$child'])

If this does in fact work I can't figure out the appropriate syntax.

Dalma left a reply on Weird Namespacing Issue?

Hi @cronix I don't have any model specific aliases in the /config/app.php. I will chock this Tinker issue up to something unusual with the name of my class. As always thank you for your help.

Dalma left a reply on Weird Namespacing Issue?

Hi @cronix in my regular code I do have the use statement in place. When using Tinker I never need to specify the App\ name except for this model.

[!] Aliasing 'Stage' to 'App\Stage' for this Tinker session.
=> App\Stage {#4334
     id: 12,
     created_at: "2018-10-04 09:00:29",
     updated_at: "2018-10-04 09:00:29",
     name: "Not Started",
   }
>>>

All of the other models have the Aliasing message, this must mean that the class name of Schedule must confuse tinker.

Dalma started a new conversation Weird Namespacing Issue?

I have a model named Schedule that has an unexpected namespacing issue, it behaves differently than my other models. Laravel 5.7

I will contrast two models

Schedule (not working as expected - this is also my first polymorphic model)

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;


class Schedule extends Model
{
    use LogsActivity;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'schedules';

    /**
    * The database primary key value.
    *
    * @var string
    */
    protected $primaryKey = 'id';

    /**
     * Attributes that should be mass-assignable.
     *
     * @var array
     */
    protected $fillable = ['start_dt', 'end_dt', 'note', 'schedulable_id', 'schedulable_type'];

    public function schedulable()
    {
        return $this->morphTo();
    }
}

Task model that works as expected

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
use App\Events\TaskUpdated;


class Task extends Model
{
    use LogsActivity;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'tasks';

    /**
    * The database primary key value.
    *
    * @var string
    */
    protected $primaryKey = 'id';

    /**
     * Attributes that should be mass-assignable.
     *
     * @var array
     */
    protected $fillable = ['phase_id', 'name', 'start_date', 'end_date', 'required', 'stage_id', 'tech_id', 'notes', 'technotes', 'status_id', 'dependant_upon', 'weight'];

    protected static $logFillable = true;

    public function phase()
    {
        return $this->belongsTo('App\Phase');
    }
    public function stage()
    {
        return $this->belongsTo('App\Stage');
    }
    public function tech()
    {
        return $this->belongsTo('App\User');
    }
    public function status()
    {
        return $this->belongsTo('App\Status');
    }
    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public function schedules()
    {
        return $this->morphMany('App\Schedule','schedulable');
    }

    protected $dispatchesEvents = [
      'updated' =>   TaskUpdated::class,
    ];
}

from the following tinker commands

Task::first()

This returns the first model as expected

Schedule::first()

This fails with the message PHP Fatal error: Class 'Schedule' not found

App\Schedule::first()

This works

Both of the models are in the normal laravel file structure in the app directory.

Is Schedule perhaps a reserved word or have I overlooked the obvious?

28 Feb
3 months ago

Dalma left a reply on Laravel Is Very Slow In Localhost

So your problem does not seem to be network related.

Dalma left a reply on Laravel Is Very Slow In Localhost

Is your computer connected to domain controller or any other device that may act as a DNS controller?

From a command prompt try and run a traceroute

tracert localhost

Do you have multiple hops to your host?

Dalma left a reply on Laravel Is Very Slow In Localhost

My first guess would be something unusual in your hosts file.

Can you share the content of your C:/Windows/System32/drivers/etc/hosts file?

Do you have something like?

127.0.0.1 localhost
::1 localhost

Do you have other content in this file?

Dalma left a reply on UI And Data Structure For Array Of Dates

Of course this makes sense. Thank you.

27 Feb
3 months ago

Dalma left a reply on Database Error

Was this a previously working database connection or is this a new site?

Dalma started a new conversation UI And Data Structure For Array Of Dates

I'm working on a project management tool were there will be a series of tasks. Each task may have either

    1. a single date
    1. a single date range with a start date and end date
    1. multiple date ranges each with a start and end date

How have you presented this in the UI and then how did you store the data?

Dalma left a reply on HELP!! 500: Server Error (Laravel) With Zero Information On Why Its Not Working...

Have you configured Wamp's Apache server to host your site and respond on port 8000 or are you attempting to use the small server included with laravel which is started via

php artisan serve

As the php server responds on port 8000 I suspect that this is the server that you are attempting to hit and it may not be running unless you issued the command above.

26 Feb
3 months ago

Dalma left a reply on Problem When Deploying Via Laravel Forge

Is this a new deployment or are you releasing and update to your existing site?

Dalma left a reply on Get Image Preview From PDF File

There are always other options but this is a clean and easy to implement package.

Dalma left a reply on Migration Do Not Work In Laravel 5.8

I have created some new projects and overlooked the database configuration in the .env file?

Dalma left a reply on Problem With Adding Image To Product

Can you also post your Blade Form that is submitting this request?

I'm not sure if this is an issue but you may have issues with permissions on your images/product_images path?

22 Feb
3 months ago

Dalma left a reply on Js Stopt Working Because Of Vue?

Which file(s) are these two code blocks in?

When you have your rendered code if you view the source do you see both sets of scripts on the webpage?

21 Feb
3 months ago

Dalma left a reply on Forge Deployment Issue

I just tried a release now and it worked as expected.

Dalma started a new conversation Forge Deployment Issue

I was just trying to release a small update to my production site form forge and received the following error. I'm assuming that this is a temporary Forge issue?

Thu Feb 21 17:42:43 UTC 2019 ssh: Could not resolve hostname github.com: Temporary failure in name resolution fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

13 Feb
4 months ago

Dalma left a reply on AWS HTTP Error: CURL Error 60: SSL Certificate Problem

I'm sorry but I ran out of ideas.

Dalma left a reply on What Is The Usage Of Carbon?

Do set aside about a half day to read the documentation though as it is VERY thorough.

Dalma left a reply on DB Table Not Updating

Perhaps the value received in $id is not what you expect and it's updating the wrong record?

12 Feb
4 months ago

Dalma left a reply on AWS HTTP Error: CURL Error 60: SSL Certificate Problem

I run WAMP rather than MAMP and there are two different php.ini files to update. Does MAMP also have this issue?

Dalma left a reply on AWS HTTP Error: CURL Error 60: SSL Certificate Problem

I had a similar issue while working with Microsoft's Graph product last week. I searched for a big chunk of a full day and I found that I needed to add some certs to my web server and the resolution section title MAMP working solution had enough details for me to solve my problem. I hope that this helps.

https://stackoverflow.com/questions/29822686/curl-error-60-ssl-certificate-unable-to-get-local-issuer-certificate

Dalma left a reply on I Keep Re-writing My Code Whenever I Learn Something New

There will always be ways to update existing code as PHP and the framework change. Part of your decision making should include the lifespan of your software. If you are anticipating a 5 - 10 year life span then refactoring your code over and over to allow for better ongoing maintenance makes sense. If the life span of your code is expecting to be 1 - 2 years this doesn't make as much sense.

07 Feb
4 months ago

Dalma left a reply on Moving Storage/app To A Different Filesystem

Thank you I was confused in that the disk named 'local' also had a driver of 'local' and I was confusing the disk with the driver.

Thank you.