emfpc

emfpc

Member Since 10 Months Ago

Experience Points
880
Total
Experience

4,120 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-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 1
880 XP
Oct
10
1 week ago
Activity icon

Replied to Only Get The Count() Of The Current Month

The forum doesn't allow me to have two best answers 😅and both of them actually work when i tweak it. And since both of them actually help me wanted to give them best answer. I don't have the heart to select only one

Activity icon

Replied to Only Get The Count() Of The Current Month

Both tips from @jlrdw and @snapey are correct:

 ->whereYear('created_at', Carbon::now()->year)->whereMonth('created_at', Carbon::now()->month)->count();
$ticketsCount = Ticket::whereYear('created_at', Carbon::now()->year)->whereMonth('created_at', Carbon::now()->month)->count();
Oct
09
1 week ago
Activity icon

Replied to Only Get The Count() Of The Current Month

It showing the same values. do i need to format the created_at since it shows d/m/y

 $ticketsCount = DB::table('tickets')->whereMonth('created_at', Carbon::now()->month)->count();
Activity icon

Started a new conversation Only Get The Count() Of The Current Month

Trying to get the count of a table but only from the current month. Example, in the table i got 10 tickets made between sep and oct. I just want to have the count of all the tickets created in octuber and when we move to nov it will only display the ones created in nov. This is has far has i got:

$ticketsCount = DB::table('tickets')->count('created_at');

Sep
18
1 month ago
Activity icon

Replied to Encryp Image To Later Read In View

Will give it a go.

Sep
17
1 month ago
Activity icon

Replied to Encryp Image To Later Read In View

The images are sensitive since the have information of the users. I thought in order to protect the data I need to encrypted the file and decrypted when the authentic user is log in.

Activity icon

Replied to Encryp Image To Later Read In View

I'm able to upload images to the storage. Made a link to the public folder. the name is encrypted but i am able to see the picture when i use the Image tag

Sep
16
1 month ago
Activity icon

Replied to Encryp Image To Later Read In View

Already know how to upload the images. i was able to encrypt the images is the way to read it that can't find a way to put just the name of the file.

Activity icon

Started a new conversation Encryp Image To Later Read In View

Currently, using a form, I let the user upload a picture. This picture is later store in the Database. I'm trying to encrypt de data that goes to the Database plus the image. In my controller i doing this:

$user->identification = Crypt::encrypt($request->input('identification'));
if($img = $request->file('identification')){
                $img->storeAs('upload/images/Identification Files', "Ticket #".$ticket->ticket_number."_".$completname.".".$img->getClientOriginalExtension());
}

In the database it show the name of the identification field is encrypted but the image is not.

Try this one instead:

$user->identification = Crypt::encrypt($request->input('identification'));
$img = Crypt::encrypt($request->file('identification')->get());
Storage::put('upload/images/Identification Files/'.'Ticket#'.$ticket->ticket_number.'_'.'IdentificationOf_'.$completname,$img);

with this i was able to change the image but in order to read it on a view need to put the name of the file by hand in order to read it: *In User Controller @index:

$encryptedContent = Storage::get('upload/images/Identification Files/*NameOfTheFile');
$decryptedContent = decrypt($encryptedContent);
return view('photo', compact('encryptedContent', 'decryptedContent'));

*in the Photo view:

<img src="data:image/png;base64,{!! base64_encode($decryptedContent) !!}" alt="" />

The last one show the image but i'm trying to get the image to display when i looking for a particular user without inputing the name of the file is Storage::get.

Help will be appreciate. If is not easy to understand please let me know.

Jul
03
3 months ago
Activity icon

Started a new conversation Laravel Exporting To Excel Number Field

Greetings. Currently i'm working with a export plug in where i must export data to excel everything works on my end but were i need the field to display example Credit Card Number of 16 character it round it. i have tried to format the column but it won't work in some cases. Is there a way a can bypass the format?

The Export Code: ' public function columnFormats(): array { return [ 'X' => NumberFormat::FORMAT_NUMBER, 'P' => NumberFormat::FORMAT_CURRENCY_USD, ]; }

public function view(): View{
    $guests=Guest::all();
    return view('form.export',compact('guests'));
}

'

The P column works which add the $ sign

Jun
06
4 months ago
Activity icon

Replied to 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
Activity icon

Replied to 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.

Activity icon

Replied to 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

Activity icon

Replied to 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();

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

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 = 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
May
28
4 months ago
Activity icon

Replied to Decrypt Data In Blade

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

Activity icon

Replied to 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)

Activity icon

Replied to Decrypt Data In Blade

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

Activity icon

Replied to Decrypt Data In Blade

@FNOUAL - Did not also work

Activity icon

Replied to Decrypt Data In Blade

@FNOUAL - Did not work

Activity icon

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

Apr
29
5 months ago
Activity icon

Replied to Passing The Api_token In Header When The User Log In

Thanks for all the advice. They were mush big help

Apr
24
5 months ago
Activity icon

Replied to Passing The Api_token In Header When The User Log In

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

Activity icon

Replied to 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.

Activity icon

Replied to 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.

Activity icon

Replied to Passing The Api_token In Header When The User Log In

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

Activity icon

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

Apr
23
5 months ago
Activity icon

Replied to 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

Activity icon

Replied to 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?

Activity icon

Replied to 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

Activity icon

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.

Activity icon

Replied to Auth::user() In Api Route

@SNAPEY - Thanks for the heads up.

Apr
22
5 months ago
Activity icon

Replied to Auth::user() In Api Route

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

Activity icon

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?