albusSeverus

albusSeverus

Applications Developer at AAPM

Member Since 2 Years Ago

Mumbai

Experience Points
3,110
Total
Experience

1,890 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
27
Lessons
Completed
Best Reply Awards
0
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 1
3,110 XP
Sep
04
1 month ago
Activity icon

Replied to Eloquent Relationship Coding Error

@cronix your code helped. I had to remove the foreign key and other key from the relationship methods. Thanks everyone for your help.

Activity icon

Replied to Eloquent Relationship Coding Error

Doesnt help.

Activity icon

Replied to Eloquent Relationship Coding Error

@mabdullahsari thanks for the suggestion, though your suggested code didnt work, its similar to what @cronix said.

@cronix no output for some reason, which I feel weird bcoz it doesnt show any error. But Im sure thats what required here.

@foreach ($instList as $institution)
    <tr>
        <td>{{$institution->name}}</td>
        <td>{{$institution->city}}</td>
        <td>@if ($institution->state) {{$institution->state}} @endif</td>
        <td>
            @foreach ($institution->user as $iuser)
                {{ $iuser->display_name }} , 
            @endforeach
        </td>
    </tr>
@endforeach
Activity icon

Replied to Eloquent Relationship Coding Error

if I do this "$institution->user " it shows all the data correctly, picking the column is what I need.

@sti3bas thanks for the changes. Doesn't show any error, but no results as well.

@cronix Thats what I was thinking. Let me try that. Thanks.

Activity icon

Replied to Eloquent Relationship Coding Error

Tried "users" doesnt change the result.

Trying to show a list of institutions and the users associated with them. Users can be one or many.

What changes should I make ?

Activity icon

Started a new Conversation Eloquent Relationship Coding Error

Hello,

I have a piece of code to my puzzle(project). Still on the learning path for Laravel

Can somebody please help me point out what am I doing wrong here?

Model Code:

class Institution extends Model
{
  public function user()
  {
    return $this->hasMany('App\Models\User', 'id', 'institution_id');
  }
}

class User extends Authenticatable
{
  public function institution()
  {
    return $this->belongsTo('App\Models\Institution', 'institution_id', 'id');
  }
}

Controller Code:

protected function search(Request $request, InstitutionRepository $repository)
{    
  $instList = $repository->findAll();
  return view('auth.register-institution-search', compact('instList'));
}

View Code:

@foreach ($instList as $institution)
  <tr>
    <td>{{$institution->name}}</td>
    <td>{{$institution->city}}</td>
    <td>@if ($institution->state) {{$institution->state}} @endif</td>
    <td>{{ $institution->user->display_name }}</td>
  </tr>
@endforeach

Repository Function:

public function findAll()
{
   return Institution::all();
}

This is the error Im getting:

Property [display_name] does not exist on this collection instance. (View: /blah/blah/blah/views/auth/register-institution.blade.php)

Thanks.

Jun
19
4 months ago
Activity icon

Replied to Calling Repository Method In Command Handle() To Execute Mail()

Also tried :

public function handle(OpeningRepository $opening_repo, UserRepository $repository)
    {
        //
        $data = $repository->findAllApplicantsOptIn()->implode(',');
        $openings = $opening_repo->findAll();

        foreach(explode(',', $data) as $to) {
            Mail::to($to)
                ->bcc('xxxx')
                ->send(new WeeklyUpdatesApplicant($openings, $data));
        }
    }
Activity icon

Started a new Conversation Calling Repository Method In Command Handle() To Execute Mail()

Im trying to execute a task scheduler to mail a list of users when condition is satisfied at a given date and time.

Problem Im facing is calling the repository method to fetch the list of users to mail to and pass the information in the email from another model.

Command File:

<?php
namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Repositories\OpeningRepository;
use App\Repositories\UserRepository;
use App\Mail\WeeklyUpdatesApplicant;
use App\Models\Opening;
use App\Models\User;

class SendWeeklyUpdatesApplicant extends Command
{
    public $opening;
    public $user;
   
    protected $signature = 'emails:applicant-updates';

    protected $description = 'This command will send emails to all applicants who have opt-in for emails every week, if there are any openings available';

    public function __construct(Opening $opening, User $user)
    {
        parent::__construct();

        $this->opening = $opening;
        $this->user = $user;
    }

    public function handle()
    {
        $data = $this->user->findAllApplicantsOptIn()->implode(',');
        $openings = $this->opening->findAll();

        foreach(explode(',', $data) as $to) {
            Mail::to($to)
                ->bcc('xxxx')
                ->send(new WeeklyUpdatesApplicant($openings, $data));
        }
    }
}

Mail File:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Models\Opening;
use App\Models\User;

class WeeklyUpdatesApplicant extends Mailable
{
    use Queueable, SerializesModels;

    public $openings, $user;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(Opening $openings, User $user)
    {
        $this->openings = $openings;
        $this->user = $user;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->subject('MP RAP Update '.date('m-d-Y'))
                    ->view('emails.admin.applicant-updates');
    }
}
Jun
04
4 months ago
Activity icon

Replied to Laravel 5.6 Request->file Returns Null And Cannot Store Files

Solved my problem as well for file upload on edit form.

Thanks.

May
21
4 months ago
Activity icon

Replied to Setting SoapHeader With Guzzle??

use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;

        $client = new Client();
        $result = $client->request('GET', $baseURL, [
            'Authenticate' => [
                'userName' => $userName, 
                'password' => $password
            ],
            'body' => $xmlRequest,
            'headers' => [
                "Content-Type" => "text/xml; charset=utf-8"
            ]

        ]);
        dd($result);
May
09
5 months ago
Activity icon

Replied to Passing Data Object From Blade To Modal In Laravel

@bekaskaki Since its an active project, I can only share so much.

public function listOpenings(Request $request, OpeningRepository $repository, BookmarkRepository $bookmarkRepo, OpeningApplicationRepository $openingApplRepo)
    {
        $user = $request->user();
        $openings = $repository->findAll();
        $bookmarks = $bookmarkRepo->findByUser($user->id, 'opening');
        $applied = $openingApplRepo->findByUser($user->id);

        return view('applicants.bookmarks.openings', compact('openings', 'bookmarks', 'applied'));
    }
Activity icon

Replied to Passing Data Object From Blade To Modal In Laravel

No replies ? wow.. can anyone atleast suggest any alternative method to this ?

May
07
5 months ago
Activity icon

Started a new Conversation Passing Data Object From Blade To Modal In Laravel

Im pulling multiple data objects from controller to the blade template and then passing that information to each modal popup for further user interaction, I do have some conditional checking.

Problem is how do I pass my object to the modal directly and do the conditional formatting?

Modal Code

<div class="modal-footer">
        <!-- Add condition to see if user has already applied to this opening or not -->
        @foreach ($applied as $user_applied)
            @if($user_applied->opening_id == $opening->id) 
              <button type="button" class="btn btn-primary" disabled="disabled">Applied </button>
            @else
              <button type="button" data-id="{{$opening->id}}" id="application" data-create-url="{{ route('applicants.bookmarks.openings.apply', $opening->id) }}" class="btn btn-primary">Apply <span class="glyphicon glyphicon-send" aria-hidden="true"></span></button>
            @endif  
        @endforeach
        <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
      </div>

Controller Code

return view('applicants.bookmarks.openings', compact('openings', 'bookmarks', 'applied'));

View Code

@each('applicants.bookmarks.opening-modal', $openings, 'opening')
May
06
5 months ago
Activity icon

Replied to How Can I Create Events In Google Calendar Using Spatie Google Calendar Package

As the documentation says, it's an event. So basically on the page loading your google calendar will have a trigger for calling the event. I would do a javascript trigger to that event.

Events you can create here:

  1. Create Calendar event
  2. Edit/Update event (provide id parameter to the event trigger)
  3. Delete event (provide id parameter to the event trigger)

Rest of the information can be passed from your form for google calendar or your own input form

Pass that information to the controller, controller method triggers the event functionality, which will generate your event. On success/error you can display message.

Update calendar view on successful event registration.

Just a broad view of how I would have done it.

Check Laravel Documentation for more info on events: https://laravel.com/docs/5.8/events#generating-events-and-listeners

Activity icon

Replied to Staging Set Up Best Practices?

@MIKEHOPLEY - This is similar to what I have, can you share the details on the server setup for staging and production, like how is the folder structure or mapping or any other information. Sorry if I sound a lil noob, new to Laravel world. I have Linux AWS for both staging and production and will be launching my web app soon.

Right now I have the git/bitbucket setup with develop and master branches and also me and my colleague use module based branches to push our changes and then merge it with dev.

Then the dev is pushed to staging for further testing and evaluation by the program director or other people.

I also want to have other websites(vanilla php/web-app) on that same staging server, hence my question for how do I configure my servers.

Thanks in advance for the help.

Apr
30
5 months ago
Activity icon

Replied to Check Encrypted File On File Uploads

@TRAY2 - Thanks. Yeah something like this, but using the Laravel functions. Will try to create something from this.

Apr
29
5 months ago
Activity icon

Replied to Check Encrypted File On File Uploads

@TRAY2 - Im referring to the pdf file uploads with password protection or some other form of encryption. E.g. like uploading resume or transcript pdf but locked by password protection. How do I detect and prevent those ?

Activity icon

Started a new Conversation Check Encrypted File On File Uploads

Hi all,

I have a script which uploads file and checks for file size and type(pdf only) for my web-app, saves it the folder, saves path in the dbase.

My question: How do I check if the file uploaded by the user is encrypted or password protected and prevent that?

My Laravel knowledge: basic, can get things done.