badr

badr

Member Since 2 Years Ago

Experience Points 1,000
Experience Level 1

4,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 0
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.

19 Jun
1 year ago

badr left a reply on How To Pass URL String As Parameter To Laravel Routing

@bashy I can't even access the input of the user . you can try , you will get this page is not available .

laravel routing dosnt even understand that this

http://localhost:8000/watch?v=https://www.youtube.com/watch?v=q9FE7uNvvIk

for this

Route::get('/watch',"[email protected]");

I'm getting not found page with previous example

badr left a reply on How To Pass URL String As Parameter To Laravel Routing

It seems like laravel issue , most of the people asked the same quastion and there was no real answer , for me I solved the problem by changing the way of submitting the form ,

what I did is : I used post action , then extracting video id form url and redirect to watch?v=youtubeId

Route::post('watch', "[email protected]");

public function redirectToId()
{

    $query = parse_url(request('v'), PHP_URL_QUERY);
    parse_str($query, $params);
    $youtubeId = $params['v'];

    return redirect()->to(url('watch?v='.$youtubeId)) ;


}

this is the only solution that come to my mind :p

badr left a reply on How To Pass URL String As Parameter To Laravel Routing

@bashy I dont have youtubeId because the link is coming from user form . they will type YouTube link then I post or get what he did .

badr left a reply on How To Pass URL String As Parameter To Laravel Routing

@Yoki how I will use those function , ? ? I can't even access to video url because it's coming from user form

badr started a new conversation How To Pass URL String As Parameter To Laravel Routing

Hi , I have stuck on a problem in Laravel

I want to pass parameter with question mark , firstly I got question mark problem in url but I solved by using

public function upload(Request $request)
{
return $request->query('v');
}

Route::get('/watch',"[email protected]");

for me the previous solution : the link will accept any URL like "locahost:8000/watch?v=youtubeId"

but the problem is when instead of youtube id I pass youtube video link ? what can I do ?

previous solution dosn't accept slash like "http://localhost:8000/watch?v=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dq9FE7uNvvIk"

how to solve this issue ? honestly I'm converting a project to laravel and it was fine with pure php

I'm so restricted about how the the link will look like ( dont suggest me to change the way) I can't change it for some important reasons .

thanks

14 Feb
1 year ago

badr left a reply on ResetPassword Link Incorrectly Formatted

i have tried to edit my post but i got this message I dont know why Your IP address is currently blocked, due to spam.

Why :D

badr started a new conversation ResetPassword Link Incorrectly Formatted

Hi , I'm working on laravel reset password and there is something really strange The thing is laravel send me the password with wrong format

/password/reset?d3b27e5dc939fd549d642963431d1109ea95ee4112f7345ef1c71c574ce791fe

instead of

/password/reset/d3b27e5dc939fd549d642963431d1109ea95ee4112f7345ef1c71c574ce791fe

there is question mark between before the token

this is my route

    // Password reset link request routes...
Route::get($backend.'/password/email', 'Auth\[email protected]')->name('password.email');
Route::post($backend.'/password/email', 'Auth\[email protected]');

// Password reset routes... Route::get($backend.'/password/reset/{token?}', 'Auth\[email protected]')->name('password.request'); Route::post($backend.'/password/reset', 'Auth\[email protected]')->name('password.reset');

I worked before on reset password but in this project I dont know what is the problem .

any idea please

16 Apr
2 years ago

badr left a reply on The Correct Way To Use MakeHidden In Laravel

@Snapey I did it :D

this is what i did

$result = Job::where('user_id','=',Auth::id())->paginate(5);
 $data =$result;
 $result= $result->makeHidden(['hasMessage']);
 $data->data = $result;
return $data;

thank you anyway .

badr left a reply on The Correct Way To Use MakeHidden In Laravel

'hasMessage' is an append failed not a columns . because of that i can't select it and i will get an error .

and i can't hide it inside my model because it's visible in another place

badr started a new conversation How To Use Laravel Pagination With MakeHidden

Hi , I have problem with the pagination everything work fine without error but the problem is when i use makeHidden with my code it change the structure of my json pagination result

this is my code

 $result = Job::where('user_id','=',Auth::id())->paginate(5);

    $result= $result->makeHidden(['hasMessage']);

without the second line the result is

 {
total: 1,
per_page: 5,
current_page: 1,
last_page: 1,
next_page_url: null,
prev_page_url: null,
from: 1,
to: 1,
data: [
{
id: 4,
sid:125,
hasMessage: true
}
]
}


but when i use makeHidden I got 

 [
{
id: 4,
sid:125,
}
]


any idea please ? ? ? is it a bug or there is something wrong ? ? 
22 Feb
2 years ago

badr started a new conversation How To Do An Event When Any Update Is Accrues In My Database

Hi , is there is any way to do an event to detect if user update his information ? ??

for me i have 10 tables related to this user and I need to do an event and insert something to database when any of this 10 tables updated

I'm not familiar that much with event and listener

any example for how can i do that please ? ? ?

17 Feb
2 years ago

badr started a new conversation Multiple Authentication In Laravel 5.2

Hi , I have user table with two type of users ( admin and normal ) the different is only the Type 1 for admin and 0 for the normal

what i need is to know how can separate this two login I dont need to get conflict between those users

for me now the admin can't sign in to the website as normal user until he sign-out from his account and if i did some if else and he make a login he will automatically sign out from his admin account and that what i dont need to happen

12 Feb
2 years ago

badr left a reply on I Lose All The Input Data When I Use __construct In My Model

I have solved the problem

     function __construct(array $attributes = array())
  {
       parent::__construct($attributes);

    }

I must send an array to my __construct as an attributes

and pass the attributes to parent::__construct();

badr left a reply on I Lose All The Input Data When I Use __construct In My Model

@mstnorris I'm sorry parent::__construct(); i already have

parent::__construct();

inside my code

i forget to write it here

badr left a reply on I Lose All The Input Data When I Use __construct In My Model

function  __construct(){
//some code
}

badr started a new conversation I Lose All The Data When I Use __construct In My Model

I can't insert any record to my database when i use __construct in my model

         Skill::create([
        'employee_id' => Auth::user()->id,
        'name' => Input::get('name'),
        'percentage' => Input::get('percentage'),
    ]);

if i remove __construct from model it will work fine without any problem

any idea please ? ?

06 Feb
2 years ago

badr started a new conversation The Best Way To Do Api ( Login And Other Stuff ) Between Android And Laravel Project

Hi , I need to know how can i do the authentication between an android and my laravel project I didnt work with login as an API before and i didnt understand the logic of the token 1-) I can send the password and the username in each request why we need the token then ? ?

I have searched on the internet and i couldn't understand the whole idea of this Token ,

I need a simple example if that is possible

and if anyone can explain what the token is really is .

31 Jan
2 years ago

badr started a new conversation Insert A New Record If Not Exist And Update If Exist,and Remove In Not Exist Laravel Eloquent

Hi , I'm working on dynamic form

the form can have one , two or three groups

//group 1
    study[0][name]
    study[0][surname]
    study[0][date]
    //group 2
    study[1][name]
    study[1][surname]
    study[1][date]
    //group 2
    study[2][name]
    study[2][surname]
    study[2][date]

and i'm getting the input as an array the problem is how can i detect the new value from the updating value and what if someone delete Fields how can i detect that and remove it from my database

the example of what i mean is when the user open the page he will get his three old dynamic input from database

1 2 3

then when he click on delete button inside (field 2 ) to I will remove 2 from his screen (not effect database yet , only html part)

he update 1 to new value

and he add new field [4]

before submitting he has now group 1 (fields update ) group 3 ( old fields ) group 4 ( new fields )

how can i detect those cases on my backend side ? ?

i have this cases before and what i do is remove everything from database and insert again but i can't do that on this project because there is some foreign key related my columns

22 Jan
2 years ago

badr left a reply on The Best Way To Fetch Any Level Of Eloquent Relation

thank you so much for this :)

After some search I found a solution came with Laravel itself

you can go in depth by using dot ( . ) between your relation $Result = Type::find(1)->with('Category. Posts.Comment')->get()

badr started a new conversation The Best Way To Fetch Any Level Of Eloquent Relation

Hi ,

how to fetch an eloquent relation without entering through the result one by one

what I mean is:

I have relation like

Type->Category->Posts->Comment

from type I need to take the Comment

it can be done if I enroll from the "Type" result into each relation one by one to get the comments

but its going to be really hard if we have very long relation

what is the easiest way to fetch the comment from my previous example

20 Jan
2 years ago

badr started a new conversation Where Is The Best Place To Do The Permission Part ?

Hi , I need to know if there is any stander form to follow to do The permission part I can do it in Multiple ways but I'm looking for the profession step , is it going to be as middleware ? or inside each function in my controller ? is there is another way ? I have no idea about Policies is it gonna help ? or there is something else I need to care for it ?

08 Dec
2 years ago

badr left a reply on How To Sort Input File By The Name ?

:P I have an html page and

when the user submit his image I need to sort the image by the name

the problem is solved

$collection = collect(\Input::file('image'));

    $collection = $collection->sortBy(function($file)
    {
        return $file->getClientOriginalName();
    });

    

thank you for your help :)

badr left a reply on How To Sort Input File By The Name ?

My job does not related to database and modal at all I'm asking about sorting an image came from user not from database

badr started a new conversation How To Sort File Input Came Directly From The User By The Name

Hi , I'm getting multiple images from the user but I need a way to sort those images by there names i tried to use collection but it didn't work any idea ?

23 Nov
2 years ago

badr left a reply on Conflict Between Base Routing "/" And The Other Route

finally the problem is done but i didnt understand why i got template from them-forest and i'm using this template in my project

i removed this script file from my template

I tried to read the code of it but i didn't mention to anything strange , it's seems like there is something append / route to all my view

the important part is everything work fine :p .

what i'm going to do is to load this file only inside the / view

thank you @zachleigh for your time

badr left a reply on Conflict Between Base Routing "/" And The Other Route

if you have multiple level of URL like domain.com/a/b/c you have to use something like this because if there is an image inside you html like

   <img src="Image/file.png"> 

it will goes to

 <img src="/a/b/c/Image/file.png"> 

if you didn't set a base for you page or your files

you will get something like that

badr left a reply on Conflict Between Base Routing "/" And The Other Route

if i didn't use this line i have to go along all my src on the project and edit the base URL of each image or style or JavaScript and i have a lot of these stuff to do ,it will take time

actually i always do what i did above but i have no idea why i got this problem in this Luckless project

badr left a reply on Conflict Between Base Routing "/" And The Other Route

but i'm sure that the problem came from the

    <base href="{{URL::to('/')}}">

line

because when i remove this line everything work fine

badr left a reply on Conflict Between Base Routing "/" And The Other Route

the html of the view is very long i cant past it here :P

badr started a new conversation Conflect Between Base Routing "/" And The Other Route

Hi ,

I got a problem with routing my two line is this

Route::get('/','[email protected]'); Route::get('{name}','[email protected]');

each if those route  have there own view file extended from one template  

when i enter to

Route::get('{name}','[email protected]');

Everything fine but after two second of loading i got the result of

Route::get('/','[email protected]');



over some of my html code 

its like i past the / view inside {name } one

    this is really strange 

the problem happen when i use

in the head if my views

and disappear if i remove it

any help about this conflict ? ? ? ?