Johny-22

Member Since 3 Weeks 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
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

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

Level 1
880 XP
May
07
2 days ago
Activity icon

Replied to Restrictions View

This is great this is how I do it Thank you

Activity icon

Replied to Restrictions View

I also have unregistered users so this won't help me. Thank you

Activity icon

Started a new Conversation Restrictions View

Hi everybody

How could I restrict / disable the view thank-you to which I redirect a customer after a successful process? Now everyone who calls / thank-you is public so the u view appears. Could this be disabled so that this view is displayed only if the operation is successful?

$cart->guestSuccessResponse($response, $cart);

   $label = $cart->getLabel($response);
   $invoice = $cart->getInvoice();

   Mail::send(new GuestOrderInvoice($shipmentData, $label, $invoice));

   return redirect()->route('thankyou');
May
05
4 days ago
Activity icon

Replied to Postal Code Validation

Oh sorry, of course. Germany, Poland, Austria, Belgium, Denmark, France, Croatia, Luxembourg, Hungary, Slovenia, Slovakia, Czech Republic, Finland, Portugal and Sweden

Activity icon

Replied to Postal Code Validation

It will be limited to certain countries

Activity icon

Started a new Conversation Postal Code Validation

Hi can you recommend me some tested zip validation package?

May
04
5 days ago
Activity icon

Replied to Protected Route

@abhijeet9920 this works but it will probably be really better to use authentication

Activity icon

Replied to Protected Route

This way, when I add to / coutries, json is displayed. How can this be done so that this address is unavailable and can only be called from inside the app, e.g. axios by calling?

Activity icon

Started a new Conversation Protected Route

Hi I have a route that returns json. This rout is called only from inside the axios application by calling. How could I disable the display of such a route when someone comes to the address? I would like this route to be called only from inside the application. Thanks

Route::group(['prefix' => '/api'], function () {
    Route::get('/countries', [CountryController::class, 'index']);
    Route::get('/countries/filters', [CountryController::class, 'filters']);
});
Activity icon

Replied to Phone Request Validation

Thank you all for your advice. In the end I decided to use https://github.com/Propaganistas/Laravel-Phone as recommended @tykus we'll see how it works live. Well thank you

May
03
6 days ago
Activity icon

Started a new Conversation Phone Request Validation

Hello, can you advise me how I would best validate such a phone number format as best I can? +421915490545 area code +421 and then 10 numbers. I'm using a request validator and I've tried it with regey, but I can't

May
01
1 week ago
Activity icon

Started a new Conversation Edit Checkbox

Hi, could anyone advise? When editing if the value of input 1 is to be checked. In my case it doesn't work because I use alpine to display other inputs and the show is set to false. How to fix it? Thanks

<div x-data="{show: false}" >
<input @click="show = true" id="dobierka" type="checkbox" x-model="show"
          value="1"
          name="cod"
           {{ old('cod', $shipment->cod) == '1' ? 'checked' : '' }}>
</div>
Apr
26
1 week ago
Activity icon

Awarded Best Reply on BelongsToMany::replicate()

SOLVED 😎

public function duplicateShipment(Shipment $shipment)
    {
        $cart = Cart::bySession()->first();

        $duplicateShipment = $shipment->replicate();

        $duplicateShipment->save();
        
        $cart->shipments()->syncWithoutDetaching($duplicateShipment);

        return back();
    }

Activity icon

Replied to BelongsToMany::replicate()

SOLVED 😎

public function duplicateShipment(Shipment $shipment)
    {
        $cart = Cart::bySession()->first();

        $duplicateShipment = $shipment->replicate();

        $duplicateShipment->save();
        
        $cart->shipments()->syncWithoutDetaching($duplicateShipment);

        return back();
    }

Activity icon

Started a new Conversation BelongsToMany::replicate()

Hi I'm trying to duplicate a record in the database and I'm getting such an error

Call to undefined method Illuminate\Database\Eloquent\Relations\BelongsToMany::replicate()

I'm trying to run the function like this

public function duplicateShipment(Shipment $shipment)
    {
        $cart = Cart::bySession()->first()->shipments()->replicate($shipment);
        $shipment->save();
        return back();
    }

Apr
25
2 weeks ago
Activity icon

Replied to Array

Oh, of course thank you 🧠😆

Activity icon

Started a new Conversation Array

Hi everyone, I try to go through such a field in the cycle so that the correct data is used in each cycle. In the first cycle 0 => array: 39 [▶] and so on ... When I make a foreach loop, return only 0 => array: 39 [▶] I don't know why it is at all so? So how could I go through such an array in a cycle so that I can use the right data in each cycle?

$cart = Cart::bySession()->first();

$shipmentData = $cart->shipments->toArray();

array:2 [▼
  0 => array:39 [▶]
  1 => array:39 [▶]
]
foreach ($shipmentData as $key => $value) {
      dd($value); 
   // return only value first array  [ 0 ]   array:39 [▶]
 }
Activity icon

Replied to Old Value Checkbox

Yes, thank you. That's exactly what I did, and it works perfectly.

Apr
24
2 weeks ago
Activity icon

Replied to Old Value Checkbox

Please now that when I try to edit this checbox it doesn't work. The checkbox is even if I send it empty. How can this be fixed?

Activity icon

Replied to Old Value Checkbox

Thank you very much

Activity icon

Started a new Conversation Old Value Checkbox

Hi, I can't return the old checkbox value when editing. Any advice? thanks

<input id="delivery_by_parcelshop" 
             type="checkbox"                                
             name="delivery_by_parcelshop"  
             value="old('delivery_by_parcelshop', $shipment->delivery_by_parcelshop) == 'on' ? 'checked' : ''" >
Apr
23
2 weeks ago
Activity icon

Replied to Edit Section

Thank you. @andyabihaidar Was the first so i will give him the best answer. @tisuchi It is a pity that the correct answer cannot be added more than once.

Activity icon

Started a new Conversation Edit Section

Hi, I have a form with which I send data to db. I need to edit this data now. I don't want to edit them all at once, but for example I want to edit addresses in one step and services in another. I have two buttons one for address editing services and the other for editing services. Is it necessary to do two functions for this, for example editAddress and editServices? Well thank you

Apr
21
2 weeks ago
Activity icon

Started a new Conversation Alpine Disabled Checkbox If Is One Checked

Hi everyone, Can't you advise me how to set up a disabled checkbox if one is checked? I need to be able to check only one input. Well thank you

<div  x-data="{ select: false }">

	<input id="service" type="checkbox" x-model="select" @click="select = ! select">

    <input name="date" id="date" type="date"
         x-bind:disabled="(select == 1) ? false : true"
         x-bind:required="(select == 1) ? true : false"/>

     <input id="handover" type="checkbox"  

     <input id="parcel" type="checkbox"


</div>

Apr
16
3 weeks ago
Activity icon

Replied to MethodNotAllowedHttpException

I have such a route Route::post('/parcels', [ParcelController::class, 'store']) ->name('parcels.store');

When I go to the address in the browser http://localhost/parcels

an error is returned which is obvious to me

The GET method is not supported for this route. Supported methods: POST.

I need to do a redirect or 404 for example

Activity icon

Started a new Conversation MethodNotAllowedHttpException

Hi everyone, How can I prevent a laravel error from appearing when someone tries to go to the / posts address that belongs to the post rout and has the post method? The point is that if someone goes to that address without filling out a form, it should redirect them away or return it, e.g. 404. Thaks

Apr
12
3 weeks ago
Activity icon

Replied to Foreach Loop

thx

Activity icon

Replied to Foreach Loop

Undefined array key "tern"

not work

Activity icon

Replied to Foreach Loop

I can't get other data with that array at all .... it is a pity

Activity icon

Replied to Foreach Loop

And how do I approach other values? For example, $ result ['cin'] is an error. Cannot access offset of type string on string

Activity icon

Started a new Conversation Foreach Loop

I have a problem. I can't access the data in the blade. I have an array with which I need to select for example id and I get an error

Trying to access array offset on value of type int

 @forelse ($results as $result)
     <li class="border-b border-grey-200">
          <a href="#" class="block hover:bg-gray-300 px-3 py-3">{{ $result['id'] }}</a>
      </li>
  @empty
        <p class="px-4 py-4">Empty</p>
   @endforelse

The array looks like this

array:3 [▼
  "id" => 1390840
  "tern" => 50491121
  "refn" => 2120345667
]