nyel-dev

nyel-dev

Member Since 2 Years Ago

Experience Points 3,160
Experience Level 1

1,840 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 28
Lessons
Completed
Best Reply Awards 0
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.

10 Apr
2 months ago

nyel-dev started a new conversation Modify Laravel Relationship Eager Loading

I have this relationship in my model:

    class Job extends Model
    {
        public function xref() {
            return $this->hasOne('App\Test', 'id', 'job_id');
        }
    }

and I am calling it on my controller like this:

    $jobs = Job::with('xref')->get();

I was wondering, how can I make a condition inside the model relationship. Like if the relationship xref returns null. I was hoping I could do something like this:

    class Job extends Model
    {
        public function xref() {
            $xref = $this->hasOne('App\Test', 'id', 'job_id');

            if($xref == null) {
                $xref = $this->hasOne('App\NewTest', 'id', 'job_id');
            }

            return $xref;
        }
    }

so basically what I want is check if what I am returning is null and if null, call a new relationship to another table.

Is this possible somehow?

18 Feb
4 months ago

nyel-dev started a new conversation Call A Post Route Using A Button.

Is it possible to do this?

Let's say I have a route like this:

Route::post('test/{id}', function($id) {
return $id
});

and call it by a button?

<a href="website.com/test/1234"> send </a>
07 Feb
4 months ago

nyel-dev started a new conversation How To Pass Data To PATCH

I have this code:

{{ html()->modelForm($role, 'PATCH', route('admin.auth.role.update', $role))->class('form-horizontal')->open() }}

I would like to ask what is the first parameter $role and what is the third parameter $role?

and also how do I pass the data from the form to the controller? What I was doing before is I am passing the ID of the item and the array of values but now my controller is receiving this:

public function update(UpdateRoleRequest $request, Role $role)
    {
        $this->roleRepository->update($role, $request->only('name', 'permissions'));

        return redirect()->route('admin.auth.role.index')->withFlashSuccess(__('alerts.backend.roles.updated'));
    }
15 Jan
5 months ago

nyel-dev started a new conversation How To Unset Appended Data From Model?

Suppose I have an append array in my model, how do I unset them from one of my controller?

29 Nov
6 months ago

nyel-dev left a reply on API That Returns JSON

@CINEK - Hi thanks for your help that solved the duplication but may I ask why was that happening before?

and also by putting "with('getInformation', 'getPictures')" does that mean it is appending the data into the $resort object?

nyel-dev started a new conversation API That Returns JSON

I have this Resort model

class Resort extends Model
{
    protected $hidden = [
        'owner_id', 'created_at', 'updated_at'
    ];

    public function getInformation() {
        return $this->hasOne(ResortInformation::class);
    }

    public function getPictures() {
        return $this->hasMany(ResortGallery::class);
    }
}

and this controller

class ResortController extends Controller 
{
    use App\Resort;

    public function getResortDetails($id) {
        $resort = Resort::find($id);

        return response()->json(
            $resort
        );
    }
}

How do I append my getInformation and getPictures data into the $resort object?

28 Nov
6 months ago

nyel-dev started a new conversation Can I Put If Else Statements Inside Methods Of Models?

just looking for best practice for this stuff

class User extends Authenticatable { public function isAdmin() { if($this->privilege === 1) { return true; }

    return false;
}

public function isOwner() {
if($this->privilege === 2) {
        return true;
    }
  
    return false;
}

public function isCustomer() {
    if($this->privilege === 3) {
        return true;
    }
  
    return false;
}

}

something like this

06 Nov
7 months ago

nyel-dev started a new conversation How To Send Template Email Using Sendgrid?

I would like to use my template in sendgrid as the view of my email in may laravel application. How can I possibly do this?

This is my current code:

Mail::raw('Raw string email', function($msg) { $msg->to(['[email protected]']) ->subject('Test email with sendgrid') ->embedData([ 'custom_args' => [ 'test_name' => "Test Name" ], 'template_id' => 'my_template_id' ],'sendgrid/x-smtpapi');

this mail sends the email but it just sends 'raw string email' in the body and it attaches a file 'sendgrid/x-smtpapi' but cant be viewed either to test the template