ejobity

Experience

1,760

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 15 Lessons Completed
  • 0 Favorites

31st October, 2017

ejobity started a new conversation Understanding Requests In Controllers And Models • 3 weeks ago

I would like to ask for my understanding,

When i declare in a controller,

namespace App\Http\Controllers; use Illuminate\Http\Request;

in my controller, i call a model.

how come I do not have to declare it again in the model. All i do is request('name') in my model.

example: Controller

namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;

class UserController extends Controller
{   
    public function users()
    {
        User::setUser();
    }
}

example: Model

namespace App;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    public function user()
    {
        $person = request('name');
    }
}

why dont we use use Illuminate\Http\Request in the model. How come we can just use request();

11th September, 2017

ejobity left a reply on Why Does Factory Double The Count Of Records I Entered And Expect? • 2 months ago

@kfirba haha, your correct. Im impressed you know how the model i have would look like. You really know your stuff. Your solution worked. Thanks alot.

10th September, 2017

ejobity started a new conversation Why Does Factory Double The Count Of Records I Entered And Expect? • 2 months ago

Its weird, but i do this,

factory(Employer::class,3)->create()->each(function(Employer $employer) {
            $employer->addresses()->saveMany(factory(EmployerAddress::class,1)->create());
          });

I get 6 records filled with employers, when i entered only 3.

But when i do this:

 factory(Employer::class, 3)->create();

I get 3 employers and not the 6.

Is it a bug? Has anyone ever experienced this?

ejobity started a new conversation How To Register A Custom Component Using Laravel Collective? • 2 months ago

How to register a custom component with laravel collective?

I have followed everything in this link: https://laracasts.com/discuss/channels/laravel/registering-your-components-inside-a-service-providers-boot-method?page=1

I am using

"laravelcollective/html": "^5.5",

I have created my FormServiceProvider and added the required markup to correctly render the form.

<?php

namespace App\Providers;

use App\Form;
use Illuminate\Support\ServiceProvider;

class FormServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        // Register the form components
        Form::component('bsText', 'components.form.text', ['name', 'value', 'attributes']);
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

My Error message is:

"Class 'App\Form' not found"

Please help

6th September, 2017

ejobity started a new conversation What Frameworks Did Laracasts Use To Develop Its Website? • 2 months ago

Laracasts is an awesome website. I love the design and functionality.

What frameworks did laracasts use to build and operate its website? Did they build it from the ground up with laravel or did they use wordpres?

It has a wordpress touch and feel.

ejobity started a new conversation Whats The Difference Between Using Request('id') And $request->id • 2 months ago

I would like to know what is the difference between using request('id') and $request->id.

An example:

function () { $idnumber = request('id'); }

function (Request $request) { $idnumber = $request->id; }

What are the affects between the two if any?

Edit Your Profile
Update

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