psylogic

psylogic

Member Since 1 Year Ago

Experience Points
25,820
Total
Experience

4,180 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
198
Lessons
Completed
Best Reply Awards
9
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 6
25,820 XP
Feb
14
1 month ago
Activity icon

Replied to Table Data Blade

@swimmer flex item or a css grid are the easiest way to do that.

or you can style it in your own like in this tuto

https://designmodo.com/shopping-cart-ui/

Activity icon

Replied to Security Question

When a file is declared public, you are indicating that the file should generally be accessible to others. For example, when using the S3 driver, you may retrieve URLs for public files.

Storage::put('file.jpg', $contents, 'public');

in your case your file is private, it will not be accessible to others.

Activity icon

Replied to Display Specific Values ​​in Relation

You question is not clear, please always provide your code, or example !

Feb
13
1 month ago
Activity icon

Replied to Alter Default Resource Delete Action

Do you mean adding deletet_at to table ? you can use soft delete !

Or anything else about deleting a resource you can refer to doc

https://laravel.com/docs/5.8/eloquent#deleting-models

but before that could you tell us more about what do you wanna achieve exactly ? some examples !

Activity icon

Awarded Best Reply on Save Multiple Checkboxes To The Database

User modal

I guess you will have hasMany(Coordenador::class)

by using this line laravel will automatically inject user_id with auth id into cordenator table

$data['q9'] = implode(",",$data['q9']);
auth()->user()->cordenator()->create($data);

or in the way you use

public function store(Request $request) {
        $data = $request->input();
        $data['user_id'] = Auth::id();
        $data['q9'] = implode(",",$data['q9']);
        Coordenador::create($data);
}

Activity icon

Replied to Save Multiple Checkboxes To The Database

User modal

I guess you will have hasMany(Coordenador::class)

by using this line laravel will automatically inject user_id with auth id into cordenator table

$data['q9'] = implode(",",$data['q9']);
auth()->user()->cordenator()->create($data);

or in the way you use

public function store(Request $request) {
        $data = $request->input();
        $data['user_id'] = Auth::id();
        $data['q9'] = implode(",",$data['q9']);
        Coordenador::create($data);
}

Activity icon

Replied to Save Multiple Checkboxes To The Database

if you have relation between Coordenador and User

you can use auth()->user()->cordenator()->save($data)

of course after using implode function on $request->q9

Activity icon

Replied to Laravel Auth Login Error

this is the stub code of login page; you may miss something

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">{{ __('Login') }}</div>

                <div class="card-body">
                    <form method="POST" action="{{ route('login') }}">
                        @csrf

                        <div class="form-group row">
                            <label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>

                                @error('email')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">

                                @error('password')
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $message }}</strong>
                                    </span>
                                @enderror
                            </div>
                        </div>

                        <div class="form-group row">
                            <div class="col-md-6 offset-md-4">
                                <div class="form-check">
                                    <input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>

                                    <label class="form-check-label" for="remember">
                                        {{ __('Remember Me') }}
                                    </label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-8 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Login') }}
                                </button>

                                @if (Route::has('password.request'))
                                    <a class="btn btn-link" href="{{ route('password.request') }}">
                                        {{ __('Forgot Your Password?') }}
                                    </a>
                                @endif
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

Activity icon

Replied to Save Multiple Checkboxes To The Database

Do you want to save the answers in same column as a string or json ? or each answer in new row ?

Activity icon

Replied to Validating User Input

@abc123

use gt:field validation

 'age2' => ['required', 'integer', 'max:100', 'gt:age1'],

for more informatoin about validation

https://laravel.com/docs/5.8/validation#available-validation-rules

Activity icon

Replied to Flattening With Collect Helper Changes Collection To Empty

$employees->values()->all() didn't gives you result !?

Activity icon

Replied to Compact(): Undefined Variable

use only compact('cellphone') instead of compact('cellphone', $cellphone)

Activity icon

Awarded Best Reply on Call To A Member Function Store() On String When Testing Uploads

@chris1981 ;

Here's my code and it pass and please check the status also the URL if it is correct

and you should pass the images as array

'filename' => [
      $image = UploadedFile::fake()->image('fakeimage.jpg')
      ]

api.php

Route::post('/upload', 'TestController');

Controller

public function __invoke(Request $request)
    {
        if ($request->hasFile('filename')) {
            foreach ($request->file('filename') as $image) {
                if ($upload = $image->store('images', 'public')) {
                    return  response()->json($upload, 201);
                }else{
                    return  response()->json("no", 403);
                }
            }
        }
    }

Test

public function testExample()
    {
        // to track the errors
        // $this->withoutExceptionHandling();


        Storage::fake('public');

        $this->postJson('/api/upload', [
            'filename' => [
                $image = UploadedFile::fake()->image('fakeimage.jpg')
                ]
        ])
        ->assertStatus(201);

        Storage::disk('public')->assertExists("images/".$image->hashName());
        Storage::disk('public')->assertMissing('images/missing.jpg');
    }
Activity icon

Replied to Call To A Member Function Store() On String When Testing Uploads

@chris1981 ;

Here's my code and it pass and please check the status also the URL if it is correct

and you should pass the images as array

'filename' => [
      $image = UploadedFile::fake()->image('fakeimage.jpg')
      ]

api.php

Route::post('/upload', 'TestController');

Controller

public function __invoke(Request $request)
    {
        if ($request->hasFile('filename')) {
            foreach ($request->file('filename') as $image) {
                if ($upload = $image->store('images', 'public')) {
                    return  response()->json($upload, 201);
                }else{
                    return  response()->json("no", 403);
                }
            }
        }
    }

Test

public function testExample()
    {
        // to track the errors
        // $this->withoutExceptionHandling();


        Storage::fake('public');

        $this->postJson('/api/upload', [
            'filename' => [
                $image = UploadedFile::fake()->image('fakeimage.jpg')
                ]
        ])
        ->assertStatus(201);

        Storage::disk('public')->assertExists("images/".$image->hashName());
        Storage::disk('public')->assertMissing('images/missing.jpg');
    }
Feb
12
1 month ago
Activity icon

Replied to Call To A Member Function Store() On String When Testing Uploads

would you try this one

$this->call('post','/api/upload', [],[],$photos);

using call instead of jsonPost

$photos = [
'filename' => [
    UploadedFile::fake()->image('fakeimage.jpg'),
    UploadedFile::fake()->image('fakeimage2.jpg')
  ]
];

$this->call('post','/api/upload', [],[],$photos);

Storage::disk('public')->assertExists("images/{$photos['filename'][0]->hashName()}");

Activity icon

Replied to Middleware: Add Value To $request?

if hopped from app to app , then you are already save the tracked data for this activated app. and with tabs is the same each app(tab) has its own session

Activity icon

Replied to Middleware: Add Value To $request?

Did you try to store it in session ?

Activity icon

Replied to Add , After Word But Skip The Last One

you can use computed property

computed:{
 separtedServices() { return this.checkedServiceTitles.map(service => service.description).join(', ') }
}
<span v-text="separtedServices"></span>
Activity icon

Awarded Best Reply on Laravel Validation Erro In Uploading JPG Image.

Great, would you mark the thread as solved. Thanks!

Activity icon

Replied to Laravel Validation Erro In Uploading JPG Image.

Great, would you mark the thread as solved. Thanks!

Activity icon

Replied to Sending Mail To Multiple Recipients With The “Name” Of Recipient In The Body

Yes, I think this is the only approach that is available right now.

Activity icon

Replied to Multi-tenancy Using Laravel App

@aqeel94321

https://github.com/PsyLogic/lara-tenancy

would you try this demo boilerplate. I used

"hyn/multi-tenant": "5.4.", "laravel/framework": "5.8."

you can clone and try your own , follow the readme

Activity icon

Awarded Best Reply on Database Help -> Join With Where!

where(Auth::user()->id, '=', 'carts.user_id')

first argument waiting column name not a value

use where('users.id', Auth::user()->id) instead

Activity icon

Replied to Database Help -> Join With Where!

where(Auth::user()->id, '=', 'carts.user_id')

first argument waiting column name not a value

use where('users.id', Auth::user()->id) instead

Activity icon

Replied to Sending Mail To Multiple Recipients With The “Name” Of Recipient In The Body

foreach($single as $sendTo)
{
    Mail::to($single['email'])->send(new EmailMessage($single['name']));
}

you can do it like that or get collection of users and pass object to EmailMessage

that first thought , but I'll look up for better idea

Activity icon

Replied to Laravel Validation Erro In Uploading JPG Image.

@felipesmendes ,

Would you try to increase the post_max_size from 2mb to 8mb because the Image jpg when it exceeded 2mb it become octet-stream (I could be wrong)

Try it and let me know !

Activity icon

Replied to Focus After Ajax Post

what if you did the focus inside setTimeout ?

Activity icon

Replied to Error Npm Run Production

Did you checked you app.scss file for any erros (Unclosed block,...)?

Activity icon

Replied to How To Search In Two Table Dynamically PHP ?

@ebrahemsamer ,

Do you mean if you don't find result in 1st table you will look in the 2nd table ?

Activity icon

Replied to Blade Auto-close Of Directives

@gvanto , Well new directives need to be added manually, but I think if there some config in the editor where you define the service provide that add your extra directives and editor will scan it and add them automatically

Activity icon

Replied to Deleting Wrong Data When We Press The Delete Button

@bhhussain ,

I think @snapey solution is working fine.

if not the case for you you can pass the genreated url to the function, like so:

<a href="javascript:;" data-toggle="modal" onclick="deleteData({{ route('admin.accounts.destroy', $c->id) }})" 
              data-target="#DeleteModal">


function deleteData(url)
   {
          $("#deleteForm").attr('action', url);
  }
Activity icon

Replied to Deleting Wrong Data When We Press The Delete Button

I assumed this is detail page of some resource. if it is a loop then the solution I provided is not practical.

in case of looping you can try @snapey way , and track the ID in the network tab

Activity icon

Replied to Deleting Wrong Data When We Press The Delete Button

Just pass this URL( {{ route('admin.accounts.destroy', $c->id) }} ) to action form

No need to pass it from jQuery

<a href="javascript:;" data-toggle="modal" data-target="#DeleteModal">
              
              <i class="fa fa-trash text-red"></i >
              
            </a>
  
              <div id="DeleteModal" class="modal fade text-danger" role="dialog">
                <div class="modal-dialog ">
                  <!-- Modal content-->
                  <form action="{{ route('admin.accounts.destroy', $c->id) }}" id="deleteForm" method="post">
                      <div class="modal-content">
                          <div class="modal-header bg-danger">                            
                              <h5 class="modal-title text-center">Delete Confirmation</h5>
                          </div>
                          <div class="modal-body">
                              {{ csrf_field() }}
                              {{ method_field('DELETE') }}
                              <p class="text-center">Are You Sure Want To Delete ?</p>
                          </div>
                          <div class="modal-footer">
                              
                                <button type="submit" name="" class="btn btn-danger" data-dismiss="modal">Yes, Delete</button>  
                                <button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button>
                                  
                              
                          </div>
                      </div>
                  </form>
                </div>
               </div>
Activity icon

Replied to I Want To Upload Vector File (.ai Extention File)

this is the extension that allowed by intervention JPEG PNG GIF TIF BMP ICO PSD WebP

src: http://image.intervention.io/getting_started/formats

Activity icon

Replied to Blade Auto-close Of Directives

You can look at this doc for more information about laravel autocomplete

https://www.jetbrains.com/help/phpstorm/laravel.html

Activity icon

Replied to Create Helper To Cach Data In Rules And Controller Logic

You can store the data in the database, and retrieved it when you hit same domain you gonna check, otherwise get data from API. but this is not best solution because you have to track if something changes in the API result.

Feb
11
1 month ago
Activity icon

Replied to Laravel Eloquent Get Nested Child With Filter

/**
 * Get available combos.
 *
 * @param $query
 * @return mixed
 */
public function scopeAvailable($query)
{
    return $query->where('status', 1)
        ->whereHas('inventories', function ($query) {
            $query->where('quantity', '>', 0);
        });
}

If you have this scope in your Product Model then I think you have to put inventories instead of products.inventories

Feb
10
1 month ago
Activity icon

Awarded Best Reply on Reset Data Then Redirecting To Same Page After Saving Data

You can just reset the participant object without refreshing the page.

Activity icon

Replied to How To Display HSN Code Wise Data In Laravel Using Table Format

Would you be more specific, an example of what you wanna achieve it would be a good hint !

Activity icon

Replied to Reset Data Then Redirecting To Same Page After Saving Data

You can just reset the participant object without refreshing the page.

Dec
13
3 months ago
Activity icon

Awarded Best Reply on Using Bogardo Mailgun No Hint Path Defined For Mail

I don't think that this package support markdown ..

So you have to use Views instead of markdown or render markdown to view then pass it to mailgun::send()