zion

zion

Member Since 4 Years Ago

Experience Points 39,860
Experience Level 8

140 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 309
Lessons
Completed
Best Reply Awards 13
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.

23 Feb
4 months ago

zion left a reply on Save And Update Value In Table

You can use updateOrInsert for that. See https://laravel.com/docs/5.7/queries#updates for reference.

07 Feb
4 months ago

zion left a reply on Laravel 5.4 Modifying Auth Middleware Redirection

You can override this in LoginController with protected $redirectTo = '/home';

06 Feb
4 months ago

zion left a reply on How To Pass Multiple Variable Throuth Route

Use an array for this.

<a href="{{ route('media.edit',['media' => $results->id, 'type' => $type]) }}"><i class="fa fa-fw fa-edit"></i></a>

25 Jan
4 months ago

zion left a reply on Can't Cache Js And Css Files

Based on what do you think css and js are not cached? If you open developer tools and open the Network tab on chrome for example, in the "size" column it should either show the file size or (from disk cache). If it's the second option (browser)caching is working.

21 Jan
5 months ago

zion left a reply on How To Cache Dynamic Data (pages) Using Laravel Spatie...

Ask yourself what pages you want/need to be cached. Don't just randomly cache every single thing.

Alternatively clear the cache after create/update. https://github.com/spatie/laravel-responsecache#clearing-the-cache

18 Jan
5 months ago

zion left a reply on File Field Is Empty On Edit Page

Idid not pay attention to the nova tag, my apologies. I have indeed not yet worked with nova.

zion left a reply on File Field Is Empty On Edit Page

That's because you cannot do what you expect to happen, at least as far as I know. Looking at your code you're working with avatars. Something most apps do is just show the image if there is one uploaded for the user (with tags).

16 Jan
5 months ago

zion left a reply on Best Laravel Version To Have With Existing Php ?

5.4 requires php 5.6.4. 5.5 has 7.0 as requirement so 5.4 should be good to go.

zion left a reply on Reset Password - Email Field

Ah right, my bad. If you look at ForgotPasswordController, it uses a traitSendsPasswordResetEmails. You can override those methods in your controller.

zion left a reply on Reset Password - Email Field

See docs: https://laravel.com/docs/5.7/authentication

You can override the username by creating username() in LoginController

public function username()
{
    return 'EmailAddress';
}

zion left a reply on How Can I Avoid Image Required In Edit Form If Image Exist In Laravel?

Why do you want to use the same function for both storing a new resource and editing one? It's possible don't get me wrong but it overcomplicates things. An option would be to check the url the user came from and apply different validation.

I would go with a separate function for storing and editing.

15 Jan
5 months ago

zion left a reply on Eloquent Relationship Multiple Connection

Set protected $connection= 'the_other_db'; on the department model which matches what is configured in database.php

zion left a reply on Add Multiple Variable To View

Change {{socVal}} in {{$socVal}}. Note the$`.

14 Jan
5 months ago

zion left a reply on Is It Possible To Join Another Table Based On 2 Columns Using With()?

If those all belong to a user you can setup a relation from and to a user. What is the point of date_to and date_from? Can't you just work with created_at/updated_at?

Can't you just provide a real world example instead of made up "table_one" etc. That would make it easier for us to understand and provide help.

zion left a reply on Is It Possible To Join Another Table Based On 2 Columns Using With()?

Why do you want/need that structure so bad? I don't see what the 2 tables have to do with each other. If you really need that structure one would assume there was some kind of relationship between the 2.

zion left a reply on Is It Possible To Join Another Table Based On 2 Columns Using With()?

Ah I see. Well you can't use with when you have no relation setup.

What are your tables called? table_two seems like a bit of a weird table name. Anyway, use a regular join ( https://laravel.com/docs/5.7/queries#joins ).

zion left a reply on Is It Possible To Join Another Table Based On 2 Columns Using With()?

Modify it to how your relations are setup. You didn't post any code so I cannot know what it is supposed to be called. I took table_two from your OP.

How are your relations setup, if you have it setup ofcourse. If not, be more specific.

zion left a reply on Is It Possible To Join Another Table Based On 2 Columns Using With()?

Not sure what your current code looks like, so try something like this.

Model::with(['table_two' => function ($query) 
{
    $query->where('date_from', '...', '...')->where('date_to', '...', '...');
}]);
10 Jan
5 months ago

zion left a reply on Form Model Binding In 5.7

@smnhunt or was removed in 5.7 [ https://laravel.com/docs/5.7/upgrade#upgrade-5.7.0 ]

"The Blade "or" operator has been removed in favor of PHP's built-in ?? "null coalesce" operator, which has the same purpose and functionality"

04 Jan
5 months ago

zion left a reply on Datatable In Laravel

There is documentation below the page you're linking. If you expect help be more specific please.

zion left a reply on Cart

Do you use wordpad or a functional IDE for development? Any IDE would probably help you get to the method and figure out what it does.

03 Jan
5 months ago

zion left a reply on Can't Store Form & Its FormItems Data To DB

Can you show the output of dd($request->all());.

zion left a reply on Can't Store Form & Its FormItems Data To DB

Yes you can. Untested, so modify to your needs:

<tr>
  <td><input type="text" name="familymembers[0][name]" class="form-control form-control-sm" placeholder="Full Name"></td>
  <td><input type="text" name="familymembers[0][dob]" class="form-control form-control-sm datepicker" placeholder="Date of Birth: "></td>
  <td><input type="text" name="familymembers[0][fhname]" class="form-control form-control-sm" placeholder="Father/Husband Name"></td>
</tr>

Now in your controller you can foreach through them like this:

foreach($request->familymembers as $familymember) {
    $formItem = new FormItems(); // is a family member a formItem?!?
    $formItem->name = $familymember->name;
    // continue according to what you need.
}

For additional form fields, increase the 0 to 1 and so on.

zion left a reply on Can't Store Form & Its FormItems Data To DB

Do a dd($request->all()); in your store method, that will give you more insight into what is actually in the request object. You will see there is no formItems as @signar mentioned.

zion left a reply on Laravel Elequent

You should pass additional variables with use ()

$vehicle =Vehicle::whereDoesntHave('newreservation',function($query) use ($returndate, $startdate) {
        $query->whereDate('start_date', '<',$returndate)
    ->whereDate('end_date', '>',$startdate);
    })->get();

zion left a reply on Call To Undefined Function App\Http\Controllers\table()

You're missing a : on DB::.

DB::table('cart')->where(['session_id'=>$session_id])->update(['user_email'=>$user_email]);

02 Jan
5 months ago

zion left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

try the following:

$(".addMore").click(function(){
        if($('body').find('.fieldGroup').length < maxGroup){
            var fieldHTML = '<table class="table table-bordered fieldGroup">'+$(".fieldGroupCopy").html()+'</table>';
            $('body').find('.fieldGroup:last').after(fieldHTML);
    // Initialize the datepicker for dynamically added fields.  
    $(".datepicker").datepicker();
        }else{
            alert('Maximum '+maxGroup+' groups are allowed.');
        }
    });

What does .fieldGroupCopy consist of?

zion left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

Simply call $(".datepicker").datepicker(); again (with arguments if needed) after adding new fields which need to be converted to datepicker.

zion left a reply on When I Add Dynamic Field JQuery Datepicket Is Not Wotking

You have to initialize them after adding the fields to the dom.

28 Dec
5 months ago

zion left a reply on Migration Issue: Invalid Default Value For "remaining"

diffForHumans() does not give you a valid timestamp. use 'remaining' => Carbon::now()->addDays(50) instead on your insert.

zion left a reply on How To Append Count Of List In Ul?

$('#notif-list li').length;
27 Dec
5 months ago

zion left a reply on Sorry, Your Session Has Expired. Please Refresh And Try Again. 5.7

Can you check apache logs and see if there's any clue in there.

zion left a reply on Different Environment For Development & Production

Do you have to use FTP? Can you not use GIT on the production server? That would be the easiest way as .env is in gitignore.

24 Dec
6 months ago

zion left a reply on How To Connect And Open MySQL?

If you are using homestead use 192.168.10.10 as the hostname.

22 Dec
6 months ago

zion left a reply on Do I Need To Update The Updated_at Column When ...

That depends on your needs. But generally no you don't have to.

Laravel will update that column for you unless you set protected $timestamps = false;

zion left a reply on Huge Error When Trying To Install Homestead

Use the official docs for this. https://laravel.com/docs/5.7/homestead#installation-and-setup make sure you read all of it as some things are different on windows.

21 Dec
6 months ago

zion left a reply on Database Tables Created Without Migration

What is "not working"? What error do you get? If you get none, what are you doing and what is the expected result.

I assume (based on your OP) data is not being stored in the database. Did you set your columns in protected $fillable = [];?

zion left a reply on Laravel Multiple Database Connections

I'm not sure if this is still relevant, but it may be worth a shot: https://fideloper.com/laravel-multiple-database-connections

zion left a reply on Instantiate Abstract Class

Add use Spatie\Crawler\Crawler; to your imports at the top of the file.

zion left a reply on Instantiate Abstract Class

Same thing, import Crawler/Crawler from the correct namespace. It's looking in App\Console\Commands for the class.

use \Spatie\Crawler\Crawler;

20 Dec
6 months ago

zion left a reply on Iterating Through A Collection Of JSON Objects After A Switch Statement

In what way is each of those cases different? Can't you just give the view the result and iterate over them in the view?

zion left a reply on How To Verify Online Reservation User And Inform Admin Via Email?

1.) Yes it is perfectly fine to work without a database. But in your case for step 3 you would need something to store the confirmation/verification code(?) otherwise there's nothing to verify against. 2.) I do not know of tutorials for this specific case. You could start with a google search on "Laravel booking system" or "Laravel reservation system". My guess would be they all use some kind of database to store some information.

zion left a reply on Iterating Through A Collection Of JSON Objects After A Switch Statement

It still doesn't do anything, you may aswel just return $resp

zion left a reply on Instantiate Abstract Class

Your class should not have abstract methods and it must implement all the abstract methods from the abstract class.

19 Dec
6 months ago

zion left a reply on FATAL ERROR In ../storage/framework/views/4adc42dcb226305d1eac13e0ba17bb7c

They are the cached versions of your views. What is the full error?

zion left a reply on How I Can Use Php Client Library In Laravel

Did you import (use) the class?

14 Dec
6 months ago

zion left a reply on Running Laravel Passport Install On Production Server

You can also add it under the scripts section in composer.json

"scripts": {
        "post-install-cmd": [
        "php artisan passport:install"
    ]
}

zion left a reply on Paginate A Database's Complete Results?

You can use skip() and take() for this.

$dairies = DB::table('dairies')->skip(50)->take(50);

This will skip the first 50. All you need to do now if calculate how many you need to skip each time. You can send a page variable from the frontend to the backend and use that to calculate the offset/skip.