Ashraam

Ashraam

Web Developper at Ajaccio

Member Since 4 Years Ago

Ajaccio

Experience Points
106,460
Total
Experience

3,540 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
906
Lessons
Completed
Best Reply Awards
17
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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 22
106,460 XP
Sep
17
1 week ago
Activity icon

Replied to Upgrade To Laravel 8 Problem With Scout

Oh ok thanks, didn't see the pull request !

Activity icon

Started a new Conversation Upgrade To Laravel 8 Problem With Scout

Hi everyone,

I had a laravel 6 installation (using scout and algolia extended), i've upgraded to 7.x without any problems.

Now when I want to upgrade to laravel 8.x, i'm following the guide and when I do composer update I've got this:

Problem 1
    - Installation request for laravel/framework ^8.0 -> satisfiable by laravel/framework[8.x-dev, v8.0.0, v8.0.1, v8.0.2, v8.0.3, v8.0.4, v8.1.0, v8.2.0, v8.3.0, v8.4.0].
    - Conclusion: remove algolia/scout-extended v1.9.0
    - Conclusion: don't install algolia/scout-extended v1.9.0
    - Can only install one of: laravel/scout[8.x-dev, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.0.0, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.0.1, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.1.0, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.2.0, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.2.1, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.3.0, 7.0.x-dev].
    - Can only install one of: laravel/scout[v8.3.1, 7.0.x-dev].
    - Can only install one of: laravel/scout[7.0.x-dev, v8.3.1].
    - algolia/scout-extended v1.8.0 requires laravel/scout ^6.1.1|^7.0 -> satisfiable by laravel/scout[7.0.x-dev].
    - Installation request for algolia/scout-extended ^1.8 -> satisfiable by algolia/scout-extended[v1.8.0, v1.9.0].
    - Installation request for laravel/scout ^8.0 -> satisfiable by laravel/scout[8.x-dev, v8.0.0, v8.0.1, v8.1.0, v8.2.0, v8.2.1, v8.3.0, v8.3.1].

I'm lost, what should I do ?

Sep
14
1 week ago
Activity icon

Awarded Best Reply on AlpineJS And Laravel Mix

Ok thank you everyone for helping but I've found out...

The fat arrows function where the problem, I used normal function and the scope was working.

Activity icon

Replied to AlpineJS And Laravel Mix

Ok thank you everyone for helping but I've found out...

The fat arrows function where the problem, I used normal function and the scope was working.

Sep
11
2 weeks ago
Activity icon

Replied to AlpineJS And Laravel Mix

@chack1172 Tried it and I've got the same exact errors

Activity icon

Replied to AlpineJS And Laravel Mix

@sinnbeck Not sure how to do that, I've created a .babelrc file and add this:

{
    "plugins": [
        "@babel/plugin-transform-strict-mode"
    ]
}

still got the same exact error

Activity icon

Replied to AlpineJS And Laravel Mix

@sinnbeck I digged into the js file ouputed by Laravel mix and here is the function... this is prefixed with _

this must be the problem here but don't know how to solve it

/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var alpinejs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! alpinejs */ "./node_modules/alpinejs/dist/alpine.js");
/* harmony import */ var alpinejs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(alpinejs__WEBPACK_IMPORTED_MODULE_0__);
__webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");



window.productTaxesCalculator = function () {
  var _this = this;

  return {
    ht: 0,
    tva: 0,
    ttc: '',
    calculate: function calculate() {
      _this.ttc = (_this.ht + _this.ht * (_this.tva / 100)).toFixed(2);
    },
    init: function init(ht, tva) {
      _this.ht = parseFloat(ht);
      _this.tva = parseFloat(tva);

      _this.calculate();
    }
  };
};

/***/ }),
Activity icon

Replied to AlpineJS And Laravel Mix

@sinnbeck Sorry, yes exact same mistake and console.log(e) returns undefined

Activity icon

Replied to AlpineJS And Laravel Mix

@sinnbeck No it's not working :/

and btw console.log(e) return undefined

Activity icon

Started a new Conversation AlpineJS And Laravel Mix

Hi everyone,

I've got some trouble using alpine JS and Laravel Mix, and someone here will probably help me to understand and fix this

I'm using AlpineJS in my view like this:

<div x-data="productTaxesCalcultator()" x-init="init(X, Y)">
........
</div>

When I create the script tag in the same page, it's perfectly working

function productTaxesCalcultator() {
    return {
        ht: 0,
        tva: 0,
        ttc: '',
        calculate: function() {
            this.ttc = (this.ht + (this.ht * (this.tva / 100))).toFixed(2);
        },
        init(ht, tva) {
            this.ht = parseFloat(ht);
            this.tva = parseFloat(tva);

            this.calculate();
        }
    }
}

But when I try to add this function inside my app.js (using laravel mix), I've got some weird errors.. Example: app.js:19980 Uncaught TypeError: Cannot set property 'ht' of undefined

The problem seems to be the "this" scope I guess

Here is what's look like my app.js

require('./bootstrap');

import 'alpinejs';

window.productTaxesCalculator = () => {
    return {
        ht: 0,
        tva: 0,
        ttc: '',
        calculate: () => {
            this.ttc = (this.ht + (this.ht * (this.tva / 100))).toFixed(2);
        },
        init: (ht, tva) => {
            this.ht = parseFloat(ht);
            this.tva = parseFloat(tva);

            this.calculate();
        }
    }
}

What did I miss ? How can I fix that problem ?

Thanks

May
20
4 months ago
Activity icon

Commented on Techniques For Testing Against A Real API

Don't know why but I can't create a Best Buy account... anyone has this problem (I'm in France)

Activity icon

Awarded Best Reply on Link From Alert To Table

You could do some trick with html anchor, highlight the row using css and and query parameter (?licenceId=X) or just maybe just return the licence (sql query)

May
07
4 months ago
Activity icon

Commented on Programming Katas Explained

Because he is a kata master !

Activity icon

Commented on Programming Katas Explained

The animation is neat !

May
05
4 months ago
Activity icon

Commented on Rapid Code Generation With Blueprint

This is just CRAZY stuff

Apr
14
5 months ago
Activity icon

Replied to Interface In Laravel:

I think it being case-sensitive related problem.

I don't think PHP namespaces are case-sensitive, but when being autoloaded by composer or resolved from the Laravel container they are, due to the fact that the names are stored in arrays that have case-sensitive strings as the key.

Apr
09
5 months ago
Activity icon

Replied to Product Filter Query Return Me 500 Why.

$filterValues = array();
parse_str($request->formData, $filterValues);

$products = Product::where(function($query) use(filterValues) {

	$free = isset( $filterValues['free'] ) ? 'yes' : null;
	if(isset($free) ){
             $query->orwhere('price','<=','0');
        }
            
})->get();

echo json_encode($products);

Add the use word in the function if you want to use a variable outside the function

Activity icon

Replied to Delete Post Image

You should take a look to model observer ( https://laravel.com/docs/7.x/eloquent#observers )

The idea woud be

You create an observer for your post model and in the deleting method you could do something like

function deleting(Post $post) {
   foreach($post->photos as $photo) {
      unlink($photo->path);
      $photo->delete();
   }
}

this is just a silly example you could improve this a tons

Activity icon

Replied to How To Calculate No_of_days Between To Datepickers

In JS you can calculate days between two dates like this:

function days() {
    var a = $("#datepicker_start").datepicker('getDate').getTime(),
        b = $("#datepicker_end").datepicker('getDate').getTime(),
        c = 24*60*60*1000,
        diffDays = Math.round(Math.abs((a - b)/(c)));
    console.log(diffDays); //show difference
}

Now you just have to implement a "onChange" event with your date picker (you should find this on the doc)

Activity icon

Replied to How To Correclty Categories A Nested Relationship?

so use the group by method on the collection ? https://laravel.com/docs/7.x/collections#method-groupby

Or change the problem,

Get the games with theirs groups and results and then group by group

Activity icon

Replied to Problem With Joining Queries And Displaying Data In Blade In Laravel

what about dd($interest) and look all the data

Activity icon

Replied to Web Application Servers Infrastructure And Configuration (to Display And Stream Media With Laravel & Nginx)

I can't respond to all your questions but

  • Display file in FTP, check the Storage facade you can configure a FTP
  • It is a suitable solution ? Well I think infrastructure depends a lot on the traffic ! so can you estimate this ?
Activity icon

Replied to How To Correclty Categories A Nested Relationship?

Group::with('games', 'games.results')->find($groupId);

no ?

Activity icon

Replied to Auto-detect Relationships

Oh ok I see what you want to achieve here, and I don't think there anything to handle this out of the box.

You should pass the relationships you know to load to the controller "manually"

Activity icon

Replied to Stop Adding Poor Quality Laravel Addons

As a laravel champion you should help them to make those packages production ready then !

Apr
08
5 months ago
Activity icon

Awarded Best Reply on Mysql SHOW VARIABLES - Forge

// In the terminal
> mysql -u forge -p

// When logged into mysql
> SHOW VARIABLES
Activity icon

Replied to Mysql SHOW VARIABLES - Forge

// In the terminal
> mysql -u forge -p

// When logged into mysql
> SHOW VARIABLES
Activity icon

Replied to How To Do Laravel Relationship With Foregin Key And Self Relation

If you have done your relationship well you could query things like this

Country::whereHas('[relationship name]', function($q) {
   $q->where('type_of_tour', 'single');
})->get();
Activity icon

Replied to Auto-detect Relationships

You can add

$person = Person::with('pets')->find($request->id);

// OR

$person->load('pets'); //after the save method

// If a person should always has pets eager loaded then you could add this the the person model

$with = ['pets'];
Activity icon

Replied to Problem With Joining Queries And Displaying Data In Blade In Laravel

Why don't you use Eloquent ?

In this case you could have something like this

$user = User::with('interests')->find($userId);

foreach($user->interests as $interest) {
	dd($interest->field->name, $interest->value->label);
}

To achieve this you should create a model UserInterest (pointing to the user_interests table) and add the field and value relationship like this (the $with attribute will eager load relationship each time you access the model)

Class UserInterest extends Model {
   protected $with = ['field', 'value'];

   function value() {
      return $this->belonsgTo(Value::class);
   }

   function field() {
      return $this->belongsTo(Field::class);
   }
}

and then add the interest method to the User model

function interests() {
   return $this->hasMany(UserInterest::class);
}

It's hard to do it without coding it but it should be working somehow

Apr
06
5 months ago
Activity icon

Replied to Slick Carousel- How To Add Three Dots Below The Images?

@nickywan123 I think you have to choose a "best answer"

Activity icon

Replied to Laravel API: Request Is Not Finished Yet

that's weird, don't know where the problem could be sorry :/ Sounds like a Nginx problem imo

Apr
03
5 months ago
Activity icon

Awarded Best Reply on I Get Call To A Member Function IsValid() On Boolean

it's $request->file('admin_image')->isValid() and not $request->hasFile('admin_image')->isValid()

$request->hasFile('admin_image') returns a boolean so it's not an object

Activity icon

Replied to On Any Form Submission It Gives. "The Page Is Expired Due To Inactivity. Please Refresh And Try Again"

this should be like this:

<form method="post" action="[url]">
   @csrf
   // form inputs
</form>
Activity icon

Replied to Add Created By & Updated By To Data

You you use the model observers (https://laravel.com/docs/7.x/eloquent#observers )

or you can add a boot method inside your model like this:

protected static function boot()
{
  parent::boot();
  
  static::created(function($model) {
    $model->created_by = auth()->id();
  });

  static::updated(function($model) {
   $model->updated_by = auth()->id();
  });
}
Activity icon

Replied to I Get Call To A Member Function IsValid() On Boolean

it's $request->file('admin_image')->isValid() and not $request->hasFile('admin_image')->isValid()

$request->hasFile('admin_image') returns a boolean so it's not an object

Activity icon

Awarded Best Reply on Query Fetches Only 2 Records

I don't see any particular problem here..

if you dd($fff) you only have 2 rows ? Then it comes from the data in the DB :/

Anyway you should use Eloquent model instead of DB class, more readable and easiest to use if you have relationship etc

Activity icon

Awarded Best Reply on Problem With Retrieving Models Data

you are using soft deletes, in the database the deleted_at field is null right ? Maybe try without the SoftDeletes trait first

Because I'm not sure soft deletes are taken in consideration while using DB facade

Activity icon

Replied to Problem With Retrieving Models Data

you are using soft deletes, in the database the deleted_at field is null right ? Maybe try without the SoftDeletes trait first

Because I'm not sure soft deletes are taken in consideration while using DB facade

Activity icon

Replied to Link From Alert To Table

You could do some trick with html anchor, highlight the row using css and and query parameter (?licenceId=X) or just maybe just return the licence (sql query)

Activity icon

Replied to WithCount Return Null Within A Notification When Implements ShouldQueue

When you dd(Thread::take(6)->withCount('replies')->get()) with tinker you get the replies_count ?

Did you restart the queue after updating the code ?

Activity icon

Replied to Problem With Retrieving Models Data

Can you copy the Categorie Model code,

oh and you could inline your return statement like this:

$categories = Categories::all() //I'd use get if I were you

return view('news.create', compact('categories'));
Activity icon

Replied to Str_replace || ! Str_replace ?

it's ok, you could inline it like this

$parameters['body'] = str_replace(['<pre>', '</pre>'], ['<pre><code>', '</code></pre>'], $parameters['body']);
Activity icon

Replied to Slick Carousel- How To Add Three Dots Below The Images?

ok then mark the thread as completed !

Activity icon

Commented on Deferred Loading And Caching Server-Fetched Partials

This github package is magnificent !

Activity icon

Replied to Query Fetches Only 2 Records

You have to select fbId field too !

Activity icon

Replied to Thumbnails, Create Or Generate ?

Looks at this package, very good solution to create / resize / fit images (working with GD or Imagick): http://image.intervention.io/

Activity icon

Replied to On Any Form Submission It Gives. "The Page Is Expired Due To Inactivity. Please Refresh And Try Again"

Can you show us the form at least ?

Did you add the csrf token in the form (@csrf)