FareedR

FareedR

Member Since 1 Year Ago

Experience Points
8,540
Total
Experience

1,460 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
23
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.

Level 2
8,540 XP
Jan
16
1 week ago
Activity icon

Started a new Conversation Pass Uuid On Route

why i get 404 on route but the uuid given is exist . example

user = uuid 
Route::post('view-profile/{user}', ....)
Jan
14
1 week ago
Activity icon

Started a new Conversation Intersect 2 Collection

how can i display only country that intersect with country in post . any idea?

// example data
countries
id | name |
1   united states
2   england
3   russia

posts 
id | country |
1   america
2   america
3   england


$countries = Country::all();
$posts = Post::where('country',$countries)->get();



//result expect
 only display country that intersect with post[country]


Jan
11
2 weeks ago
Activity icon

Replied to How To GroupBy 2 Columns ?

i already solved it with this code

$wishlists = Wishlist::select('title',\DB::raw('count(*) as wishlists'))->addSelect('country')->groupBy(['title','country'])->orderBy('wishlists','desc')->limit(15)->get();

Activity icon

Started a new Conversation How To GroupBy 2 Columns ?

i wanted to count how many title that has been posted from which country . from my current code, i only get for title only , for country , i will display all of it . for an example

title => 'Nutella',
country => 'Albania' 

title => 'Nutella',
country => 'Albania'

title => 'Nutella',
country => 'Antartica' 

which means on display i will get after groupBy
title => ' Nutella',
country => 'Albania'

title => 'Nutella',
country => 'Antartica'
 $wishlists = Wishlist::select(['title','country'],\DB::raw('count(*) as wishlists'))->groupBy(['title','country'])->orderBy('wishlists','desc')->limit(15)->get();
Jan
06
3 weeks ago
Activity icon

Replied to Why Increment Didnt Worked In Scheduler ?

sorry for that late reply . i already get the increment , somehow in database , it didnt update . this is my current code .

foreach($deals_to_remind_extend as $deal_to_remind_extend){
            if($deal_to_remind_extend->reminder_extend_count >= 3){
                // release payment to seller
                $seller_id = $deal_to_remind_extend->post->user_id;
                $amount_left = $deal_to_remind_extend->amount_left;
                $deal_to_remind_extend->update([
                    'status' => 'Received',
                    'release_payment' => NULL,
                    'amount_left' => 0.00
                ]);
            }else{
                // increment counter
                if($deal_to_remind_extend->reminder_extend_count == 0){
                    $deal_to_remind_extend->increment('reminder_extend_count');
                    dump($deal_to_remind_extend->reminder_extend_count); // 1
                    // $deal_to_remind_extend->buyer->notify(new ReminderExtend());
                }else{
                    $deal_to_remind_extend->increment('reminder_extend_count');
                }
            }
        }
Activity icon

Replied to Why Increment Didnt Worked In Scheduler ?

sorry for the late reply . i didnt get any log for that . am i missing something ?

// this is my current code
foreach($deals_to_remind_extend as $deal_to_remind_extend){

            if($deal_to_remind_extend->reminder_extend_count >= 3){
                // release payment to seller
                $seller_id = $deal_to_remind_extend->post->user_id;
                $amount_left = $deal_to_remind_extend->amount_left;
                $deal_to_remind_extend->update([
                    'status' => 'Received',
                    'release_payment' => NULL,
                    'amount_left' => 0.00
                ]);
            }else{
                // increment counter
                if($deal_to_remind_extend->reminder_extend_count == 0){
                    $data = $deal_to_remind_extend->increment('reminder_extend_count',1);
                    dd($data);
                    // $deal_to_remind_extend->buyer->notify(new ReminderExtend());
                }else{
                    $deal_to_remind_extend->increment('reminder_extend_count',1);
                }
            }
        }
Activity icon

Started a new Conversation Why Increment Didnt Worked In Scheduler ?

this is my current code , somehow when i schedule:run , reminder_extend_count in database, didnt update but email notification received.

if($deal_to_remind_extend->reminder_extend_count == 0){
    $deal_to_remind_extend->increment('reminder_extend_count',1);
        $deal_to_remind_extend->buyer->notify(new ReminderExtend());
}else{
    $deal_to_remind_extend->increment('reminder_extend_count',1);
}
Jan
05
3 weeks ago
Activity icon

Replied to How To Not Display Someone Else Data

@tisuchi as you can see , 1st image is view as seller , and 2nd image view as buyer, somehow, seller can see and become a buyer for that data . https://imgur.com/a/G0AMU6O

Activity icon

Replied to How To Not Display Someone Else Data

SQLSTATE[HY000]: General error: 1096 No tables used (SQL: select * from `deals` where `buyer_id` = 3a4450da-2570-4a31-b100-5471e3fc1d6c and `status` = (select * where `status` = Confirmed or `status` = Delivered or `status` = On Hold)"
Jan
04
3 weeks ago
Activity icon

Replied to How To Not Display Someone Else Data

i try use your implementation . still no luck and i get an error " No table used "

Activity icon

Started a new Conversation How To Not Display Someone Else Data

why i still get data on id 2 ? which eloquent that i wrong ? and this query also give other user can edit someone else data .

// posts
id | user_id | 
1   2
//deals
id | buyer_id | status |
1   1           Confirmed
2   1           Completed

$dealsToReceive = Deal::with('post')->where('buyer_id',$user_id)->where('status','Confirmed')->orWhere('status','Delivered')->orWhere('status','On Hold')->get();
Jan
02
3 weeks ago
Activity icon

Replied to Condition In Select Eloquent Relation

when i use > , i get null , when i use < , i get the data . but i need to get all data that estimate_shipping overdue within today.

$date = Carbon::today();
$date_parsed = Carbon::parse($date)->toDateString();
$deals_to_remind_extend = Deal::select(['post_id','buyer_id','reminder_extend_count'])
        ->with(['post' => function ($query) use ($date_parsed){
            $query->select(['id','user_id'])->where('estimate_shipping','>',$date_parsed);
        },'buyer'])->where('status','Delivered')->get();

https://imgur.com/a/Ls33No9

Activity icon

Started a new Conversation Condition In Select Eloquent Relation

can i know how can i use condition during select . everything is good if i remove condition whereDate . when i put condition , null is given on relation "post"

$deals_to_remind_extend = Deal::select(['id','buyer_id','post_id','amount_left','reminder_extend_count'])
        ->with(['post' => function ($query) use ($date_parsed){
            $query->select(['id','user_id'])->whereDate('estimate_shipping','>',$date_parsed);
        },'buyer'])->where('status','Delivered')->get();
Activity icon

Replied to How Can I Select Attribute On Relation ?

@tisuchi my mistake sir . i already solved it . i didnt aware on attributes in relation ..

https://imgur.com/a/TqJ9Od8

thankyou for your assist . i really appreciated it

Activity icon

Replied to How Can I Select Attribute On Relation ?

this is my fullcode . same like before .

$deals_to_remind_courier = Deal::select(['id','buyer_id','reminder_courier_count',])->whereNull(['shipping_company', 'tracking_no'])->with(['buyer' => function ($query){
                                            $query->select(['name']); 
                                        }])->get();
Activity icon

Replied to How Can I Select Attribute On Relation ?

@tisuchi for this code, i get all attribute in buyer, but i just want name only for optimize my query . you know what i mean ?

Activity icon

Replied to How Can I Select Attribute On Relation ?

yup i have it . when i put buyer_id on query buyer . i got an error said " buyer_id does not exit in table user' something like that

Activity icon

Replied to How Can I Select Attribute On Relation ?

@tisuchi i need to add new attribute on table users for "buyer_id" ??

Activity icon

Replied to How Can I Select Attribute On Relation ?

@tisuchi

//User.php
public function deals()
    {
        return $this->hasMany(Deal::class,'buyer_id');
    }
//Deal.php
 public function buyer()
    {
        return $this->belongsTo(User::class, 'buyer_id');
    }

//example function
 $deals_to_remind_courier = Deal::select('id','reminder_courier_count')
                                        ->whereNull(['shipping_company', 'tracking_no'])
                                        ->with(['buyer' => function ($query){
                                            $query->select('name', 'id'); // i take id because in table users = id 
                                        }])->get();

Activity icon

Replied to How Can I Select Attribute On Relation ?

@tisuchi still no luck on it .

Activity icon

Replied to How Can I Select Attribute On Relation ?

yup . if i didnt use "select". i can get all of it . but when i use "select", i get null on buyer.

//Deal.php
    protected $with = ['buyer', 'post'];

public function buyer()
    {
        return $this->belongsTo(User::class, 'buyer_id');
    }
Activity icon

Replied to How Can I Select Attribute On Relation ?

i've tried it , but i get null on it .

Jan
01
3 weeks ago
Activity icon

Started a new Conversation How Can I Select Attribute On Relation ?

this is my current code , what i get is id and reminder_courier_count only, but i didnt get attribute for name in buyer relation ?

$deals_to_remind_courier = Deal::select('id','reminder_courier_count')->whereNull('shipping_company')->whereNull('tracking_no')->with(['buyer' => function ($query){
            $query->addSelect(['name']);
        }])->get();
Activity icon

Started a new Conversation Change Require To Public Path In Laravel Mix ( React Js )

how can i change from require to public path , because when i change it , path doesnt right ..

// in component file
<img src={require('../../../images/fire.png')} style={{ width: "110px", height: "110px", float: "none", margin:"0 auto", display:"block", marginTop:"60px"}} />

// webpack.mix.js
mix.react(['resources/assets/js/app.js'],'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .styles([
        'resources/assets/css/animate.css',
    ],'public/css/all.css')
    .webpackConfig({
        output: {
            publicPath: '/',
            chunkFilename: `generated/chunks/[name]${mix.config.inProduction ? '.[chunkhash].chunk.js' : '.chunk.js'}`,
        }
    });
Dec
30
4 weeks ago
Activity icon

Replied to How Can I Know My Intervention Image Is Work ?

its really helpful . thank you for sharing this tutorial !

Activity icon

Started a new Conversation How Can I Know My Intervention Image Is Work ?

currently working on package intervention image . i need to use intervention image for my seeder . how can i do it ? i've tried this method . but idk it is work or not . anyone can help ? im using frontend react js and of course using webpack .

        $img = Image::make(public_path('/images/boy.png'))->resize(10000,1000);

Dec
21
1 month ago
Activity icon

Started a new Conversation How To Change Date Format In Dd/mm/yyyy For Database

currently working on date in react js . how convert it into other format . attachment below is equivalent with this https://imgur.com/a/1iv0eOg

$dateParse = Carbon::parse($request->get('estimate_shipping'));
$dateParse = Carbon::parse($request->get('estimate_shipping'))->format('d/m/Y'); // Gives me error ( call member function on string()
dd($request->get('estimate_shipping'),$dateParse);


Activity icon

Replied to Find Max Value On Eloquent

sorry for the late reply . btw im using uuid for the id . assume that example below is uuid on my table . what i want to achieve is , i want only top 3 where status = 1 . based on my table below , i think only post id 1 , 2 , 3 will valid to become top 3 . am i right ?

deals 
id | post_id | user_id | status 
1   1       1           1
2   1       2           2
3   1       3           1
4   1       4           1
5   2       1           1
6   2       2           2
7   2       2           1
8   3       3           1
9   4       4           1
10  5       5           1
11  3       3           1

Dec
19
1 month ago
Activity icon

Started a new Conversation Find Max Value On Eloquent

why i get an error sql "Column not found: 1054 Unknown column 'posts.id' in 'where clause' (SQL: select max(post_id) as aggregate from deals where posts.id = deals.post_id and deals.deleted_at is null)", " am i doing in correct way ?

$hotDeals = Post::whereHas('deals', function ($query){
            $query->max('post_id')->limit(5);
        })->where('status','published')->where('expired_at', '>=', now())->orderBy('expired_at', 'asc')->get();
Dec
13
1 month ago
Activity icon

Replied to Tricks On SlideToggle

@sinnbeck i've tried on react-slide-toggle , but still no luck on my own css . i've tried on second example on docs which is https://github.com/kunukn/react-slide-toggle#component-example-simple---function-as-child

this is exampe output that i want . when user click on their name, slide will appear for account settings and etc

https://imgur.com/alwp7hB

<div className="user-account">
                                    <div className="user-info">
                                        <img src="images/resources/user.png" alt=""/>
                                        <a href="#" title="">John</a>
                                        <i className="la la-sort-down"></i>
                                    </div>
                                    <SlideToggle>
                                        {({ toggle, setCollapsibleElement }) => (
                                            <div className="my-collapsible">
                                            <button className="my-collapsible__toggle" onClick={toggle}>
                                                toggle
                                            </button>
                                            <div className="my-collapsible__content" ref={setCollapsibleElement}>
                                                <div className="my-collapsible__content-inner">
                                                    <div className="user-account-settingss" id="users">
                                                        <h3>Setting</h3>
                                                        <ul className="us-links">
                                                            <li><a href="profile-account-setting.html" title="">Account Setting</a></li>
                                                            <li><a href="#" title="">Privacy</a></li>
                                                            <li><a href="#" title="">Faqs</a></li>
                                                            <li><a href="#" title="">Terms & Conditions</a></li>
                                                        </ul>
                                                        <h3 className="tc"><a href="" onClick={this.handleLogout} title="">Logout</a></h3>
                                                    </div>
                                                </div>
                                            </div>
                                            </div>
                                        )}
                                    </SlideToggle>
                                </div>

sorry for messy indentation , take a look on this pastebin

https://pastebin.com/XXwbB103

Activity icon

Started a new Conversation Tricks On SlideToggle

how can I use slideToggle on react js ? any tricks ?

Dec
11
1 month ago
Activity icon

Replied to CSS Overlap

thankyou for your respond , i think my problem is i have the same class name in those files . semantic has the same predefine with 3rd party . how can I resolve it ?

Activity icon

Replied to CSS Overlap

conflict between semantic.css and style.css . for animate.css, both of template has it . but i mix the newest version only .

// example directory 

public
    - css
        all.css
resources
    - assets
        - css
            animate.css ( version 2.5 )
            - workwise
                animate.css ( version 2.4 )
                style.css
        -vendor
            - semantic
                - dist
                    semantic.css

my problem is i compiled new css file which is workwise for my project . some of semantic component i need to use so i need to keep it and the new css file is the newest css that i need to follow .

my expectation is i can run correctly on semantic component and 3rd party template css without any conflict .

Activity icon

Replied to CSS Overlap

sorry again for my mistake . its not bootstrap . its semantic react . this is my current code . i merge css file into all.css

mix.react(['resources/assets/js/app.js'], 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .styles(['resources/assets/vendor/semantic/dist/semantic.css',
    'resources/assets/css/animate.css','resources/assets/css/workwise/style.css'],'public/css/all.css')
    .webpackConfig({
        output: {
            publicPath: '/',
            chunkFilename: `generated/chunks/[name]${mix.config.inProduction ? '.[chunkhash].chunk.js' : '.chunk.js'}`,
        }
    });
Activity icon

Replied to CSS Overlap

not overlap but css confilict . i have 2 css file which is bootstrap and other 3rd party template . when i mix the styles, all styles messed up . do you know any tricks to resolve the conflict ?

Activity icon

Started a new Conversation CSS Overlap

How can I resolve css overlap ? any tricks ?

Activity icon

Replied to How To Count Query In Laravel Eloquent?

you can try this . it might be error . but i guess you can find something with that code ;)

$attendance = Attendance::with('student', function ($query) {
    $query->where('username',$request->name);
})->where('created_at')->count();
Dec
06
1 month ago
Activity icon

Started a new Conversation Filter Bad Words Package

Is there any recommended package on filter bad words other than this ? thank you in advance .

https://github.com/Askedio/laravel-profanity-filter

Dec
02
1 month ago
Activity icon

Awarded Best Reply on Error On WithTrashed()

solved it ! i put it on Deal model

public function post()
    {
        return $this->belongsTo(Post::class, 'post_id')->withTrashed();
    }
Activity icon

Replied to Error On WithTrashed()

solved it ! i put it on Deal model

public function post()
    {
        return $this->belongsTo(Post::class, 'post_id')->withTrashed();
    }
Activity icon

Started a new Conversation Error On WithTrashed()

basically i have Post & Deal model which is Post hasMany Deal and Deal belongsTo Post . Below is my current code, i used withTrashed() to get all post that has been deleted by user_id . did i use it correct way ? note that i already use SoftDeletes on Model

// database
posts
id | title | deleted_at
1   asd     timestamps

deals
id | post_id | transaction | etc ....
1   1       2

// controller
$user_id = auth()->id();
$deals = Deal::with('ratings')->whereHas('post', function ($query) use ($user_id) {
    $query->where('user_id', $user_id)->withTrashed();
})->orWhere('buyer_id', $user_id)->get();
Nov
28
1 month ago
Activity icon

Started a new Conversation Helpers On Contains

currently im doing like post and unlike post , related model is Post , LikePost . why i still getting false on contains function. am i missing something ?

// database
id | post_id | user_id |
1   2       1

// User.php
public function posts()
    {
        return $this->hasMany(Post::class, 'user_id');
    }

// Post.php
public function likes()
    {
        return $this->hasMany(LikePost::class, 'post_id');
    }

// LikePost.php
public function posts()
    {
        return $this->belongsTo(Post::class,'post_id');
    }

    public function user()
    {
        return $this->belongsTo(User::class,'user_id');
    }

// Controller 
$posts = Post::where('available_qty','!=',0)->where('expired_at', '>=', now())->orderBy('expired_at', 'desc')->where('status', 'published')->get();

        $newPost = [];
        foreach($posts as $post) {
            $post['isLiked'] = 0;
            dd($post->likes->contains('user_id', $user_id)); // false
            if ($post->likes->contains('user_id', $user_id)) {
                $post['isLiked'] = 1;
            }
            $newPost[] = $post;
        }

        if (count($posts)) {
            return response()->json(['status' => true, 'result' => $newPost]);
        }
Nov
18
2 months ago
Activity icon

Awarded Best Reply on How Can I Foreach Array In System Settings ?

@goldtaste @tykus i solved it , thankyou for your response

public function getWalletOption()
    {
        $wallet_options = Helpers::getSetting('wallet_amount_options');
        $json_wallet_options = json_decode($wallet_options,true);
        foreach($json_wallet_options as $wallet_option){
            $amount_option[] = [
                'key' => $wallet_option['key'],
                'text' => $wallet_option['text'],
                'value' => $wallet_option['value'],
            ];
        }
        return response()->json(['status' => true, 'amount_option' => $amount_option, 'message' => 'Successfully fetched'],200);
    }
Activity icon

Replied to How Can I Foreach Array In System Settings ?

@goldtaste @tykus i solved it , thankyou for your response

public function getWalletOption()
    {
        $wallet_options = Helpers::getSetting('wallet_amount_options');
        $json_wallet_options = json_decode($wallet_options,true);
        foreach($json_wallet_options as $wallet_option){
            $amount_option[] = [
                'key' => $wallet_option['key'],
                'text' => $wallet_option['text'],
                'value' => $wallet_option['value'],
            ];
        }
        return response()->json(['status' => true, 'amount_option' => $amount_option, 'message' => 'Successfully fetched'],200);
    }
Nov
17
2 months ago
Activity icon

Started a new Conversation How Can I Foreach Array In System Settings ?

how can i return json with data in value ?

// settings
key | value | 
options {"key"=>10,"text"=>'SGD  10',"value"=>10}

// controller 
//current solution getting an error "invalid argument to supplied foreach"

$wallet_options = Helpers::getSetting('options');
        $options = [];
        foreach($wallet_options as $wallet_option ){
            $options[] = [
                'key' => $wallet_option->key,
                'text' => $wallet_option->text,
                'value' => $wallet_option->value
            ];
        }
Nov
07
2 months ago
Activity icon

Replied to Search Hashtag Symbol In Laravel Got Null

am i right ?

1)encode #laravel from frontend 2)pass it to backend 3)decode #laravel from backend

Nov
06
2 months ago
Activity icon

Replied to Search Hashtag Symbol In Laravel Got Null

which part do i need to urlencode it ? based on what i understand is urlencode need to converted BEFORE to send it right ? frontend seems fine to me ..

Activity icon

Replied to Search Hashtag Symbol In Laravel Got Null

how can this happen ? res already sent ?keyword=#laravel , but when send to backend , didnt recognize #laravel .. any tips ? search?keyword=

Activity icon

Started a new Conversation Search Hashtag Symbol In Laravel Got Null

how can i get #laravel in my searching input ? frontend using react js and backend using laravel

//frontend
var search = #laravel
var query = '?keyword='
var res = query.concat(search)

//res output #laravel

dd($request->input('keyword');
// output = null
Nov
04
2 months ago
Activity icon

Replied to Redirect Authentication From API Controller To Web

@bugsysha @bugsysha based on my use case , admin doesnt need token to logged in to dashboard. just need to authenticated as web user .