bitcoinboy

bitcoinboy

Member Since 4 Years Ago

Nouakchott

Web developer at Home

Experience Points 5,230
Experience Level 2

4,770 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 27
Lessons
Completed
Best Reply Awards 2
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.

26 Mar
3 months ago

bitcoinboy left a reply on Help Me Look My Query

use laravel collection method map

$modifiedList = $list->map(function($item, $key){
    return array_merge(
        $item,
        [
            'data' => [ 
                'quantity' => $item['quantity'],
                'purchase_order_date' => $item['purchase_order_date']
            ]
        ]
    );
});
23 Mar
3 months ago

bitcoinboy left a reply on Best Way To Handle Users Image Upload (for Gallery)

Thirty minute ready documentation for "https://github.com/spatie/laravel-medialibrary" will make things more easier for you.

bitcoinboy left a reply on Passing User Data To Be Used Within Vuejs Code Base.

You may simply use:

<script>
window.user = @json(auth()->user());
</script>

Note:

  • lowercased window.USER to window.user (Javascript code style)
  • User attributes will be show (except the $hidden which has password by default)
  • @json blade direct is available for laravel 5.5 and upper.
23 Jan
5 months ago

bitcoinboy started a new conversation Favorites & Favorites Group

Hello, I'm thinking of a many to many relationship where a favorites can belong to many groups and a group can have many favorites.

What is the best idea to do this ?

17 Jan
6 months ago

bitcoinboy left a reply on Multiple Form Update

@CIPSAS - Well my idea was to have all those forms controlled by one class

bitcoinboy started a new conversation Multiple Form Update

I'm looking for a better way to store multiple forms update. E.g: in one page I have multiple forms each one have a hidden input with its type.

<input type="hidden" name="type" value="type_of_form">

Currently I'm handling it like this:

        $type = request('type');


        if ($type === 'basic')
            $this->updateBasic();

        if ($type === 'legal')
            $this->updateLegal();

        if ($type === 'address')
            $this->updateAddress();

        if ($type === 'address')
            $this->updateAddress();

I think this is simple but too long. Is there any simplest way ?

15 Jan
6 months ago

bitcoinboy left a reply on Using An Array In An SQL Query

$results = StockProfitReportView::
    ->whereIn('ProductGroup',  $searchData)
    ->get();
30 Nov
7 months ago

bitcoinboy left a reply on Access Laravel Auth Using Python

I will have to try it currently sending remember token to get the user

15 Nov
8 months ago

bitcoinboy started a new conversation Access Laravel Auth Using Python

I have an application that require both python and PHP.

Is it possible to determine the current authenticated user id using python ?

27 Oct
8 months ago

bitcoinboy started a new conversation Broadcast Without Pusher

Is it possible to broadcast events without pusher and without NPM as frontend but as laravel-echo-server. Also I want to know if this is possible with current broadcast system:

Broadcast from laravel then show it in the browser

21 Oct
9 months ago

bitcoinboy started a new conversation Call_user_function(JeffreyWay::class) Returns Null !

Hi there,

    call_user_function(JeffreyWay::class);

I don't want to be off-topic. but It's been time I didn't hear about Jeffrey way, following him on his twitter @jeffrey_way , all his tweets are deleted.

@JeffreyWay I just want to know that everything is okay. we miss you.

07 Sep
10 months ago

bitcoinboy left a reply on How To Create A Custom Error Page 405

If you're using Laravel 5+ create a view in this directory:

resources/views/errors/405.blade.php

06 Sep
10 months ago

bitcoinboy started a new conversation Extends DatabaseNotification

Illuminate\Notifications\DatabaseNotification is a part of Notification system, the idea is to extends this class and give it new properties & methods. Can this be realised through AppServiceProvider ?

11 Feb
1 year ago

bitcoinboy left a reply on Model Save Or Update Casts Object

It doesn't give an error, but nothing saved in $setting->value Well its initialized like this:

        $setting = new Setting();
    $setting->value = ['key' => 'value'];
    $setting->save();

The solution I'm using now is this:

        $setting->value = collect($setting->value)->merge(['key' => 'new_value']);

This is in case I want to update.

Was wondering if there's something like this (JSON update):


    $setting->update(['value->key' => 'new_value']);

bitcoinboy started a new conversation Model Save Or Update Casts Object

I have an element casts to object:

//Inside a Model file:

    protected $casts = [
        'value' => 'object',
    ];

Ok now if I update it like this way it won't work:

$something = Something:first();
$something->value->any = 'any';
$something->save();

BTW I'm using laravel 5.5

14 Nov
2 years ago

bitcoinboy started a new conversation Anti Fraud System ??

Hello, Is there any system for anti-fraud, to protect my site from scammers, I want a system that detect new login from different location ..

18 Oct
2 years ago

bitcoinboy left a reply on Error Installing Laravel 5.3

Well that mean they're not installed so run:

sudo apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0

then restart Apache server:

sudo systemctl restart apache2

if it still missing please re-run:

sudo phpenmod mcrypt ...

17 Oct
2 years ago

bitcoinboy left a reply on Error Installing Laravel 5.3

You must enable mbstring and mbcrypt extension that you will need to install laravel

Simply run: sudo phpenmod mcrypt sudo phpenmod mbstring

for Windows check php/php.ini search for: ;extension=php_mbstring.dll (remove ;)

bitcoinboy left a reply on Load With Pagination

Maybe this is what you want


$user->load(['posts' => function ($query) use (&$posts) {
            $posts = $query->paginate();
        }]);

        dd($posts);

bitcoinboy left a reply on Load With Pagination

why not simple $user->posts()->paginate() ?

bitcoinboy left a reply on Select From Two Tables And Join Result On A Third Table

Hi this will be made easily using Eloquent relations:

create upvote, downvote models using Artisan:

php artisan make:model upvote php artisan make:model upvote

//Add this to app/User.php

    //User Upvotes relation
    public function upvotes()
    {
        return $this->hasMany(Upvote::class);
    }

   //User Downvotes relation
    public function downvotes()
    {
        return $this->hasMany(Upvote::class);
    }

//Add this to your script

        $user = User::with(['upvotes' => function($query){
            $query->where('upvotes.voteOn', 2);
            $query->orderBy('upvotes.created_at');
        }, 'downvotes' => function($query){
            $query->where('downvotes.voteOn', 2);
            $query->orderBy('downvotes.created_at');
        }])->orderBy('created_at')->get();

23 Jul
3 years ago

bitcoinboy left a reply on Data Lost On Www And Non-www

  • Should we add both domains in session_set_cookie_params ? Or Laravel do it dynamically ?
  • Should we redirect non-www to www in .htaccess ? Or Laravel do it dynamically ?

Thanks

bitcoinboy started a new conversation Data Lost On Www And Non-www

Hello, I'm using Laravel 5.1 the latest version and I discovered that the www. and non-www can caused session and Auth lost I tested this on two hosts one with SSL . So when I tried to login and change host from www to non-www I see that I'm not logged and while its on www logged . I tried to change request header but nothing happened .

Any Idea their ? Bitcoin Boy.

bitcoinboy started a new conversation Installing Laravel On Namecheap

Hello, I'm installing laravel on Namecheap , failed and got this : class not found Normalizer Anyone could help me please !

Bitcoin Boy.

22 Jul
4 years ago

bitcoinboy started a new conversation Change Environment Variable

Hello, I'm building an Administration board and I'm asking if there's a way to change environment variable outside the file .env ; I have an I idea but will be a lot complicated using replace and regex to modify directly .env file

Did you have a simple way ? Bitcoin Boy

15 Jul
4 years ago

bitcoinboy left a reply on Using '.blade' View Can't Show,thx!

Hi Laravel is made to create your apps easly and fast , So Its normal that the view class add automatically .php or .blade.php , Its just an option to facilitate and made it fast to create your views !

BItcoin Boy.

bitcoinboy left a reply on Check To See If I Can Connect To A Database

Hi thanks , Also please don't forget to define protected $fillable for rows that you allow to be modified in queries

Bitcoin Boy.

bitcoinboy left a reply on Check To See If I Can Connect To A Database

Hello @goatshark , Their's a simple way to do this : create your database config foreach database you want : mysql , mysql2 ,mysql3 ,,,, or what ever name you would like ,

E.g :

# Our primary database connection 'mysql' => array( 'driver' => 'mysql', 'host' => 'host1', 'database' => 'database1', 'username' => 'user1', 'password' => 'pass1' 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),
    # Our secondary database connection
    'mysql2' => array(
        'driver'    => 'mysql',
        'host'      => 'host2',
        'database'  => 'database2',
        'username'  => 'user2',
        'password'  => 'pass2'
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
    ),

then you have two ways to use your databases in a specified Model

1 - Creating a protected $connection in model class to define the db configuration that you want to use

class YourModelName extends Eloquent {

protected $connection = 'mysql2' # or what ever config you have;

}

2 - using setConnection method :

$YourModelName= new SomeModel;
    $YourModelName->setConnection('mysql2') # or what ever config you have;

3 - Simply using it in query builder :

$users = DB::connection('mysql2')->insert(Query);

Hope this help you !

Bitcoin Boy

14 Jul
4 years ago

bitcoinboy left a reply on Initialize My Classes If Auth

I think I solved this using :

    if (Auth::check()) {
        
    $Variable= new Myclass(user()->token);
    
    view()->share('Variable', $Variable); 
    
    }
    
    return $next($request);

bitcoinboy left a reply on Laravel 5.1 On Shared Hosting Not Working

Upload the full project (after running composer) , Then you can use PHPstorm to synchronize between your local work and remote work , that's how I do in my shared hosting, But a problem you may get in some shared hosting is that you can't create a virtual host to hide public path in url .

Bitcoin Boy.

bitcoinboy started a new conversation Initialize My Classes If Auth

Hello Everyone , I'm coding a middleware that initiate some classes when a user is logged in , But I the problem is that I want to ( compact or return view ) all specified controllers .

Any ideas ? Bitcoin Boy.

13 Jul
4 years ago

bitcoinboy started a new conversation What's The Best Way To Hide Public Path In Laravel

Hello , Since laracasts work on laravel so I'm asking them what's the method they used to hide the pulic path in the link : E.g : it should be laracasts.com/pulic/discuss .

there's a method to copy all into a folder and name it local but its not responsive .

I know this question is duplicated and @JeffreyWay already replied here : goo.gl/qeVH72 but I really didn't understand the way to do it :)

All respects, Bitcoin Boy