abusalameh

abusalameh

Member Since 4 Years Ago

Jenin

Full Stack Developer at One Stop Parking ( onestopparking.com )

Experience Points 136,760
Experience Level 28

3,240 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 1336
Lessons
Completed
Best Reply Awards 17
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.

14 Feb
7 months ago

abusalameh left a reply on Can I Access $hidden Attributes Inside Retrieved Model Event ?

@talinon Thanks for the answer, I was looking for something general instead of adding these to each model

12 Feb
7 months ago

abusalameh started a new conversation Can I Access $hidden Attributes Inside Retrieved Model Event ?

Hi Guys, I need to access and modify $hidden on the fly inside the retrieved event in laravel models. any help ?

14 Oct
11 months ago

abusalameh started a new conversation Embedding Images In Laravel Mailable Views ( Gmail )

Hello guys, I hope you're doing well.

I've just a small question about embedding images in laravel mailable views,

after searching I find out this line in laravel docs

<body>
    Here is an image from raw data:

    <img src="{{ $message->embedData($data, $name) }}">
</body>

please just help me to know how to use those parameters $data and $name I don't understand there's no full explanation about them in the docs

09 Aug
1 year ago

abusalameh left a reply on Body Exceeds In Aside

@joffpascual screenshots please and give some code sample

06 May
1 year ago

abusalameh started a new conversation Refresh Token , Handling Multiple Request When Token Is Expired

I need to know about handling requests when the access token is expired.

I have this case

Where I have been logged in, then the access token is expired. I tried to refresh the page for some reason and the page sents multiple ajax calls let's say 5, the problem that the refresh token is requested for each request, so any help how to handle the refresh token without the need of requesting N refresh token calls.

27 Jan
1 year ago

abusalameh left a reply on Handle User Page Refresh With Vue-router

@ejdelmonico

no it's fully loaded, and functions very well, but the problem is when I hit browser refresh button if I'm in a child route then it shows a white page!

abusalameh left a reply on Handle User Page Refresh With Vue-router

i got this error in the console

test:13 GET http://localhost:8080/dashboard/dist/build.js net::ERR_ABORTED

I didn't mean to get the data back, the whole project is not loading at all , Vue is not there !

abusalameh left a reply on Handle User Page Refresh With Vue-router

@ejdelmonico I didn't get the idea, can you explain please?

abusalameh started a new conversation Handle User Page Refresh With Vue-router

Hi guys,

I've the following example

vue-routes

.
.
.
.
path : '/dashboard',
name: 'dashboard',
component: Dashboard,
children : [
    {
        // matching route is /dashboard/test
        path:'test',
        component:Test,
    }

]

and I've <router-view> in both App.vue main component, and another one in Dashboard component

I can reach the route ( '/dashboard/test/') and it works perfectly, but when I reload the page using the browser I have a white page.

any help?

24 Jan
1 year ago

abusalameh left a reply on How To Work With 3 Column Pivot Table

Hi there, you can simply add values like this

$model->pivotRelation->sync([
    'post_id' => $post_id,
    'author_id' => $author_id,
    'some_other_id' => $some_other_id,
]);

30 Oct
1 year ago
16 Oct
1 year ago

abusalameh left a reply on How Can I Use CSRF Token With Axios Post Method?

you need first to require axios then append the headers


window.axios = require('axios');

window.axios.defaults.headers.common = {
    'X-Requested-With': 'XMLHttpRequest',
    'X-CSRF-TOKEN' : document.querySelector('meta[name="csrf-token"]').getAttribute('content');
};



24 Sep
1 year ago

abusalameh left a reply on Array Automatically Changed To Object After Deletion

@minwea can you submit the backend code please ?

11 Sep
2 years ago

abusalameh left a reply on Change Order Items

@GABONATOR

you can do the following assuming that you've an array of names

 <div v-for="user in reverse">
            <user :us="user"></user>
        </div>


computed: {
            reverse: function() {
        // this will clone the previous array and reverse it (slice) makes a clone of the array 
                return this.names.slice().reverse();
            }
        }


abusalameh left a reply on How To Fire Ajax Call With Parameters On "mounted"

is this inside a laravel project ?

abusalameh left a reply on How To Fire Ajax Call With Parameters On "mounted"

hi :)

sure you can pass the parameters through out vue-router either by passing it as a url param , or as a query string param

and I think it's better to grap the data using a get request instead of post

02 Sep
2 years ago

abusalameh left a reply on Parent - Child Communication

Vuex is such a good choice to solve this problem ... thank you both @sgtpepper and @topvillas :)

abusalameh started a new conversation Parent - Child Communication

Hello Guys,

I have two vue components ...

  • List
  • User

List contains an array of User component I get the data from an API ... and pass the returned data to User as a prop


    <ul>
        <li v-for= "user in users"> 
            <User :data="user"> </User>
        </li>
    </ul>

the problem is that when users the data from the API changes it's not reflected in the child component ! any help ?

17 Aug
2 years ago

abusalameh left a reply on 500 Internal Error Laravel With Ajax Post Request

@mahammad in your model Question

use

protected $guarded = [];

// or

protected $fillable = [
    'firstname',
    'email',
    'subject',
    'message'
];

this will solve the problem :) sorry for late reply

16 Aug
2 years ago

abusalameh left a reply on 500 Internal Error Laravel With Ajax Post Request

just click on xhr http://localhost:8000/faq in preview section you'll get a message from laravel @mahammad please upload it :)

abusalameh left a reply on 500 Internal Error Laravel With Ajax Post Request

ok , then whats the internal server error ? in the network tab ?

abusalameh left a reply on 500 Internal Error Laravel With Ajax Post Request

will you take a screen shot of the post request info from the developer console I think this issue is related to the full url as you're using only /faq instead of full address , please take a screen shot an show me what you've got :)

30 Jun
2 years ago

abusalameh left a reply on Relationship Between Three Tables

@Kunzilla you need to define the relationships between the User and Club Models

// this file for User Model 
<?php


use App\Club;

class User Extends Eloquent {



public function clubs() {

return this->belongsToMany(Club::class,'user_id');

}

}

<?php
// This File for Club Model 

use App\User;

class Club Extends Eloquent {



public function users() {

return this->belongsToMany(User::class,'club_id');

}

}

after that you can use it

$users = User::with('clubs')->get();



24 Jun
2 years ago

abusalameh left a reply on Replace Element With Jquery

there's no need to separate class names with acomma just use space instead

abusalameh left a reply on How To Redirect To Current Page After Login

you'll need to use this method

    return redirect()->intended('dashboard');
22 Jun
2 years ago

abusalameh left a reply on Multi Step Registeration

there's a vue component for that

give this a try

https://vuetifyjs.com/components/steppers

18 Jun
2 years ago

abusalameh left a reply on Help On : Let's Build A Forum With Laravel And TDD: Initial Database Setup With Seeding

use php artisan make:model Thread -mrc add c to create the controller

m: Model & Migration

c : Controller

rc : Resourceful Controller

abusalameh left a reply on Create Vs ForceCreate

@amindev did you get the idea ? for further information

follow up the link

https://laravel.com/docs/5.4/eloquent

abusalameh left a reply on Create Vs ForceCreate

create throws a mass assignment exception if you don't setup fillable fields

where forceCreate ignores fillable property in the model

abusalameh left a reply on How To Change Created_at To A Timestamp During Or After Querying.

@ULTRASAMAD

you need to define it in the model as a date and you can use Acessor to get the data back as you want

<?php 

class Notice extends Eloquent {

protected $dates = ['created_at', 'updated_at'];


public function getCreatedAtAttribute($value)
    {
    // example 
    return $value->diffForHumans();

    }

}

https://laravel.com/docs/5.4/eloquent-mutators

abusalameh left a reply on Localizing Date In Laravel 5.3

@MAHBUBRAHMAN

did you try something like this ?

$western_arabic = array('0','1','2','3','4','5','6','7','8','9');
$eastern_arabic = array('٠','١','٢','٣','٤','٥','٦','٧','٨','٩');

$str = str_replace($western_arabic, $eastern_arabic, $str);

abusalameh left a reply on [undefined × 2, __ob__: Observer] Vue.js With Laravel Error

@Fhreak do not worry , I did this mistake before :P

abusalameh left a reply on [undefined × 2, __ob__: Observer] Vue.js With Laravel Error

@FHREAK

use array.splice method

this.image.splice(key, 1);
this.images = { };

abusalameh left a reply on How To Use Laravel Route() Helper

@Snapey He may need to pass optional parameter to get specific folder , and if the parameter not passed , then the function will get all folders

abusalameh left a reply on How To Use Laravel Route() Helper

in addition to @topvillas comment add id wildcard



Route::get('/folders/list/{id?}', ['as' => 'folders.list', 'uses' => '[email protected]'])

and when using the helper route


{{ route('folders.list',['id' => 1]) }} // this is if it's inside a link 


// this is if it's within controller 
route('folders.list',['id' => 1]);

13 Jun
2 years ago
07 Jun
2 years ago

abusalameh started a new conversation Eager Loading Recursive Relation

Hello guys, I've a question about if we can use eager loading for self-table with table alias for original table and recursive table

for more details

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class ProjectCategory extends Model
{
    protected $table = 'project_categories';
    
    public function parent()
    {
        return $this->belongsTo(ProjectCategory::class,'parent_id');
    }

}

when I eager-load the relation I want to specify the parent() as an alias table like having two different aliases for one table.

any help ?

abusalameh left a reply on ErrorException In 80fce0be48ed3b2cd527007937305e5b3980a066.php Line 21: Undefined Variable: Data (View: C:\Project\resources\views\admin\account.blade.php)

You need to do it this way

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
// add this to use Admin Model
use App\Admin;
class editAdminController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
       // $data=admins::all();
    // change to this 
        $data=Admin::all();
        return view('layout')->with('data',$data);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        return view('admin.account');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        return redirect('/admin');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}
06 Jun
2 years ago

abusalameh left a reply on Share A Variable To All Views

in the case of using Auth::user() you need to share this only if the Auth::check() returns true

or why not to use them directly in your code ? what's the benefit from re-writing the same functionality in a variable !

abusalameh left a reply on Share A Variable To All Views

add them to App service provider in boot method

<?php

namespace App\Providers;

use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('signedIn', \Auth::check());

     View::share('user', \Auth::user());
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}
05 Jun
2 years ago

abusalameh left a reply on Unable To Pass The Auth_> Id In Each View Page

@DurgeshJha you're very welcome bro, in this case you need to use view composer

follow up in this link

https://laravel.com/docs/5.4/views#sharing-data-with-all-views

this will allow you to load data across all your pages like sharing variables that are anywhere accessible in your app

abusalameh left a reply on Error

@abubakar did that worked for you ?

abusalameh left a reply on [1049] Unknown Database

check if you've created the database and it matches the configurations in .env file

abusalameh left a reply on Error

Hey Bro, @abubakar just go to User.php which is the user model , then add a property

class User extends Eloquent {

protected $primaryKey = 'user_id';

}

and everything will go as you expect ^^

04 Jun
2 years ago

abusalameh left a reply on Where Are You All From?

Palestine , Jenin

@JeffreyWay I hope you update my country to the list of countries ! it's not on the list :(

Palestine