dabnad

dabnad

Member Since 1 Year Ago

Experience Points 3,000
Experience Level 1

2,000 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 13
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.

27 Sep
11 months ago

dabnad left a reply on New WP Install Refers To Laravel's Domain

@bobbybouwmann Doesn't it require a virtual host setup or something? cause it seems like that's the problem.. I don't see another reason it would redirect to the other domain - they have nothing in common. And I only removed "/public" on the nginx config, since it didn't even display the db error before I've done that. anyways, I had written it back.

26 Sep
11 months ago

dabnad left a reply on New WP Install Refers To Laravel's Domain

@bobbybouwmann Hey bobby, I have created the site using Forge, and I had updated the DNS as well. the droplet is the only connection between the two domains. besides that, when the config didn't contain the right db credentials, a database connection error was displayed with no referring to the other domain. Thanks =]

dabnad started a new conversation New WP Install Refers To Laravel's Domain

Hey guys, I have a droplet on DO which contains a Laravel project I've installed on a domain using Laravel Forge. Today, I have cloned a git of a wordpress site I want to put on my droplet, but for some reason after cloning it using Forge (and setting it's domain using forge's input to a domain I have purchased), uploading my DB dump to the new database I've created for that wp site using Forge, whenever I go to the new domain, I get referred to the other domain which runs laravel. Do you guys have an idea why does that happend? I had removed "/public" from nginx config (root path) of the site (using forge tab on the bottom of a site apps page)

Thanks in advance everyone!

19 Sep
11 months ago

dabnad left a reply on Read A Relationship Based Value In Where Clause

@Sergiu17 I added the route to routes/web.php & located the script in my code, but for some reason I get "Use of undefined constant response - assumed 'response' when using:

<script>
fetch('/lessons').then(function(response) {
    window.lessons = response;
})
</script>

so I can't get it to work =[

dabnad left a reply on Read A Relationship Based Value In Where Clause

@Sergiu17 @MikeRees Do you have an idea how can I use it when implementing in Javascript?

<script type="text/javascript">
window.lessons = JSON.parse(JSON.stringify(@json(App\Lesson::where([['isCancel','=','0']])->get())));
</script>

when I add the hasmany there, it returns window.lessons = JSON.parse(JSON.stringify(<?php echo json_encode(App\Lesson::where([['isCancel', '=', '0']])->whereHas('user') ?>)); Exception message: Parse error: syntax error, unexpected '?>', expecting ',' or ')'

Thank you so much again!

dabnad left a reply on Cant Start Httpd

@s4muel I already switched to a different server, thanks anyways!

18 Sep
1 year ago

dabnad left a reply on Read A Relationship Based Value In Where Clause

@Sergiu17 @MikeRees Thanks! I'd be checking it ASAP looks good

dabnad started a new conversation Cant Start Httpd

Hey guys, I have just got a fresh install of CentOS 7 on a VPS. I've been installing all the things I need for Laravel but now I can't get httpd to start.


-- Unit httpd.service has begun starting up.
Sep 18 12:00:50 mycentos httpd[16972]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::d05f:46ff:fe07:d384. Set the 'ServerName' directive globally to suppress this message
Sep 18 12:00:50 mycentos httpd[16972]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Sep 18 12:00:50 mycentos httpd[16972]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Sep 18 12:00:50 mycentos httpd[16972]: no listening sockets available, shutting down
Sep 18 12:00:50 mycentos httpd[16972]: AH00015: Unable to open logs
Sep 18 12:00:50 mycentos systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Sep 18 12:00:50 mycentos kill[16973]: kill: cannot find process ""
Sep 18 12:00:50 mycentos systemd[1]: httpd.service: control process exited, code=exited status=1
Sep 18 12:00:50 mycentos systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

I've been searching for hours and couldn't find an answer. Please help! Thanks in advance all.

17 Sep
1 year ago

dabnad started a new conversation Read A Relationship Based Value In Where Clause

Hey guys, I have a model which contains a field: user_id, and a model of users (which HasMany of the model mentioned above), which I'd like to read it's value in my where clause.

So let's say I have: Actors and Users I'd like to read: Actors::where('Actor.User_Id.ReadMe', '=', '2')

Is there a way I can do that in a where clause? Thanks in advance everyone!

31 Aug
1 year ago

dabnad started a new conversation Cant Install A Working Existing Project

Hey guys, I just started Forge and I'm so frustrated... I can't successfully install my project.. Been using BitBucket with Growth Plan on Forge and I keep on getting "We were unable to install a project on your server (frosty-rain). " The last lines in the log are:

sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing ext-xdebug (*)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

In DuskServiceProvider.php line 43:
                                           
  It is unsafe to run Dusk in production.  
                                           

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Do you have an idea what might cause this error? Thanks in advance, best regards.

29 Aug
1 year ago

dabnad left a reply on Undefined Variable: PermissionArray

@tykus are you sure it is okay? shouldn't it already contain a value? when I placed if($permissionArray == null) it didn't ran. meaning it has some kind of value in this state (before the loops).

btw thank you so much!

28 Aug
1 year ago

dabnad left a reply on Undefined Variable: PermissionArray

@tykus Oops, I forgot!

/Users/danny/Desktop/kzk/app/Providers/AuthServiceProvider.php
    {
        $this->registerPolicies();
 
        Passport::routes();
        Passport::tokensExpireIn(now()->addDays(15));
        Passport::refreshTokensExpireIn(now()->addDays(30));
 
        $user = \Auth::user();
 
        
        if (! app()->runningInConsole()) {
            $roles = Role::with('permission')->get();
 
            foreach ($roles as $role) {
                foreach ($role->permission as $permission) {
                    $permissionArray[$permission->title][] = $role->id;
                }
            }
 
            foreach ($permissionArray as $title => $roles) {
                Gate::define($title, function (User $user) use ($roles) {
                    return count(array_intersect($user->role->pluck('id')->toArray(), $roles));
                });
            }
        }
    }
}

I have never touched that file, that's why idk what's going on there :P PHP 7.1 (Since its laravel 5.4) and current MySQL version.

the only change that was made in the files since the last time everything worked perfectly is removing NO_AUTO_CREATE_USER from MySqlConnector.php line 178. (Since MySql 8 and up does not support it)

dabnad started a new conversation Undefined Variable: PermissionArray

Hey guys, I have just copied a folder of an old project I've been working on, installed composer, used valet to park & link it, migrated using php artisan migrate, and now whenever I enter the domain I get an error from

/Users/danny/Desktop/kzk/app/Providers/AuthServiceProvider.php
        ErrorException (E_NOTICE)
        Undefined variable: permissionArray

Thanks in advance everyone!

17 Apr
1 year ago

dabnad left a reply on Display Validation Errors Axios

@rin4ik nothing to be sorry about! Thank you so much for trying

dabnad left a reply on Display Validation Errors Axios

@rin4ik That's the console log of

.catch(function (error) {
                            console.log(error.response);

Thanks for the quick response

dabnad left a reply on Display Validation Errors Axios

@rin4ik I cant see what it has to do with that, but I've run npm run dev as you said, hard refreshed - I cant see any difference

dabnad left a reply on Display Validation Errors Axios

@rin4ik error.response.data.errors is an object ([object Object])

dabnad left a reply on Display Validation Errors Axios

@rin4ik Thanks for the help! error.response.data returns [object Object] error.response.message returns undefined error.response.data.message returns The given data was invalid. I need to cycle through the error.response.data arrays (which contains the errors I'd like to display as items in them) somehow, but I cant understand how

dabnad left a reply on Display Validation Errors Axios

@rin4ik but error.response.data.message is just "The given data was invalid."

dabnad left a reply on Display Validation Errors Axios

@bobbybouwmann Thank you for replying!

Basically my question is

How can I cycle through all of the arrays under .data.errors?

My current axios code is

axios.post('/lesson-create', {
    length: document.getElementById("pickLength").value,
    started_at: addZero(dDate.getHours().toString()),
    day_at: nadDate.getFullYear().toString(), 
    user_id: studentIDPost,
    pickup_address: pickup_addressPost
    })
    .then(function (response) {
        document.getElementById("errorMsg").innerHTML = response.data;
        if(response.data == 'Success!')
        {
            document.getElementById("errorMsg").className = "text-success";
        }
        else 
        {
            document.getElementById("errorMsg").className = "text-danger";
        }
        console.log(response);
    })
    .catch(function (error) {
        console.log(error.response);
    });

The console log of error.response is an object which Laravel returns when calling by axios. In order to display the error of length for example, I'd need to call: .data.errors.length[0] but it won't exist when there's just an error in started_at. So I basically need to cycle through a list of arrays - and the arrays content. But I don't get how can I cycle through the list of the arrays since its not an array of arrays. (In order to get length for example you'd need to get to the path .data.errors.length[0] while for number it would be .data.errors.number[0] (instead of the zero's there'd be the for-loop index which is being used to cycle through the array's strings).

So basically my question is

How can I cycle through all of the arrays under .data.errors?

16 Apr
1 year ago

dabnad started a new conversation Display Validation Errors Axios

Hey guys, I'm using Axios to post to the create function of my model, these are the validations:

        'length' => 'required|int|max:600',
        'number' => 'int|max:600',
        'started_at' => 'required|date_format:"H:i"',

When there are no errors there's no OBJECT.errors array, and when there's an error with the length only theres OBJECT.errors.length array which contains the string of the error at [0]. So I need to cycle through the whole array which is not a problem (for loop, i<OBJECT.errors.length*.length). but I can not do so when the error is just in 'number' since the array of .length won't exist. I was wondering how can I solve that issue and cycle through all of the returned error strings. Thanks in advance everyone!

26 Mar
1 year ago

dabnad left a reply on Receive All Users(model Objects) To JavaScript Variable

I have found a solution thanks to all of your comments =] Using

window.usersCalendar = JSON.stringify(@json(App\User::where('isAdmin','=',0)->get()));

on the view file, and

        var $usersCalendar = window.usersCalendar;
        $usersCalendar = JSON.parse($usersCalendar);
        console.log($usersCalendar[0].name); // To access specific account and a value of a parameter

I have reached my goal. Thanks again, have a great week!

dabnad left a reply on Receive All Users(model Objects) To JavaScript Variable

@biishmar Thanks! but the line you had written returns a different error- Unexpected token o in JSON at position 1

25 Mar
1 year ago

dabnad left a reply on Receive All Users(model Objects) To JavaScript Variable

@ahmeddabak Thank you so much! but I'm sorry to say that I still get the same error (changed the code to the one you submitted above).

Uncaught SyntaxError: Unexpected token & in JSON at position 2

dabnad started a new conversation Receive All Users(model Objects) To JavaScript Variable

Hey guys, I have been trying to pass all of my users to JavaScript using the following code:

JavaSciprtFile.js

        var $usersCalendar = window.usersCalendar;
        console.log(JSON.parse($usersCalendar));

View.blade.php

    @if(Auth::user()->isAdmin > 0)
    <script type="text/javascript">
        window.usersCalendar = "{{ App\User::where('isAdmin','=',0)->get()->toJson() }}";
    </script>
    @endif

but sadly, I receive the following error on the line of the parsing. Uncaught SyntaxError: Unexpected token & in JSON at position 2 Any type of help would be appreciated, thanks in advance everyone! =]

P.S: I get this error when logged in as Admin, and the if statement is definitely true (tested it out before posting).

23 Feb
1 year ago

dabnad started a new conversation Post To Controller By JavaScript

Hey guys, I was wondering how can I trigger a controller by JavaScript. For example, I currently have a Create page which is posting to the function of create under the model controller, but I want to make it run in a popup instead of a page from now on, so when clicking on Create at the end of the form in the popup, it would trigger the create. Also, is it possible to do so in the background? So there won't be a refresh after clicking on the create there?

Thanks in advance!

dabnad left a reply on Create A Calendar

@bobbybouwmann Thanks! I was hoping to find something else, but I guess I'll have to stick to FullCalendar =]

21 Feb
1 year ago

dabnad started a new conversation Create A Calendar

Hey guys, I have created a simple lesson management system for teachers, the system contains a model of Lesson, which contains starting time, auto calculated ending time, length and etc. CRUD pages are fully functional and working, but I would like to create a UI which wont be painful to use, so I was wondering if you guys know a easy / friendly way to create a responsive calendar-time schedule so I would be able to let users create a lesson for example by clicking on the time they want to schedule it. I prefer something that won't require too much JavaScript knowledge (since I don't have much but basic).

Best regards, thank you so much! and sorry for being noobish

26 Jan
1 year ago

dabnad left a reply on How Can I Install This Npm Package?

Thanks, @bobbybouwmann, In addition to what he had written, adding import Datepicker from 'vuejs-datepicker'; to app.js was needed =]

22 Jan
1 year ago

dabnad started a new conversation How Can I Install This Npm Package?

Hey guys, I'm sorry for being such a noob, but I couldn't figure it out. I ran npm install then npm install vuejs-datepicker -save and added

import Datepicker from 'vuejs-datepicker';
 
Vue.component('my-component', {
    components: {
        Datepicker
    }
});

to bootstrap.js but I couldn't get <datepicker></datepicker> to work.

Please help, Thanks in advance everyone!

18 Jan
1 year ago

dabnad started a new conversation Create A User Register On Admin Side

Hey, I was wondering if there's a built in way or an easy method to let admin register a new account without logging out from his account. Meaning that he would be able to give his phone for example to a new user, and let him fill in the details, click on Register and then get back to his panel without logging out from the new user, and then logging back in to the admin account.

Thanks in advance everyone!

dabnad left a reply on Search Is Not Working

The solution was using this.$parent.searchQuery at the students.js components

17 Jan
1 year ago

dabnad left a reply on RTL Mail Markdown Components

@BezhanSalleh has solved this question, Thank you so much! but I would like to add for future visitors here that the new location (you've probably written the one from 5.4) is:

/vendor/laravel/framework/src/Illuminate/Mail/resources/views/html/themes

dabnad started a new conversation Search Is Not Working

Hey guys, I have made a simple Datatable with search input,

Student.js

Vue.component('student-list',{
    props: ['students'],
    template:`
        
<div class="table-responsive">
<table class="table table-hover mails m-0 table table-actions-bar">
<thead>
    <tr>
        <th>10</th>
        <th>9</th>
        <th>8</th>
        <th>7</th>
        <th>6</th>
        <th>5</th>
        <th>4</th>
        <th>3</th>
        <th>2</th>
        <th>1</th>
    </tr>
</thead>
<tbody>
    <student v-for="student in searchResults" :student="student"></student>
</tbody>
</table>
</div>
    `,
    computed: 
    {
        searchResults: function(student){
            var self = this;
            return this.students.filter(
                function(student){
                    if(this.searchQuery == '' || this.searchQuery == null) { return true; }
                    console.log(this.searchQuery);
                    return (student.toString().indexOf(this.searchQuery) != -1);
                }
                );
        }
    },

//  v-if="searchResults(student)"

});

Vue.component('student',{
    props: ['student'],
    template:`
        <tr>
            <td>
                {{ student.name }} {{ student.lname }}
            </td>
            <td>
                <a href="tel:{{ student.phone }}" title="התקשר" class="table-action-btn"><i class="md-phone"></i></a>
                <a href="tel:{{ student.momPhone }}" title="התקשר לאמא" class="table-action-btn"><i class="ion-woman"></i></a>
                <a href="tel:{{ student.dadPhone }}" title="התקשר לאבא" class="table-action-btn"><i class="ion-man"></i></a>
                <a href="/users/{{ student.id }}" title="ערוך" class="table-action-btn"><i class="ion-android-settings"></i></a>
            </td>
            <td>
                {{ student.address }}
            </td>  
            <td>
                {{ student.totalTopay }}
            </td>
            <td>
                {{ student.lessonsTaken }}
            </td>
            <td>
                {{ student.cancelCount }}
            </td>    
            <td>
                {{ student.phone }}
            </td>
            <td>
                {{ student.momPhone }}
            </td>
            <td>
                {{ student.dadPhone }}
            </td>
            <td>
                {{ student.email }}
            </td>
        </tr>
    `

});

new Vue({
    el: '#content-page',
    data: {
        'searchQuery': ''
    }
});

HTML

....
<div id="#content-page">
        <input type="text" id="search" class="form-control" placeholder="Search..." v-model="searchQuery">
</div>
....
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="{{ asset('js/students.js') }}"></script>
...

Now, for some reason whenever I leave the search blank it works as needed, but when I change the input field by typing in the text box, nothing changes, and when I call it (this.searchQuery) on the Dev Tools console, it says undefined. What am I missing? Thanks in advance everyone, best regards.

dabnad left a reply on RTL Mail Markdown Components

Does someone have an idea?

08 Jan
1 year ago

dabnad started a new conversation Create An Or In Laravel Validation At Controller

Hey guys, I have a controller with a validation line:

'timeStart'    => 'date_format:"Y-m-d H:i"|required'

I was wondering if there's an option to validate and accept both

'timeStart'    => 'date_format:"Y-m-d H:i"|required'

and

'timeStart'    => 'date_format:"Y-m-d H:i:s"|required'

Thanks in advance, Best regards

06 Jan
1 year ago

dabnad started a new conversation RTL Mail Markdown Components

Hey guys, I was wondering if there's a way to RTL the mail's components on Laravel. As you can see in the image below and probably know, the emails are all LTR by default, and you can't just CSS them - because they are based of the Mail's components.

mail

Thanks in advance, Have a great year!

dabnad left a reply on Connection To Controller Isn't Working

Thanks guys, Finally I found the problem. I guess it didn't work since to a missing / at the routes list. Changed to

Route::post('/sms_student', '[email protected]_student');

as @calder12 wrote, and it worked perfectly.

dabnad left a reply on Connection To Controller Isn't Working

@Yama Thanks for the help! but sadly it doesn't work for me =( Even when I put just

    // return redirect('/');

at the sms_student function.

dabnad left a reply on Connection To Controller Isn't Working

@tykus

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message

@Snapey the url this form is on is /send-message and when clicking on submit I get transferred to the action url "/sms_student"

Thanks guys!

dabnad left a reply on Connection To Controller Isn't Working

I'm actually using

{!! csrf_field() !!}

already, I'm sorry that I didn't mention that and thanks!

dabnad started a new conversation Connection To Controller Isn't Working

Hey, I am trying to connect a form to a controller function but for some reason it isn't working, This is the opening and closing of the form:

<form class="form-group form-horizontal m-t-20" action="/sms_student" method="POST">
{!! csrf_field() !!}
...
<input class="btn btn-default btn-lg" type="submit" value="שלח הודעה">
</form>

this is the route(on routes/web.php):

Route::post('sms_student', '[email protected]_student');

and this is the controller (Http/Controllers/ContactController.php):

public function sms_student(){
        Session::flash('success', 'ההודעה נשלחה בהצלחה.');
        return redirect()->route('lessons.index');
}

I can't see what's wrong, would appreciate any try of help

Thanks in advance everyone =)

30 Dec
1 year ago
29 Dec
1 year ago

dabnad left a reply on Get A Config Field In Controller Php File

Thanks wilburpowery, I didn't know there's a function for that.

dabnad left a reply on Pick A Model Id To Edit In Edit Form

Thank you so much! Haven't thought about that

28 Dec
1 year ago

dabnad started a new conversation Get A Config Field In Controller Php File

Hey, I was wondering how can I grab a config variable (which I can find in view pages using Config::get('filename.Variable')) in a model controller (which is a normal php) file.

Thanks in advance everyone, Have a great weekend and a happy new year!

dabnad started a new conversation Create Middleware Which Checks For A Field In User's Row

Hey, I am currently using $this->middleware('auth'); in order to check if the user is authenticated by middleware, but I now need to create a middleware that checks if the current authenticated user's "isAdmin" db field is greater than one, and only if so- he would be allowed to access the code after. (I put this line in the __construct function of my controller), do you guys have an idea about how can I do that?

Thanks in advance everyone!

dabnad started a new conversation Pick A Model Id To Edit In Edit Form

Hey, I was wondering how can I make a form in which I would be able to choose what ID I would like to update.

Currently, the problem is that the action="" is action="/users/" while it needs to be action="/users/{{ $user->id }}" but the ID is only being picked in the form itself as a option. what can I do? Thanks in advance, I hope I didn't make the question too complicated. Best regards, Nadav.