emfpc

emfpc

Member Since 5 Months Ago

Experience Points 650
Experience Level 1

4,350 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 2
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

06 Jun
1 week ago

emfpc left a reply on Passing Form Information In View Before Saving To DB

@SNAPEY - I will give it a go. I was able to do it very much differently :). Add a new function called guestdata

        $guest = $request->all();
        return view('form.registrationformviewdata', compact('guest'));
    }```

did a new route

Route::get('registration','[email protected]');


The original form will go to the new route since i change the method to get and the new form that has the review data has the original submit that runs with the create function. Weird way but it works:)

Thank you for all of your helps. Really in love with laracast

emfpc left a reply on Passing Form Information In View Before Saving To DB

@EMERSONCAIQUE - That was my plan but i need to save in a way the guest first since hes the primary relationship i have for the other tables. But i will run you tip.

emfpc left a reply on Passing Form Information In View Before Saving To DB

@SNAPEY - Before given the data to the database i need to pass the data to a view with the information and then when the client hit the button then is saved in the database. They need to review the data before saving it to the database

emfpc left a reply on Passing Form Information In View Before Saving To DB

        $guest = new Guest;
        $guest->confirmation_order = rand(10000, 30000);
        $guest->name = Crypt::encryptString($request->input('name'));
        $guest->email = $request->input('email');
        $guest->mobile = Crypt::encryptString($request->input('mobile'));
        $guest->residence = Crypt::encryptString($request->input('residence'));
        $guest->office = Crypt::encryptString($request->input('office'));
        $guest->fax = Crypt::encryptString($request->input('fax'));
        $guest->address1 = Crypt::encryptString($request->input('address1'));
        $guest->address2 = Crypt::encryptString($request->input('address2'));
        $guest->city = Crypt::encryptString($request->input('city'));
        $guest->state = Crypt::encryptString($request->input('state'));
        $guest->country = Crypt::encryptString($request->input('country'));
        $guest->zip_code = Crypt::encryptString($request->input('zip_code'));
        $guest->save();

        // //Registration Fee Information
        $registrationfee = new RegistrationFee;
        $registrationfee->guest_id = $guest->id;
        $registrationfee->registration_type = Crypt::encryptString($request->input('registration_type'));
        $registrationfee->company_representative = Crypt::encryptString($request->input('company_representative'));
        $registrationfee->total_fee = $request->input('total_fee');
        $registrationfee->save();

        // //Hotel Reservation Information
        $hotel = new HotelReservation;
        $hotel->guest_id = $guest->id;
        $hotel->arrival_date = $request->input('arrival_date');//date('Y-m-d');
        $hotel->departure_date = $request->input('departure_date');//date('Y-m-d');
        $hotel->bed_selection = Crypt::encryptString($request->input('bed_selection'));
        $hotel->adults = Crypt::encryptString($request->input('adults'));
        $hotel->child = Crypt::encryptString($request->input('child'));
        $totalguest = $request->input('adults') + $request->input('child');
        $hotel->total_guest = $totalguest;
        $hotel->special_requests = Crypt::encryptString($request->input('special_requests'));
        $hotel->save();

        // //Payment Information
        $payment = new PaymentInformation;
        $payment->guest_id = $guest->id;
        $payment->creditcardnum = Crypt::encryptString($request->input('creditcardnum'));
        $payment->credit_type = Crypt::encryptString($request->input('credit_type'));
        $payment->expdate = Crypt::encryptString($request->input('expdate'));
        $payment->creditcardname = Crypt::encryptString($request->input('creditcardname'));
        $payment->seccode = Crypt::encryptString($request->input('seccode'));
        $payment->save();

        $validate = Validator::make(Input::all(), [
            'g-recaptcha-response' => 'required|captcha'
        ]);

        // Mail Section
        // $data = ['confirmation'=> $guest->confirmation_order];     
        // Mail::send('mails.exmpl',$data, function($message) use ($guest){
    
        //     $message->to($guest->email, 'Esther')->subject('Cardiologia PR');
    
        // });

        // return Redirect('/thankyou');
        // $confirmation = $guest->confirmation_order;
        //return view('form.thankyou', compact('confirmation'));
        // return Redirect::to('/thankyou')->with(compact('confirmation'));
        return view('form.registrationformviewdata', compact('guest'));```

emfpc started a new conversation Passing Form Information In View Before Saving To DB

I may sound crazy but I'm trying to pass form information to a view before saving it to a DB. For the form i'm using a resource where everything is in the store method. i can pass the information to a view and see it but when i press the button the data is store. and i'm using different models in one controller.

This is the store method:

//Guest Information $guest = new Guest; $guest->confirmation_order = rand(10000, 30000); $guest->name = Crypt::encryptString($request->input('name')); $guest->email = $request->input('email'); $guest->mobile = Crypt::encryptString($request->input('mobile')); $guest->residence = Crypt::encryptString($request->input('residence')); $guest->office = Crypt::encryptString($request->input('office')); $guest->fax = Crypt::encryptString($request->input('fax')); $guest->address1 = Crypt::encryptString($request->input('address1')); $guest->address2 = Crypt::encryptString($request->input('address2')); $guest->city = Crypt::encryptString($request->input('city')); $guest->state = Crypt::encryptString($request->input('state')); $guest->country = Crypt::encryptString($request->input('country')); $guest->zip_code = Crypt::encryptString($request->input('zip_code')); $guest->save();

    // //Registration Fee Information
    $registrationfee = new RegistrationFee;
    $registrationfee->guest_id = $guest->id;
    $registrationfee->registration_type = Crypt::encryptString($request->input('registration_type'));
    $registrationfee->company_representative = Crypt::encryptString($request->input('company_representative'));
    $registrationfee->total_fee = $request->input('total_fee');
    $registrationfee->save();

    // //Hotel Reservation Information
    $hotel = new HotelReservation;
    $hotel->guest_id = $guest->id;
    $hotel->arrival_date = $request->input('arrival_date');//date('Y-m-d');
    $hotel->departure_date = $request->input('departure_date');//date('Y-m-d');
    $hotel->bed_selection = Crypt::encryptString($request->input('bed_selection'));
    $hotel->adults = Crypt::encryptString($request->input('adults'));
    $hotel->child = Crypt::encryptString($request->input('child'));
    $totalguest = $request->input('adults') + $request->input('child');
    $hotel->total_guest = $totalguest;
    $hotel->special_requests = Crypt::encryptString($request->input('special_requests'));
    $hotel->save();

    // //Payment Information
    $payment = new PaymentInformation;
    $payment->guest_id = $guest->id;
    $payment->creditcardnum = Crypt::encryptString($request->input('creditcardnum'));
    $payment->credit_type = Crypt::encryptString($request->input('credit_type'));
    $payment->expdate = Crypt::encryptString($request->input('expdate'));
    $payment->creditcardname = Crypt::encryptString($request->input('creditcardname'));
    $payment->seccode = Crypt::encryptString($request->input('seccode'));
    $payment->save();



    return view('form.registrationformviewdata', compact('guest'));

I think i may approach this the wrong way

28 May
2 weeks ago

emfpc left a reply on Decrypt Data In Blade

Scratch that. It work. pass a mutator to decrypt my data.....now to do it one by one :)

emfpc left a reply on Decrypt Data In Blade

@WILK_RANDALL - i'm getting this: ErrorException (E_ERROR) unserialize(): Error at offset 0 of 15 bytes (View: C:\xampp\htdocs\cardio-pr\resources\views\form\index.blade.php)

emfpc left a reply on Decrypt Data In Blade

@DEVFREY - I tied with a mutator, it did not work

emfpc left a reply on Decrypt Data In Blade

@FNOUAL - Did not also work

emfpc left a reply on Decrypt Data In Blade

@FNOUAL - Did not work

emfpc started a new conversation Decrypt Data In Blade

Hello,

I'm displaying my data in a view; the data is encrypted.

To encrypt data I'm using: use Illuminate\Support\Facades\Crypt; Crypte::encryptString(#);

and to decrypted data: Crypte::decryptString(#);

how can i decrypt data when i'm in Blade Template:

    @foreach ($guests as $guest )
        <li>{{ ($guest->name) }}</li>
            
        @endforeach
    

The data it shows but is encrypted.

thanks in advance

29 Apr
1 month ago

emfpc left a reply on Passing The Api_token In Header When The User Log In

Thanks for all the advice. They were mush big help

24 Apr
1 month ago

emfpc left a reply on Passing The Api_token In Header When The User Log In

@BOBBYBOUWMANN - will check which option will work for use. thanks

emfpc left a reply on Passing The Api_token In Header When The User Log In

@BOBBYBOUWMANN - We use the data as follow: the log user will have a like form page with the information of the patient, pull by a front end developer; all that information is in the database but can only be accessible if the user is log in, if hes not log in there's no data to extract. I run the controllers and input data in the API. We will be using the log in feature of laravel.

emfpc left a reply on Passing The Api_token In Header When The User Log In

@BOBBYBOUWMANN - Both. My part, the API side, is to give the log in user access to the data.

emfpc left a reply on Passing The Api_token In Header When The User Log In

@BOBBYBOUWMANN - Sorry for asking, still new; how will i approach what your saying?

emfpc started a new conversation Passing The Api_token In Header When The User Log In

So far I was able to understand the whole API thing in Laravel thanks to you guys. I'm able to see the information of the user in my controller if the user passes the api_token in the header; for testing reason in postman I copy and paste this information. I was wondering if theres is a way when the user (using Laravel log in feature) logs in and want to ender a route protected with middleware('auth:api') can pass the api_token to the header. if there is another way or approach will love to hear it. I'm working as a backend developer

23 Apr
1 month ago

emfpc left a reply on How To Use Api_token

@DIEGOAURINO - will try it. still a little new to the whole API thing. all i wanted was to use this:

Route::group(['middleware' => ['auth:api']], function () {

Route::resource('usertable', 'UserController');

});

check if the user was log in and let the user see the data in the UserController:

public function index() { return User::all();

}

will give it a try with the other middleware

emfpc left a reply on How To Use Api_token

@WEBKENTH - Do you have a example? i have read the docs, don't understand much of it. How do i use the api_token?

emfpc left a reply on How To Use Api_token

@WEBKENTH - don't want to use the auth:api since i wan't to control what the user will see. just wan't to check if the user is log in in the API

emfpc started a new conversation How To Use Api_token

Got the api_token in the users table....with the documentacion I'm a little confuse. I'm trying to make my own middle ware that just check if the user is log in then he has acces to the route: (example) ApiTokenMiddleware public function handle($request, Closure $next) { $user = Auth::check(); if($user){ return redirect()->intended('hellow'); }

}

heres is the route:

Route::get('userinfo',function(){ return 'you got acces to the user table'; })->middleware('apitokenmiddleware:api');

*ApiToken is already in the kernel as apitokenmiddleware

what am I missing? I can get the User Table information regardless if I'm log out. Have no idea how to use the api_token when the user is created.

emfpc left a reply on Auth::user() In Api Route

@SNAPEY - Thanks for the heads up.

22 Apr
1 month ago

emfpc left a reply on Auth::user() In Api Route

@RICARDO - try to use auth('api')->user();. It won't show the user information

emfpc started a new conversation Auth::user() In Api Route

When using controllers i can run if statement in the function without using a middle ware to determine if a user has a role or is log in; example: if(Auth::user()->role == 'admin'){ return 'I'm Admin'; }else{ return 'i'm not admin; } something like that. But i wan't to use the same when using api routes; i understand there's a few stuff to be considered; is there away to use this simple logic for it?