francoboy7

Experience

18,055

0 Best Reply Awards

  • Member Since 2 Years Ago
  • 193 Lessons Completed
  • 0 Favorites

10th April, 2018

francoboy7 left a reply on Laravel + Vuejs/Vuefire + Firebase • 2 months ago

+1

1st April, 2018

francoboy7 started a new conversation Using Laravel For A Volunteer Database • 2 months ago

Hi Everyone,

I'm the webmaster of a NGO and we use Wordpress for our websites and for volunteer registrations. We require uploads of various personal files such as passport copy and resumes.

Right now we are using a wordpress plugins to do all this, however, I sometimes feel like I don't have 100% control over how things are handled (what the plugin does, how it does it, is it safe etc.).

I was wondering what were your thoughts about using laravel to manage user registrations and document uploads.

If I were to follow Laravel best practices, would you feel confident uploading such information as a volunteer ?

Also if any developers would be interested in helping me build such a thing, just let me know (if It's against the forum rules I'll delete that request). For now the registrations would not be an issue, however I haven't touch file management so far so that would be a challenge.

The project would be : User registration + User Information filling (jobs, experiences etc) + user uploading certificates/passport/resume. Very basic, but a high need for it to be 100% secure.

As always, thanks for taking the time to read this

20th March, 2018

francoboy7 left a reply on Some Advices Needed For A Career Move • 3 months ago

Thanks guys for all your inputs, it helps tremendously and keep them coming if anyone passes through.

@peterjonesio special thanks to you for the detailed reply

18th March, 2018

francoboy7 left a reply on Some Advices Needed For A Career Move • 3 months ago

Thanks for the reply Shez

17th March, 2018

francoboy7 started a new conversation Some Advices Needed For A Career Move • 3 months ago

Hi everyone

I wanted your advice on a personal subject concerning the programming world. I'm currently employed as a part-time paramedic (25 years old) and looking into a career change. I've been light coding php / html / css for a while and the occasional Wordpress contract here and there.

Here is what my perfect future would look like. Living abroad in another country, doing some freelance work as a programmer. Being able to move to another country every 6-12 months. Take weeks off here and there no boss. I'm not looking to work 40 hours / week. I aim at 25-30 hrs/week. However I don't mind pulling 50 hours/week if that means having 3 weeks off after !

My living expenses are pretty low, I normally make 20k-30K $CAD a year and I'm living fine with this.

Now I'm learning Laravel because I find it to be a beautiful framework and fun to work with. It has been a challenge but I love it. However, I wouldn't mind having to program in another language for freelance work and then programming my own personal projects with Laravel.

Now the questions :

  • Am I dreaming here?
  • Is it at all possible to achieve this plan?
  • Is learning PHP and Laravel the good way to go about doing freelance programming work ?
  • Could someone learn Laravel and then specialized in wordpress customization, building plugins with Laravel (I know it can be done)
  • Should I learn another language instead, one that is more "widely" hired in the freelance world.

Sorry for the heartfelt post, but the Laravel community has always been of kind and good advices.

Thanks for reading and sorry for the typos, french native speaker here

17th February, 2018

francoboy7 left a reply on A Bit Lost In All Of This... • 4 months ago

Thanks a lot for your comment

My PHP Skills are Moderate I'd say ;) I did build simple projects.

If you'd like to recommend some series for PHP I'm listening ;) (I did the PHP Beginner course).

Do you guys have any recommendation for Javascript Learning ?

To be honest I'm using the Lynda Javascript Essential course but they aren't as "interactive and fun" as Jeffrey's video...

francoboy7 started a new conversation A Bit Lost In All Of This... • 4 months ago

Hi there

First of all, I wanted to say that your content and Website is AMAZING ! I've learned so much from all this.

But,

I'm a beginner in all of this (laravel and also Vue) and I'm kind of lost in where to start.

I've followed the following

  • Laravel from Scratch serie
  • Learn Vue 2 serie

I am now looking at my next step. My knowledge in javascript is basic (variable, basic function etc.)

I'm tempted by the "Build a forum" serie, however it appears to be the step #15, of my learning laravel adventure, but when I take a look at the previous lesson, I feel like I'm in over my head with things like : socket. io and advanced eloquent technique

So here I am, contemplating all the lessons on laracasts and asking for advice. Maybe I'm overthinking this and I should jump on the forum serie, but let me know your take on this

Cheers

Let me know

8th February, 2018

francoboy7 left a reply on Which Series To Learn Vue.js ? • 4 months ago

I searched the forum ( as I should have before posting)

People suggest starting with Vue 2 even if it says "intermediate"

Let me know what you think about my question #2 .

Thanks

francoboy7 started a new conversation Which Series To Learn Vue.js ? • 4 months ago

Quick questions

I want to learn Vue.js and have some basic knowledge of javascript to start with.

  • 1- Should I follow the "Learn Vue 1 " first and then move to "Learn Vue 2" or start with "Learn Vue 2 " right away.

  • 2- Is a basic knowledge of javascript, loop, DOM, enough or should I master javascript totally before learning vue.

Thanks ;)

3rd February, 2018

francoboy7 left a reply on Am I Refactoring The Right Way ? • 4 months ago

So how does one would catch the error 403 if the user is not authorize ?

francoboy7 left a reply on Am I Refactoring The Right Way ? • 4 months ago

Thanks everyone,

I'll dive into this today ?

2nd February, 2018

francoboy7 started a new conversation Am I Refactoring The Right Way ? • 4 months ago

Hey guys,

Just wanted to know if I'm doing my "refactoring" in a good way or I am under thinking this, or overthinking this.

What do you think of this, is it secure/safe ? Is there a way Laravel already check this logic and I'm just duplicating for nothing ?

Thanks a lot !

OLD CODE (in my [email protected])

public function destroy ($id)
{

        $quote = Quote::find($id);
        if ($quote->user_id == auth()->user()->id) 
        {

            $quote->delete();
            session()->flash('message-style', 'success');
            session()->flash('message', 'Citation supprimée !');

            return redirect ('/');
        }
        else {

            session()->flash('message-style', 'danger');
            session()->flash('message', 'Vous ne pouvez pas supprimer une citation qui ne vous appartient pas!');
            return redirect ('/');

        }
    }

NEW CODE (in [email protected])

public function destroy ($id)
{

        $quote = new Quote;

        if ($$quote->hisQuote($id))
        {
        
            return redirect ('/');

        } else {
        
            return redirect ('/');

        }
    }

QUOTE.PHP MODEL

public function hisQuote ($id)
{
    $quote = $this->find($id);
    // check if user_id of Quote matched Authenticated user id
    if ($quote->user_id === auth()->user()->id) 
    {
        $quote->delete();
        session()->flash('message-style', 'success');
        session()->flash('message', 'Citation supprimée !');
        return true;

    } 
    else 
    {
        session()->flash('message-style', 'danger');
        session()->flash('message', 'Vous ne pouvez pas supprimer une citation qui ne vous appartient pas!');
        return false;
    }

    
}

27th January, 2018

francoboy7 left a reply on Displaying User Name Of A Relationship • 4 months ago

Ok beginner mistake, I did some migrate:refresh and did not recreate users so the table was empty...

Sorry for the dumb question

Cheers

francoboy7 left a reply on Displaying User Name Of A Relationship • 4 months ago

Table User added

'{{ optional($track->user)->name }}

Is not working though....

francoboy7 started a new conversation Displaying User Name Of A Relationship • 4 months ago

Book Model

class Book extends Model
{
    protected $primaryKey = 'book_id'; // or null

    public $incrementing = false;

    public function tracks ()
    {
        return $this->hasMany('App\Track', 'book_id', 'book_id');
    }
}

Track Model

class Track extends Model
{
   
        public function user ()
        {
            return $this->belongsTo(User::class);
        }


        public function book ()
        {
            return $this->hasOne('App\Book', 'book_id', 'book_id');
        }
}

Books Table enter image description here

Tracks Table enter image description here

Here lies my problem (one of them anyway) It doesn't display anything... I know it has something to do with array VS collection but I dont know what.

So each row in Track table belongs to a specific user

How would I go about displaying the user name which belongs to a track.

@foreach ($book->tracks as $key=>$track)

    {{ $track->country }} // this works
    
    {{ $track->user['name'] }} // this doesn't display anything
    
    {{$track->user-name }} // this throws "Trying to get property of non-object"
    
@endforeach

Thanks

22nd January, 2018

francoboy7 started a new conversation Insert_php_constructor_property Not Working As Expected • 4 months ago

Hi guys

My problem concerns the PHPCompanion sublime packages that Jeffrey talks about in his Sublime Series. More specifically the insert_php_constructor_property command.

It works well for the first class, but whenever I'm writing down another class further down the document and trigger the command (using escape) it jumps back to the top of the document and the first class and just adds another argument.

Any hints on how I could trigger it specifically for the class my cursor is on?

Thanks in advance

30th September, 2015

francoboy7 left a reply on Where Clause With Array • 2 years ago

@mezuky Hey do you have any idea why my "id" results would always be of value = 1 ? Thanks


[
{
"id": 1,
"user_id": 1,
"start": "2015-09-25",
"end": "2015-09-26",
"start_time": "00:00",
"end_time": "00:00",
"shift_number": "G4545",
"sector": "est",
"active": 0,
"taken_by": 0,
"accepted_at": "0000-00-00 00:00:00",
"created_at": "2015-09-23 01:30:06",
"updated_at": "2015-09-29 13:43:11",
"date": "2015-09-25",
"preferences_sector": "est",
"preferences_jsn": "jour",
"first_name": "Francois",
"last_name": "Auclair",
"email": "francois.auclair.911@gmail.com",
"password": "$2y$10$ZpmnJUG0dKUhs7lYekJVge9ccMti6kJ09WMK8asSnYjx5B9YHGrx2",
"matricule": 6977,
"remember_token": null
},
{
"id": 1,
"user_id": 1,
"start": "2015-11-01",
"end": "2015-11-01",
"start_time": "00:00",
"end_time": "00:00",
"shift_number": "K8888",
"sector": "est",
"active": 0,
"taken_by": 0,
"accepted_at": "0000-00-00 00:00:00",
"created_at": "2015-09-23 01:30:06",
"updated_at": "2015-09-29 13:43:11",
"date": "2015-11-01",
"preferences_sector": "ouest",
"preferences_jsn": "soir",
"first_name": "Francois",
"last_name": "Auclair",
"email": "francois.auclair.911@gmail.com",
"password": "$2y$10$ZpmnJUG0dKUhs7lYekJVge9ccMti6kJ09WMK8asSnYjx5B9YHGrx2",
"matricule": 6977,
"remember_token": null
},
{
"id": 1,
"user_id": 1,
"start": "2015-11-02",
"end": "2015-11-02",
"start_time": "00:00",
"end_time": "00:00",
"shift_number": "P9999",
"sector": "est",
"active": 0,
"taken_by": 0,
"accepted_at": "0000-00-00 00:00:00",
"created_at": "2015-09-23 01:30:06",
"updated_at": "2015-09-29 13:43:11",
"date": "2015-11-02",
"preferences_sector": "ouest",
"preferences_jsn": "soir",
"first_name": "Francois",
"last_name": "Auclair",
"email": "francois.auclair.911@gmail.com",
"password": "$2y$10$ZpmnJUG0dKUhs7lYekJVge9ccMti6kJ09WMK8asSnYjx5B9YHGrx2",
"matricule": 6977,
"remember_token": null
}
]

18th September, 2015

francoboy7 left a reply on Where Clause With Array • 2 years ago

@mezuky I owe you a drink ! Thanks

francoboy7 left a reply on Where Clause With Array • 2 years ago

@mezuky thank you for your time. I want to get from DatesAvailable (dates_available table) all the records that have the same date as the dates from SwapDates (swap_dates table)
In simple words Get from DatesAvailable all the records (row) that have the same dates (date column) as the date column of SwapDates table

17th September, 2015

francoboy7 started a new conversation Where Clause With Array • 2 years ago

    $user = Auth::user();
        $swaps = $user->getswapdates()->get();
    $availables = DatesAvailable::all();

$swaps Returns :

"id": 50,
"user_id": 1,
"start": "2003-06-16",
"end": "2014-11-24",
"start_time": "04:20",
"end_time": "04:20",
"shift_number": "G1234",
"sector": "Ex.",
"created_at": "2014-12-27 15:29:39",
"updated_at": "1991-02-08 01:42:05"

$availables returns :

"id": 1,
"user_id": 50,
"date": "2005-03-21",
"preferences_sector": "Est.",
"preferences_jsn": "Sit.",
"created_at": "1982-11-15 19:00:14",
"updated_at": "1978-04-23 13:30:24"

I'm looking for a way to check if in DatesAvailable I can find one or more entry that is in $swaps

I tryed playing with

                 ->whereIn

Without success Any help will be welcome Oh and I'm very new to all this

Thanks !

14th September, 2015

francoboy7 left a reply on Relationship Establishment • 2 years ago

@phildawson Is there a link where I can find every Laravel conventions ? Like singular names vs plurals / way to name files, classes, controllers etc...

francoboy7 left a reply on Relation Shop Establishment • 2 years ago

Thank you to everyone !

So It works now, but I wanted your input on the relation, do they seem alright ?

francoboy7 left a reply on Relation Shop Establishment • 2 years ago

Updates...

Needed to fix my routes.php (->get()) ''' $swap = SwapDates::where('user_id', $user->id)->get(); '''

francoboy7 started a new conversation Relation Shop Establishment • 2 years ago

Hey everyone, I'm new to Laravel so i'm hitting walls after walls, but hopefully I'll get through. So I want to set a relation within my model.

Basically a user submit available dates to work and dates he doesn't want to work So A User hasMany Dates Available (Model : DatesAvailable) A User hasMany DatestoSwap and now i'm getting confused. Date Available belongsTo a User (or hasMany / belongsToMany) Dates to Swap belongsTo a User (or hasMany / belongsToMany)

User.php

<?php
namespace Horaire;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword;

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

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['first_name','last_name', 'email', 'password', 'matricule'];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = ['password', 'remember_token'];

    public function getswapdates()
    {

        return $this->hasMany('\Horaire\SwapDates');

    }

    public function getavailabledates()
    {

        return $this->hasMany('\Horaire\DatesAvailable');

    }

}

DatesAvailable.php '''

namespace Horaire;

use Illuminate\Database\Eloquent\Model;

class DatesAvailable extends Model { protected $fillable = array('user_id', 'date', 'preferences_sector', 'preferences_jsn');

public function user()
{

    return $this->belongsTo('User');

}

}

'''

SwapDates.php '''

namespace Horaire;

use Illuminate\Database\Eloquent\Model;

/**

  • Class SwapDates

  • @package Horaire */ class SwapDates extends Model { // protected $fillable = array('user_id', 'start', 'end', 'shift_number', 'sector');

    /**

    • @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function user() {

      return $this->belongsTo('User');

    }

} '''

Now I want to test this so in route.php

''' Route::get('{id}', function($id)

{ $user = User::find($id)->first();

$swap = SwapDates::where('user_id', $user->id);

echo  $swap;

}); '''

And it returns : ''' 1/1 ErrorException in routes.php line 69: Object of class Illuminate\Database\Eloquent\Builder could not be converted to string '''

Any ideas ?

27th August, 2015

francoboy7 left a reply on The Right Way To Use Migrations • 2 years ago

I'd say edit it if it is already containing data or create a new one if the existing one is empty. I suggest http://laravel.com/docs/5.1/migrations for some more info. However i'm a Laravel beginner so take my advices with a grain of salt

francoboy7 left a reply on The Right Way To Use Migrations • 2 years ago

I think it's easier for maintenance, for example if you need to rollback on of your table, having them all in the same file would force you to rollback every table in the file. Does that make sense ?

francoboy7 left a reply on Google Map Problem • 2 years ago

@tronix Thanks, I was going crazy with all this ! By the way you can also just set the height to any pixels size on a DIV containing the map. Because targeting every "map-canvas" may be too generic for some project (different heights etc.)

Thanks again !

25th August, 2015

francoboy7 left a reply on Figuring Out Database Structure • 2 years ago

@frezno Thank you for your time and help ! Now, time for some Laracast Series !

francoboy7 left a reply on Figuring Out Database Structure • 2 years ago

Hi Fresno, thank you for your input, I should try that. Oh an quick question how do you normally proceed to create a new functionality for example, do you create the route first then the database then the controller? Is there a preferred order to proceed? Thank you!

24th August, 2015

francoboy7 left a reply on Figuring Out Database Structure • 2 years ago

@frezno Thanks for your input,

What I don't get (newbie here) is how will I be able to put multiples "date_to_work" in one single row ?

Separate them with comma ? Because the user won't put ALL his schedule into the system, only shifts he doesn't want.

Alt text

If I do 1 table as you suggest I would have a typical row looking like this

id user_id start_date_to_get_rid end_date_to_get_rid shift_num sector start_date_i_can_work etc 1 43 2015/08/08 23:00:00 2015/08/09 07:00:00 2 N 2015/08/10,2015/08/11,2015/08/12

As you can see, the start_date_i_can_work, will need to contain multiple date no ? isn't that a problem to manage after ? (or i just explode() them ) Or I could create a row for each "start_date_i_can_work" but then I'd repeat myself over and over ? (is that better)

id user_id start_date_to_get_rid end_date_to_get_rid shift_num sector start_date_i_can_work etc 1 43 2015/08/08 23:00:00 2015/08/09 07:00:00 2 N 2015/08/10 2 43 2015/08/08 23:00:00 2015/08/09 07:00:00 2 N 2015/08/11 3 43 2015/08/08 23:00:00 2015/08/09 07:00:00 2 N 2015/08/12

Thanks for your help :D

francoboy7 left a reply on Figuring Out Database Structure • 2 years ago

Hi @frezno, first thank you for taking the time to read me.
I like your idea and it inspired me to try something, what do you think of this database structure ?

Inline-style: ![alt text](http://i.imgur.com/BsBEp3o.png ")

francoboy7 left a reply on What GeoIP Service Provider Do You Use? • 2 years ago

@Presto The demo page is giving me a good location (Montréal, Canada) not far from the US though so maybe that's why it's working

francoboy7 started a new conversation Figuring Out Database Structure • 2 years ago

Hi everyone I am working on a website idea. It's for my company. It will allow the users to swap work shifts. For example : Marc (user ) doesn't want to work On the 26th of august from 11AM to 11PM.

He is free on the 27th of August and the 29th. Marc (user) is then looking for someone (let's say Adam(another user)) who would work for him on the 26th and give Marc one of his shift that he has on the 27th or 29th of august. it be accurate to say that shifts have a start and end datetime. Users enter certain shifts they don't want,and in order to reassign a shift between users, a transaction is made by 2 users each providing a shift they belong to where the user assignment is switched.

The schedules are always changing (ambulance crew) some full time, some part times. This service would be just to swap some specific date (always changing) For example I am booked on 26th and got a last minute appointement. So I'm basically looking for another coworker to take my shift. However I can't just "give" him my shift, I need to swap a shift with him. We get our schedule monthly but they change afterward

Multiple questions arise from this as I'm new to Laravel.

How should (could ?) I create my databases (especially the one concerning dates) Should I create a "Dates" table containing column like :"user_id", "date_to_swap","date_available_to_work" (and should I then separate the dates with a comma or period if the person has a lot of free days that he could swap) Will I need a pivot table (I'm pretty certain I will) Is there any "date" packages that can help me manage more easily (should it be front-end or back-end) As I said I'm really new to this, and I'm just starting to comprehend Laravel so this is basically to open my mind on some ways to realize my project (because developers all have their different ways.) And for clarification I'm using Laravel 5.1

I thought about something like this

user_id | date_to_swap

 1    |  12-07-2018  
 1    |  17-07-2018  
 2    |  13-07-2018
 3    |  12-07-2018  
 3    |  17-07-2018

But then I'll need another table for the date that he is able to work (for the swap) no ?

Thank you all for your help, I hope I'm clear enough...

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.