Our Black Friday sale is now live! All individual subscriptions are 50% OFF. This week only!

wingly

wingly

Member Since 2 Years Ago

Experience Points
103,430
Total
Experience

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

Level 21
103,430 XP
Nov
23
1 day ago
Activity icon

Awarded Best Reply on Load Image From Database

You should not be using backslashes use this

<img :src="'/uploads/products/'+produit.image" class="imageproduit">  
Activity icon

Replied to Determine If Model Is Recordable

You can probably do it with a lot of ways for example you can create an interface Recordable that a model which needs to be recorded implements then check if the repliable is recordable (using for example instanceof Recordable) and do your recording stuff

Activity icon

Replied to Laravel Breeze Multiguard Login And Logout

Auth::guard('lbenz')->logout()

Activity icon

Replied to Load Image From Database

You should not be using backslashes use this

<img :src="'/uploads/products/'+produit.image" class="imageproduit">  
Nov
18
6 days ago
Activity icon

Replied to How To Create Collections In Livewire Component?

I don't really see how you do that in a controller... If i understand what you want is to be able to pass a collection to the view like you use to do within a controller ? Then maybe this is what you want:

    public function render()
    {
        return view('livewire.yourview', [
		'collection' => collect([1, 2, 3])
        ]);
    }
Activity icon

Awarded Best Reply on How Can I Install The Material-UI Pickers Package In Laravel 6?

Material ui is a react component library if you are not using react or planning to use react in your project then it's not meant for you...

Nov
16
1 week ago
Activity icon

Replied to IsForceDeleting() Method Is Not Work On Multiple Force Delete Record.

From the docs:

When issuing a mass update or delete via Eloquent, the saved, updated, deleting, and deleted model events will not be fired for the affected models. This is because the models are never actually retrieved when issuing a mass update or delete.

Activity icon

Replied to Check If User Subscribed

Is this a one to many relationship? If yes then you need to check it like thattt

@if(Auth::user()->subscriptions()->count())
                <p>abonne</p>
                @else 
                <p>pas abonne</p>
                @endif
Activity icon

Replied to Laravel Version 5.8.38 -> 8.x ?

Plus check https://laravelshift.com/ to automate this painful process :)

Activity icon

Replied to Wep App + Native Mobile App - What Should I Learn

Yep that's correct. The web will have a classic session based authentication and the api will have some kind of token based auth

Nov
13
1 week ago
Activity icon

Replied to Passing Eloquent To Blade X-component

Try <x-book-card :book="$book" />

Nov
11
1 week ago
Activity icon

Replied to Beginner Question: Create Variables/Arrays For Multiple Controllers

@simon7 if you have defined the relationships then the following code assuming you are the scope in a controller can be rewritten like that:

// $user_id = Auth::id();
// $user = User::find($user_id);
auth()->user();
//$user_options = UserOption::where('user_id', $user->id)->first(); 
auth()->user()->options;
// $user_role = UserRole::where('key', $user->role_key)->first();  
auth()->user()->role;
// $company = Company::where('id', $user->company_id)->first();
auth()->user()->company;

If you do similar things with those data you can extract the logic into a Service class and inject the user to your service.

If those data have a significance as a group you can create a method in your User model and return those data all together:

class User 
{
	public function details()
	{
		return [
			'options' => $this->options,
			'company' => $this->company
			... the other stuff
		];

	}
}

and then use auth()->user()->details()['company'] in your controllers

Activity icon

Replied to Finding The Total Divs Which Has A Specific Element

lol yep thanks for the sanity check :)

Activity icon

Replied to Finding The Total Divs Which Has A Specific Element

If ti works for the checked can't you just subtract that from the total to get the unchecked ?

Activity icon

Replied to Beginner Question: Create Variables/Arrays For Multiple Controllers

Assuming that a user has many options and the relationships are defined (https://laravel.com/docs/8.x/eloquent-relationships#one-to-many) why don't you just access them through the user (eg authenticated one)

auth()->user()->options

Activity icon

Replied to Wep App + Native Mobile App - What Should I Learn

So just my 2 cents @zaster your use case: Build an app that should be served through different mediums (web, mobile).

Option 1) Build a web app with your stack of choice let's say Laravel, Livewire, Tailwind etc. Here you gonna have web routes and classic views. Then build your api routes to be able to serve a mobile client. Develop the mobile app with your stack of choice (Flutter?). Extract the logic into reusable actions/services/jobs etc in order to not repeat it across the web/api routes (much like the approach of jetstream).

Option 2) Build an API with Laravel and then consume it both in the mobile app and in the browser. Again you gonna have to develop and maintain two frontends and comes with the drawback of having to deal with the complexity of a full client powered application.

Option 3) Build an API with Laravel. Build one frontend for both web/mobile (PWA like approach). Here Ionic comes to play and you gonna have to maintain one frontend for all platforms.

It all comes down on what you are building and the people working on it. A team might be allocated to build and maintain the API. Another to build the IOS app etc. Your mobile app might depend heavily on native device features (camera etc) so a native application might be a better solution for you instead of a hybrid one.

Don't forget that the build/release cycle of a mobile application is a whole different game. You will soon notice that a new feature could be introduced at the web part really fast and a user will have it available immediately after you deploy it to production but on the mobile it will have to go through packaging submitting to app stores going through review that might take days and last but not least a user will have to update the app.

Activity icon

Replied to Wep App + Native Mobile App - What Should I Learn

Yep I had the chance to work with Ionic since v1 where angular was the only option. They involved a lot and the last year the did a pretty big change making ionic framework agnostic so you can work with your framework of choice angular, react, vue etc. I have built apps until v3 but haven't worked with it for a year, so don't know a lot about the current state. The community is big, nice forum (at least as far as i remember), nice documentation, multiple native plugins. It all comes down on what you are building but it's an option worth looking into.

Activity icon

Replied to Wep App + Native Mobile App - What Should I Learn

Yes Laravel will just serve an API rest, graphql whatever fits your needs

Activity icon

Replied to Wep App + Native Mobile App - What Should I Learn

Worth looking into https://ionicframework.com/ a one for all platforms solution.

Nov
09
2 weeks ago
Nov
06
2 weeks ago
Activity icon

Replied to Vue With Livewire

I think you need a plugin for this https://github.com/livewire/vue

Nov
05
2 weeks ago
Activity icon

Replied to I Can't Figure Out How To Write This Eloquent...

Maybe with the addition of a groupby will do the job?

YourModel::query()
	->orderBy('current_step', 'desc')
	->groupBy('order_id')
	->whereColumn('required_steps', 'current_step')
->count();
Nov
04
2 weeks ago
Activity icon

Replied to How To Resize And Store Images With Intervention\Image

You can't but something like that should work.

$avatar = Image::make($file)->resize(100, 100)->stream();
Storage::disk($disk)->put('avatar', (string) $avatar);
Activity icon

Replied to What Is The Better To Check User Authentication? ExpectException() Or AssertRedirect()

Approach 1 for me. You expect that the user get's redirected to the login page not just that an exception is thrown

Activity icon

Replied to Getting Posts For The Last 30 Days

Maybe this Post::whereDate('created_at', '>', now()->subDays(30));

Oct
28
3 weeks ago
Activity icon

Awarded Best Reply on Saving Data Livewire Call To A Member Function Create() On Null

Is post a relation at the User model? Or maybe you have a posts relationship that makes more sense then you should do auth()->user()->posts()->create($data)

Activity icon

Replied to Saving Data Livewire Call To A Member Function Create() On Null

Is post a relation at the User model? Or maybe you have a posts relationship that makes more sense then you should do auth()->user()->posts()->create($data)

Oct
27
4 weeks ago
Activity icon

Replied to Do You Really Like Tailwind And Livewire ?

I personally love them both!

For me tailwind came naturally, as I found my self doing the same thing basically in all my projects, writing flex utility classes etc. I feel that it fits nicely with any component based frontend design I was involved. Building pages became so easy and fun. I can imagine that bootstrap like frameworks build on top of tailwind will start to come to life soon enough https://tailwindcss.com/docs/extracting-components#writing-a-component-plugin

For Livewire I had my concerns. You know initially feels weird. What are all those requests? Then I listened to Rich Harris talking about how we should be building stuff in the "modern web", "dissing" phoenix live view etc and my doubts became bigger. Then I tried it out, build a project with a tight deadline and I was blown away with how fast I got stuff done.

I still mainly work with Vue (and love it) but I would as easy choose livewire/alpine for the next thing I build, if it make sense to use them.

For me both of them found a place in my projects and feel grateful that I have those powerful tools in my toolbox that I can reach anytime I need them :)

Activity icon

Replied to Laravel Vue Cannot Get Old Value Because Of V-model

Well if this is the only reason maybe Vue is not for you. You can do it with plain javascript, jquery, alpinejs you name it but if you want to use Vue i would suggest to create a normal component that holds the state and the template and then submit your form with axios.

Activity icon

Replied to Laravel Vue Cannot Get Old Value Because Of V-model

Why do you have v-model at the first place ? Seems like you are doing the whole thing in blade right?

Activity icon

Replied to VueJS: Data Not Updated After Axios Call.

Yeah but for example here this.listValue[index] = libEml.getNamesFromDepartmentApi(response.data); what is index do you define it somewhere because seems like it shouldn't be there

Activity icon

Replied to VueJS: Data Not Updated After Axios Call.

what's the index thingy ?

Oct
26
4 weeks ago
Activity icon

Replied to Api Route Throttling By Default

You can change that in your [email protected] method.

Oct
14
1 month ago
Activity icon

Replied to Type Of App\Models\User::$table Must Be String

Removing the protected $table = 'users'; from you User model

Activity icon

Replied to Type Of App\Models\User::$table Must Be String

Why don't you just remove it completely ?

Sep
26
1 month ago
Activity icon

Replied to Best Way To Save Credit Cart Info

@msslgomez if I am not mistaken Uber uses Braintree to handle their payments

Jun
25
4 months ago
Activity icon

Awarded Best Reply on Select How Receive Notification

The via method is inside your notification class the check gonna be there

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed  $notifiable
 * @return array
 */
public function via($notifiable)
{
    return $notifiable->prefers_sms ? ['nexmo'] : ['mail', 'database'];
}
Jun
23
5 months ago
Activity icon

Started a new Conversation Github Action View Not Found Exception

Hey, I am trying to setup a github action to execute my tests. While my tests are passing locally they fail when executed from the action (I am using Laravel 8 TestView assertions). This is the relevant part from the action logs:

3T14:46:46.2268843Z 
2020-06-23T14:46:46.2268958Z Time: 00:00.736, Memory: 32.00 MB
2020-06-23T14:46:46.2269015Z 
2020-06-23T14:46:46.2269118Z There were 25 errors:
2020-06-23T14:46:46.2269173Z 
2020-06-23T14:46:46.2269436Z 1) Wingly\WinglyUI\Tests\Components\Cards\CardTest::test_it_renders_with_full_size_by_default
2020-06-23T14:46:46.2327657Z ErrorException: View [components.cards.card] not found. (View: /tmp/laravel-bladeW5bxz4.blade.php)
2020-06-23T14:46:46.2327773Z 
2020-06-23T14:46:46.2329267Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:137
2020-06-23T14:46:46.2329672Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:43
2020-06-23T14:46:46.2330017Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php:57
2020-06-23T14:46:46.2331511Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/View.php:139
2020-06-23T14:46:46.2331845Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/View.php:122
2020-06-23T14:46:46.2332157Z /home/runner/work/wingly-ui/wingly-ui/vendor/laravel/framework/src/Illuminate/View/View.php:91
2020-06-23T14:46:46.2334577Z /home/runner/work/wingly-ui/wingly-ui/tests/TestView.php:34
2020-06-23T14:46:46.2334875Z /home/runner/work/wingly-ui/wingly-ui/tests/InteractsWithViews.php:44
2020-06-23T14:46:46.2335167Z /home/runner/work/wingly-ui/wingly-ui/tests/Components/Cards/CardTest.php:11
2020-06-23T14:46:46.2335234Z 

This is the function from laravel InteractsWithViews where I locate the issue

    protected function blade(string $template, array $data = [])
    {
        $tempDirectory = sys_get_temp_dir();

        if (! in_array($tempDirectory, ViewFacade::getFinder()->getPaths())) {
            ViewFacade::addLocation(sys_get_temp_dir());
        }

        $tempFile = tempnam($tempDirectory, 'laravel-blade') . '.blade.php';

        file_put_contents($tempFile, $template);

        return new TestView(view(Str::before(basename($tempFile), '.blade.php'), $data));
    }

As i already said the tests are running fine locally and the actual view exists and works if tested in the browser too. I am assuming that it has something to do with the tmp directory but tbh i have no clue. Does anyone here run into something similar or has a bit more knowledge than me in github actions ? This is my workflow file:

name: tests

on:
  push:
  pull_request:
  schedule:
    - cron: '0 0 * * *'

jobs:
  tests:
    runs-on: ubuntu-latest

    strategy:
      fail-fast: true
      matrix:
        php: [7.2, 7.3, 7.4]
        laravel: [^7.0]

    name: P${{ matrix.php }} - L${{ matrix.laravel }}

    steps:
      - name: Checkout code
        uses: actions/[email protected]

      - name: Cache dependencies
        uses: actions/[email protected]
        with:
          path: ~/.composer/cache/files
          key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

      - name: Setup PHP
        uses: shivammathur/[email protected]
        with:
          php-version: ${{ matrix.php }}
          extensions: dom, curl, libxml, mbstring, zip
          coverage: none

      - name: Install dependencies
        run: composer require "illuminate/contracts=${{ matrix.laravel }}" --prefer-dist --no-interaction

      - name: Execute tests
        run: vendor/bin/phpunit --verbose
Jun
02
5 months ago
Activity icon

Replied to Trying To Create A Dynamic @include Request - Please Help...

I don't know if you have a use case for not to do it but why don't you return the partial directly from your controller ? Take a look at server fetched partials https://laracasts.com/series/javascript-techniques-for-server-side-developers/episodes/1

May
26
5 months ago
Activity icon

Replied to I'm Getting This, PARSE ERROR Syntax Error, Unexpected 'use' (T_USE), Expecting '{' ,on Line 3

Your namespace is wrong

namespace App\Http\Controllers\ImageController;

should be

namespace App\Http\Controllers;
Activity icon

Replied to I'm Getting This, PARSE ERROR Syntax Error, Unexpected 'use' (T_USE), Expecting '{' ,on Line 3

Show us the contents of the App\Traits\ImageUpload probably it's again a namespace issue

May
24
6 months ago
Activity icon

Replied to Migrations Clean Up

I think Taylor is preparing something for v8 that might help https://github.com/laravel/framework/pull/32275 but yeah i am interested in this too :)