cisco

cisco

Member Since 3 Years Ago

Experience Points 8,050
Experience Level 2

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

13 Feb
2 years ago

cisco left a reply on Passport - Customising Token Response

You'll need to provide your own implementation of the token. I believe the class you need to override is PersonalAccessTokenFactory

https://github.com/laravel/passport/blob/2.0/src/PersonalAccessTokenFactory.php#L68

01 Nov
2 years ago

cisco left a reply on Collection Definition In Migration

@Snapey then I would have the following for Nickname:

$table->foreign('nickname_id')->references('id')->on('nicknames')->onDelete('cascade');

and the migration for Program would remain the same as above in my original question?

cisco started a new conversation Collection Definition In Migration

I'm a bit confused as to how to defined the has many relationship in the table migration. Given the following model:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Program extends Model
{
    public function nicknames()
    {
        return $this->hasMany('App\Nickname');
    }

    ...

We can assume that the model Nickname also has the inverse defined:

public function program()
    {
        return $this->belongsTo('App\Program');
    }

Knowing that I create the following migration for Program:

Schema::create('programs', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('fax');
            $table->string('tollFree');
            $table->string('email');
            $table->string('email');
            $table->string('website');
            $table->timestamps();
        });

Now my question is, how do I represent the has many collection defined in the model in the migration? The only thing in the documentation that I see that may be relavent is the part on index: https://laravel.com/docs/5.3/migrations#indexes , but I'm not sure how this exactly works. I've googled around and it appears something such as $table->foreign('todolist_id')->references('id')->on('todolists')->onDelete('cascade'); is what I'd have to do?

28 Nov
3 years ago

cisco left a reply on Base Table Or View Not Found

Be sure to check your model to ensure you spelled the table name correctly.

protected $table = 'tableName';

Note if you don't specify a table name manually, it will assume the plural version of the model name if I recall correctly.

All php artisan migrate does is create the tables and columns in the database based on the migrations in database\migrations. If you made changes to .env they try restarting the server.

cisco started a new conversation Passing GET Parameter To View Composer.

I've been searching around, but haven't come accross to what I've been trying to accomplish.

So I'm aware we can pass data to a view by simply doing:

return view()->with($someVar);

Now I have the following route:

Route::get('/details/{id}', function() {
        return view('auth.details');
    });

Which is handled by my DetailsServiceProvider:

public function boot()
    {
        view()->composer(
            'auth.details', 'App\Http\ViewComposers\DetailsComposer'
        );
    }
    
    public function register()
    {
        $this->app->bind(
            'App\Repositories\Contracts\AlgaContract',
            'App\Repositories\AlgaRepository'
        );
    }

Now my DetailsComposer is:

public function __construct(AlgaRepository $alga, Request $request)
    {
        $this->alga = $alga;
        $this->request = $request;
    }
    
    public function compose(View $view)
    {
        $alga = $this->alga->show($this->request->get('id'));
        $view->with($alga);
    }

I added the Request to the constructors parameters because if I recall correctly, that is handled by PHP's reflection? Now, the issue I'm having is this line specifically: $alga = $this->alga->show($this->request->get('id'));

However, in a different view composer, in its compose() function, I have a similar line: $view->with('algae', $this->alga->all()); which works perfectly.

Am I missing something here to get the {id} from the get request into the compose() function?

23 Nov
3 years ago

cisco left a reply on Deploying Laravel To Subdirectoy [Digital Ocean VPS]

@shez1983 I'm not sure what you mean by this. Is that something set in the .env file or? I don't think that would be the issue since everything lives within the laravel folder. I think the issue is with the compiled blade templates maybe? Which would have to do with as you said the paths, but I'm not sure how to proceed from here.

cisco started a new conversation Deploying Laravel To Subdirectoy [Digital Ocean VPS]

I keep getting a 404 Not Found whenenver I navigate away from the index page. After extensive googling and sleeping on it, I just can't wrap my head around on how to resolve this issue.

My directory structure is as follows, note I'm deploying to subdirectory on a subdomain:

/var/www/dev.site.io/
├── public_html/
│   ├── img/
│   ├── mobile/
│   ├── styles/
│   ├── se/
│   └── index.html
└── laravel/
    ├── app/
    ├── bootstrap/
    ├── ... 

The path I'm trying to deploy to is se/ (se short for software engineering for a project). Now rather then just copy the contents in Laravels public/ directory as other threads have mentioned, I softlinked the contents of the public/ folder to the se/ folder as other threads have mentioned as well.

Also ran in write permissions so set chmod 775 to Laravels storage/ folder and everything worked, but..navigate away from the index.php and I'm hit with 404 Not Found. I've included my routes below, any help is appreciated.

<?php

Route::get('/', function () {
    return view('pages.index');
});

// Authentication routes
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes
Route::get('/register', 'Auth\AuthController@getRegister');
Route::post('/register', 'Auth\AuthController@postRegister');

// Protected routes
Route::get('/dashboard', ['middleware' => 'auth', function() {
    return view('auth.dashboard');
}]);

I'm aware I could just create another subdomain on my VPS and set the document root to point to the public/ folder, but I'm determined to get it to work in a subdirectory.

20 Nov
3 years ago

cisco left a reply on Inconsistencies In Documentation For Eloquent?

@anzze Oh my I see now, thank you! But still... I feel that this should be a footnote in the documentation for Eloquent though or something. :confused:

cisco started a new conversation Inconsistencies In Documentation For Eloquent?

I'm building an api using Lumen however I've been having some trouble with using Eloquent. Specifically it seems that there are some inconsistencies within the documentation for Eloquent.

In the documentation for Lumen, it states the following:

Of course, you may easily use the full Eloquent ORM with Lumen. To learn how to use Eloquent, check out the full Laravel documentation.

Awesome! The documentation checks out ok until we get to Adding Additional Constraints. It gives the following snippet:

$flights = App\Flight::where('active', 1)
               ->orderBy('name', 'desc')
               ->take(10)
               ->get();

However the static method where() does not exist in Illuminate\Database\Eloquent\Model. In fact if you search the source or do a get_class_methods() (gives this dump.) on the class, you'll see that there isn't one single method that contains where.

Another thing I found was the static method find() also does not exist in Illuminate\Database\Eloquent\Model, even though again the documentation gives an example for it. However, these two methods do exist in \Illuminate\Database\Eloquent\Collection. But to get there, you'd have call a method that returns an Eloquent Collection:

$data = SomeModel::getAll();
$data->find(...);
$data->where(...);

Also findOrFail() does not exsit in Model either,findOrNew(), firstOrCreate(), firstOrNew() do however.

I installed Lumen through lumen new site command, ran composer dumpautoload to see that fixed anything, but nothing changed. Am I missing something here or is the documentation out of date?