Chris1981

Chris1981

Member Since 3 Years Ago

Experience Points
16,370
Total
Experience

3,630 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
129
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 4
16,370 XP
14 Sep
1 week ago

Chris1981 started a new conversation Update Last Login When Requesting Oauth/token

Hey,

When I go to log in a user on my API using /oauth/token, I want to also update the user table with some login details, i.e

$user->update([
    'last_login_at' => Carbon::now()->toDateTimeString(),
    'last_login_ip' => $request->getClientIp()
]);

Is there any easy way of doing this?

09 Sep
1 week ago

Chris1981 started a new conversation Laravel Passport Mentor

Hey Guys,

Im looking for a mentor, someone that has a lot of knowledge with building API's with Laravel Passport.

I've got so many questions, and I would rather 'hire' someone to help me answer instead of flooding forums with questions that might sound daft to other people.

Any help would be greatly appreciated :)

Thanks in advance

08 Sep
2 weeks ago

Chris1981 started a new conversation Having Some Issues With Laravel Passport And Best Practices

Hey Guys,

I was wondering if I could get a little bit of code mentoring for a few issues im seeing. I have created a pure API instance of Laravel + Passport on api.domain.com and im consuming in a pure React instance on www.anotherdomain.com so they are completely different entities.

The issues im having are around authentication and the best / most secure ways of doing it. I have read quite a lot of tutorials and each one is quite different as to how they do it.

My currently login method in Laravel loooks like this;

public function login(Request $request)
{
    $request->validate([
        'email' => 'required|string|email',
        'password' => 'required|string'
    ]);

    $credentials = request(['email', 'password']);

    if(!Auth::attempt($credentials)) {
        return $this->sendError('Unauthorized', '', 401);
    }

    $user = $request->user();

    $tokenResult = $user->createToken('Personal Access Token');
    $token = $tokenResult->token;
    $token->save();

    $data['access_token'] = $tokenResult->accessToken;
    $data['token_type'] = 'Bearer';
    $data['expires_at'] = Carbon::parse($tokenResult->token->expires_at)->toDateTimeString();

    return $this->sendResponse($data, 'User logged in successfully.');
}

This works fine, but is this the best way of doing it as I see some tutorials get a refresh token as well, but im not sure what that does. Also the expires_at is never used on the frontend.

On the frontend my login method is simple;

return axios.post(baseUrl + 'login', formData, {
    headers: {
        Accept: 'application/json'
    }
})
    .then(response => {
        const token = response.data.data.access_token;
        localStorage.setItem('access_token', token);

        return response;
    })
    .catch(error => {
        return error;
    })

This seems not to be all that secure storing the access_token in local storage .... Whats the best way of storing this?

Also, I was watching a tutorial with VUE and to protect a route, they simply used a conditional to check if the access_token was not null .... But this seems a bit ugly, what happens if that token had expired.

Sorry for the load of questions, but I can't seem to find a place to read that seems ......... good practice.

I dont want to put an app out into the public with terrible authentication.

Thanks in advance.

05 Sep
2 weeks ago

Chris1981 started a new conversation React Authentication Using Laravel Passport

Hey guys,

I was wondering if anyone knew of a resource to learn how to use Laravel Passport authentication in a React app.

I can't find anything anywhere.

Thanks in advance.

04 Sep
2 weeks ago

Chris1981 started a new conversation Password Reset API Being Consumed From Different Frontend Urls

Hey Guys,

I am following a tutorial found here https://medium.com/modulr/api-rest-with-laravel-5-6-passport-authentication-reset-password-part-4-50d27455dcca for developing an API.

Im wondering how it would be possible to consume this from different frontend URL's given that the password reset link in the email points to one domain.

Is it possible to send something that gives the email function a dynamic link to access?

I hope that makes sense.

22 Jun
3 months ago

Chris1981 started a new conversation Retrieving Information From 3 Tables

I'm trying to get information from 3 tables in Laravel 5.8 but so far i have just come up with nothing.

The 3 tables look something similar to the following;

polls
    id - integer
    name - string
    status - tinyint

poll_options
    id - integer
    poll_id - integer
    image_id - integer
    status - tinyint

poll_images
    id - integer
    filename - varchar

A poll has several poll options, those poll options have 1 images each.

I would like to get poll options with the poll status of 1 and any images that have poll options with a status of 1

I need the get the filename, the poll option id and the poll id.

I'm so confused

Any help would be greatly appreciated.

17 Jun
3 months ago

Chris1981 left a reply on Converting MySQL To Laravel Migration

@aurawindsurfing .. Thanks, I will check it out. Cheers,

Chris1981 left a reply on Converting MySQL To Laravel Migration

Hey @aurawindsurfing ... Thats what im having trouble with, is writing the bottom bits by hand.

This is what I have so far

$table->bigIncrements('id');
$table->bigIncrements('poll_id');
$table->string('name', 255);
$table->tinyInteger('status')->nullable(false)->default(1);
$table->timestamps();

But the rest i dont know how to do

Chris1981 started a new conversation Converting MySQL To Laravel Migration

Hey Hey,

Im in the process of creating some migrations for a sample thing im writing, i have the original SQL table structure but im having a little trouble when it comes to the primary key, key, and constraint at the bottom.

I would really appreciate some help. The SQL is as follows;

CREATE TABLE `poll_options` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `poll_id` int(11) NOT NULL,
 `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 `created` datetime NOT NULL,
 `modified` datetime NOT NULL,
 `status` enum('1','0') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
 PRIMARY KEY (`id`),
 KEY `poll_id` (`poll_id`),
 CONSTRAINT `poll_options_ibfk_1` FOREIGN KEY (`poll_id`) REFERENCES `polls` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
14 Jun
3 months ago

Chris1981 left a reply on Thoughts On A Voting Component

@johnbraun ... I have never thought about it ... I guess my thinking is that because its a small element, just stick with MySQL

Chris1981 started a new conversation Thoughts On A Voting Component

Hey Guys,

Im looking for a bit of advice regarding a voting component that im working on using Laravel.

Basically I have a page with 5 images on it, each with a vote button underneath ... A votes for an image they like ... Pretty simple.

Currently I am adding a new row in my database for 1 vote, so my table consists of the following columns; voteid, vote, datetime, ip address.

So when someone votes, it creates a new record with the voteid of the current images, a 1 in the vote field, the date and time someone voted and their IP address.

This is leading to a massive database table. I want to try and come up with a new way of doing this so that I can cut down on the amount of rows but im having trouble thinking of how else i would do it.

If anyone has done this before or has any suggestions on a solution, i would greatly appreciate it.

Cheers,

10 Jun
3 months ago

Chris1981 started a new conversation Administration Panel For An API

Hey Guys,

I would love some input from some other members.

I'm building my first API and consuming this API using a React frontend totally seperate to my Laravel installation.

for instance, my API is myapi.net and my frontend is iamasexyfrontend.com

I want to be able to administer the information flowing into my API via a user interface.

What would my best option here, should i make a completely new subdomain, i.e admin.myapi.net in react and connect it to the API, should I use the built in views that come with Laravel to administer? but then how would I authenticate to my Passport routes?

Any advice would be greatly appreciated.

Peace!

19 Mar
6 months ago

Chris1981 left a reply on Running Multiple Homestead Instances

@CRONIX - Nice one!

The steps in the articles you linked works perfect.

Thanks!

17 Mar
6 months ago

Chris1981 started a new conversation Running Multiple Homestead Instances

Hey All,

I'm wondering if someone could point me in the right direction.

I have my laravel/homestead vagrant box setup just the way I want, i have to use the older version as i need support for PHP 5.6

What I want to do, is add the newest laravel/homestead box for some new projects, but leave the older one for my legacy app.

Is there any way to add laravel/homestead again so I can run both instances seperate?

Cheers,

08 Nov
10 months ago

Chris1981 left a reply on Adding ACL To A Laravel API

Anyone? Please :)

07 Nov
10 months ago

Chris1981 started a new conversation Adding ACL To A Laravel API

Hey Guys,

Im using Laravel 5.7 as an API for an app im building, which is using JWT-Auth for authentication.

At this stage i would like to add an ACL to the mix.

Can anyone recommend a good ACL which works nicely with JWT-Auth.

Cheers,

12 Oct
11 months ago

Chris1981 left a reply on Returning A Generated Token In A Test

Thanks guys, thats worked now :)

Much appreciated for all your help, sorry about the back and forth.

Chris1981 left a reply on Returning A Generated Token In A Test

@D9705996 Sorry to be a pain, but thats also erroring out.

ErrorException: json_decode() expects parameter 1 to be string, object given

@tykus im also getting an error from this

ErrorException: Illegal string offset 'data'

Chris1981 left a reply on Returning A Generated Token In A Test

@tykus that doesn't check to see if there is a value in the token though does it?

Chris1981 left a reply on Returning A Generated Token In A Test

@D9705996 damn, now im getting the following;

PHPUnit\Framework\Exception: Argument #2 (No Value) of PHPUnit\Framework\Assert::assertCount() must be a countable or iterable

My whole test is as follows;

public function it_logs_a_user_in()
{
    $user = factory(User::class)->create([ 'password' => Hash::make('foobar') ]);
    $payload = [ 'email' => $user->email, 'password' => 'foobar' ];

    $response = $this->json('POST', '/api/login', $payload);
    $response->assertStatus(200)
        ->assertJsonFragment([
            'success' => true,
            'message' => 'Yehhh Boiiiii'
        ])
        ->assertJsonCount(1, 'data.token');
}

Chris1981 left a reply on Returning A Generated Token In A Test

@D9705996 thats ok .. This is what i am getting using dd($response)

+original: array:3 [
    "success" => true
    "message" => "Yehhh Boiiiii"
    "data" => array:1 [
        "token" => "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3RcL2FwaVwvbG9naW4iLCJpYXQiOjE1MzkzMzM0NjMsImV4cCI6MTUzOTMzNzA2MywibmJmIjoxNTM5MzMzNDYzLCJqdGkiOiJscTNMVE00Q2FIbkJiUTlUIiwic3ViIjoxLCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.2ufSUEmW6FwxirRHrPU5tyb-Y9zrBss4ap0oIHxny2Y"
    ]
]

The token is there, but I just cant seem to get it into the assert statement

Chris1981 left a reply on Returning A Generated Token In A Test

@D9705996 I get the following error

BadMethodCallException: Method Illuminate\Http\JsonResponse::toArray does not exist.

Chris1981 started a new conversation Returning A Generated Token In A Test

Hey Guys,

Im trying to write a test to check if a user gets successfully logged into our system

For some reason, its not seeing the token generated by the login endpoint.

I want to assert 3 things in my test.

  1. That the success flag is true .. This is currently working
  2. The message is set .. This is currently working
  3. The token gets returned .. This is the bit that i cant seem to get going.

My test is as follows;

public function it_logs_a_user_in()
{
    $user = factory(User::class)->create([ 'password' => Hash::make('foobar') ]);
    $payload = [ 'email' => $user->email, 'password' => 'foobar' ];

    $response = $this->json('POST', '/api/login', $payload);
    $response->assertStatus(200)
    ->assertJsonFragment([
        'success' => true,
        'message' => 'Yehhh Boiiiii'
    ]);
}

Looking at the response in Postman, i get the following;

{
    "success": true,
    "message": "Yehhh Boiiiii",
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9qb2JtYW5oZWxpb3MudGVzdFwvYXBpXC9hcGlcL2xvZ2luIiwiaWF0IjoxNTM5MzIyODcyLCJleHAiOjE1MzkzMjY0NzIsIm5iZiI6MTUzOTMyMjg3MiwianRpIjoiaXpQc2pvM0QxNm1SZ0VlayIsInN1YiI6MSwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.ny4BKt0gcUCDiQ1a5bvsfwvcQfdV3nEPZAWVzBvziHo"
    }
}

Whatever i do, i cant seem to get the token returned.

Any help would be grand :)

05 Oct
11 months ago

Chris1981 left a reply on Moving Validation Into A Form Request But Use Custom Response

@martinbean Im using the league/fractal package and am following the 'build apis you wont hate' book, in there, all the response methods are put in the base controller.

Chris1981 left a reply on Moving Validation Into A Form Request But Use Custom Response

@D9705996 Thats not a bad idea actually, that way i could use it in my middleware as well instead of just controllers right?

Chris1981 left a reply on Moving Validation Into A Form Request But Use Custom Response

@D9705996 Hey thanks for that, im building an API so i kind of need it all in the backend.

If my formatResponseObject method was in my base controller, would i just need to use App\Http\Controllers\Controller; in my form request to access that method?

Chris1981 started a new conversation Moving Validation Into A Form Request But Use Custom Response

Hey,

I want to move my validation rules out of my controller into a custom form request thingo, if the validation fails at the moment, it have it calling a custom method.

Can I still do this with a form request?

This is what i have at the moment

$validator = Validator::make($request->all(), [
    'name' => 'required|string',
    'email' => 'required|string',
    'password' => 'required|string'
]);

if($validator->fails()){
    return $this->formatResponseObject($validator->errors()->first());
}

Is this possible using a form request?

04 Oct
11 months ago

Chris1981 left a reply on Suggestions For JSON API Response Package

@mykola is that exactly what the Fractal package does?

Chris1981 left a reply on Suggestions For JSON API Response Package

Hey @bobbybouwmann ... I am going to change my answer, as im currently reading 'Build APIs you wont hate' and it seems as if the Fractal package is actually developed by the author of the book.

Chris1981 left a reply on Suggestions For JSON API Response Package

@bobbybouwmann thank you for that, it looks like the cloudcreativity package is the one that fits the specifications right.

Nice one :) Thanks

Chris1981 started a new conversation Suggestions For JSON API Response Package

Hey Guys,

I was wondering if anyone could suggested a good package they have used to format their JSON API responses as close as possible to JSON-API (http://jsonapi.org/) specifications?

Cheers all

30 Aug
1 year ago

Chris1981 left a reply on Must Be An Instance Of Illuminate\Http\Request, Instance Of StdClass Given

Im thinking that might be the best option sujancse

Chris1981 left a reply on Must Be An Instance Of Illuminate\Http\Request, Instance Of StdClass Given

@tisuchi It's already there.

My controller imports are as follows;

namespace App\Http\Controllers;

use JWTAuth;
use App\Models\User;
use JWTAuthException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Tymon\JWTAuth\Exceptions\JWTException;

Chris1981 started a new conversation Must Be An Instance Of Illuminate\Http\Request, Instance Of StdClass Given

Hey Guys,

I'm having a bit of an issue figuring out how to pass a Request object from my javascript application to my laravel backend.

In my javascript framework i am doing the following;

var formData = new FormData();
formData.append("email", username);
formData.append("password", password);

and then passing the formData to my laravel endpoint.

My authenticate function is just a standard;

public function authenticate(Request $request)

The problem is that everytime i try to run my code, i am getting;

Argument 1 passed to App\Http\Controllers\AuthController::authenticate() must be an instance of Illuminate\Http\Request, instance of stdClass given

Does anyone know how I can solve this?

26 Jul
1 year ago

Chris1981 started a new conversation Mapping A Site To A Folder Of Another Site In Homestead

Hey Guys,

I currently have a javascript framework being spooled up on a URL thats mapped in Homestead.yaml just as an example, lets say www.mysite.test

I am building the API in Laravel for the JS framework to get its data from.

I want to be able to have that at www.mysite.test/api

Is there any way to achieve this using the Homestead.yaml, or would this require some in depth messing around?

Thanks

12 Jul
1 year ago

Chris1981 left a reply on Am I Testing The Logout Correctly.

@tykus hey again hahaha .. I think i may need to hire you hahaha

I am using the following; "tymon/jwt-auth": "dev-develop" in my composer.json.

This is my route;

    Route::group(['middleware' => 'auth.jwt'], function () {
        Route::get('user', '[email protected]');
    Route::get('logout', '[email protected]');
    });

Im using the request for the logout method as well.

I know this is a big ask, but i used the following tutorial to learn to implement it, is it a bad tutorial? https://tutsforweb.com/restful-api-in-laravel-56-using-jwt-authentication/

It doesn't use the Authorization header at all

Chris1981 started a new conversation Am I Testing The Logout Correctly.

So im new to testing, and i want to make sure im doing it right.

I'm using JWT-Auth for my API token generation, i want to test that a user gets logged out properly.

Could someone have a look at the following and let me know if its any good, i kind of feel like its not the right thing, but i dont know how to make it better

    public function it_logs_out_properly()
    {
        $user = factory(User::class)->create([ 'password' => bcrypt('foobar') ]);
        $payload = [ 'email' => $user->email, 'password' => 'foobar' ];

        $token = JWTAuth::fromUser($user);

        $this->json('GET', '/api/user', ['token' => $token])->assertStatus(200);
        $this->json('GET', '/api/logout', ['token' => $token])->assertStatus(200);

        $this->json('GET', '/api/user', ['token' => $token])->assertStatus(401);
    }

The /api/user endpoint routes to the following method;

    public function getAuthUser(Request $request)
    {
        // Check for a token in the request
        $this->validate($request, [
            'token' => 'required'
        ]);

        // Get the user details based on the token
        $user = JWTAuth::authenticate($request->token);

        return response()->json(['user' => $user]);
    }

Any guidance would be greatly appreciated.

Chris1981 left a reply on AssertJson Isn't Seeing The Json That Is Being Returned

hahaha don't facepalm, the assertJsonFragment you suggested has made my testing so much easier now ... Much respect!

Chris1981 left a reply on AssertJson Isn't Seeing The Json That Is Being Returned

Hey @tykus thanks for that, i didnt know assertJsonFragment existed, i had to add brackets around the messages though, but it worked ... The final working function is as follows;

    public function it_requires_name_and_email_and_password_to_register()
    {
        $response = $this->post('/api/register');
        $response->assertStatus(422)
            ->assertJsonFragment([
                'name' => ['The name field is required.'],
                'email' => ['The email field is required.'],
                'password' => ['The password field is required.'],
            ]);
    }

Chris1981 started a new conversation AssertJson Isn't Seeing The Json That Is Being Returned

I'm trying to write a simple test to make sure the authentication is working correctly ( Laravel 5.6 ) as seen below;

public function it_requires_name_and_email_and_password_to_register()
{
    $response = $this->post('/api/register');
    $response->assertStatus(422)
        ->assertJson([
            'name' => 'The name field is required.',
            'email' => 'The email field is required.',
            'password' => 'The password field is required.',
        ]);
}

But for some reason its failing even though the request has the required information.

The following is what phpunit is returning;

There was 1 failure:

1) Tests\Unit\AuthenticationTest::it_requires_name_and_email_and_password_to_register
Unable to find JSON:

[{
    "name": "The name field is required.",
    "email": "The email field is required.",
    "password": "The password field is required."
}]

within response JSON:

[{
    "message": "The given data was invalid.",
    "errors": {
        "name": [
            "The name field is required."
        ],
        "email": [
            "The email field is required."
        ],
        "password": [
            "The password field is required."
        ]
    }
}].


Failed asserting that an array has the subset Array &0 (
    'name' => 'The name field is required.'
    'email' => 'The email field is required.'
    'password' => 'The password field is required.'
).
--- Expected
+++ Actual
@@ @@

         )

-    [name] => The name field is required.
-    [email] => The email field is required.
-    [password] => The password field is required.
 )

Am i missing something?

08 Jul
1 year ago

Chris1981 left a reply on Dealing With Redirections In Testing Environment

Hey Guys,

Thanks for the answers, but how do i change the property value in the test?

If I do something like;

public function it_registers_successfully()
{
    $loginAfterSignUp = false;

    $user = factory(User::class)->create([ 'password' => bcrypt('foobar') ]);

    $payload = [ 'name' => $user->name, 'email' => $user->email, 'password' => 'foobar' ];

    $response = $this->post('/api/register', $payload);
    $response->assertStatus(200);
}

I still get the same result

Chris1981 left a reply on Dealing With Redirections In Testing Environment

@lostdreamer_nl thanks for that ... But how would I change the value of loginAfterSignUp in a test if i move it to config?

Chris1981 started a new conversation Dealing With Redirections In Testing Environment

I am using Laravel 5.6 with the JWT-Auth package, I have a simple test which checks a user is able to be registered, as follows;

public function it_registers_successfully()
{
    $user = factory(User::class)->create([ 'password' => bcrypt('foobar') ]);

    $payload = [ 'name' => $user->name, 'email' => $user->email, 'password' => 'foobar' ];

    $response = $this->post('/api/register', $payload);
    $response->assertStatus(200);
}

When i run the test i am receiving the following;

Expected status code 200 but received 302.
Failed asserting that false is true.

I am new to testing, but i think the problem is that the register function checks to see if the user should be logged in on a successful register and then does it, hence the redirection.

I know this is defeating the purpose and going backwards to how its meant to be done, but i would like some advice on how to deal with the redirection and see the 200 status.

The function is as follows;

public $loginAfterSignUp = true;

public function register(RegisterAuthRequest $request)
{
    // Build new user collection
    $user = new User();
    $user->name = $request->name;
    $user->email = $request->email;
    $user->password = bcrypt($request->password);

    // Save user
    $user->save();

    // Check if user should be automatically logged in
    if ($this->loginAfterSignUp) {
        return $this->login($request);
    }

    return response()->json([
        'success' => true,
        'data' => $user
    ], 200);
}
24 May
1 year ago

Chris1981 started a new conversation Purely API Implementation

Hey Guys,

I'm setting up a purely API implementation on my Laravel install, I will also be using JWT for authentication and all that bollocks.

As i will be writing all new authentication logic, can i delete the Controllers/Auth directory that ships with Laravel or will that make things go tits up?

Is there anything else i can get rid of being a API only implementation?

I hope that makes sense.

Cheers,

12 Mar
1 year ago

Chris1981 left a reply on Passport + Auth

Anyone?

10 Mar
1 year ago

Chris1981 started a new conversation Passport + Auth

Hey Guys,

Before i go ahead with setting everything up, im wondering if its possible to use Laravel Passport and the standard Laravel Auth on the same project.

So that i can offer an API to people and also have members access for my frontend.

Cheers,

01 Feb
1 year ago

Chris1981 left a reply on Homestead Script For Installing Nginx On Centos

@bobbybouwmann .. Sorry to bug you .. But if i take the installation scripts from the homestead provision script and place it in a scripts/install-nginx.sh will that run on every vagrant up? or just when i do a vagrant provision --reload

Chris1981 left a reply on Homestead Script For Installing Nginx On Centos

Ohhh ... I can use that to rip out the install scripts ... I didnt think of that, doiiiiii.

Thanks @bobbybouwmann