othmannl

Software Engineer at AMSTERDAM

Member Since 10 Months Ago

PURMEREND

Experience Points
1,340
Total
Experience

3,660 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 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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 1
1,340 XP
Jan
17
1 week ago
Activity icon

Replied to Calculate Average Of Waiting Time For All Orders Laravel

What if I want to get the average of waiting time only of yesterday?

Jan
13
1 week ago
Activity icon

Replied to Calculate Average Of Waiting Time For All Orders Laravel

Can you explain what the selectRaw does and why I can't use select for example and why you did ->first() ?

Activity icon

Started a new Conversation Calculate Average Of Waiting Time For All Orders Laravel

I want to calculate the average of waiting time for all the order in de db.

To calculate waiting time i use this calculation

$order->updated_at->diffInMinutes($order->created_at)

But now i want to calculate this for all the orders together and divide it by the amount of orders in db

Jan
10
2 weeks ago
Activity icon

Replied to Opening-hours Not Working Properly Laravel

Calculation works great with my current settings, but the problem is after closing and before 23:59 the code isnt working properly, because he doesnt know the opening hour of the next day so I dont know where to mention that

Activity icon

Started a new Conversation Opening-hours Not Working Properly Laravel

Hi, I want to close my website outside openinghours of the store, but i want to show on the error the opening hours of the next day, but it's showing that we will open in 0 minutes

public function create()
    {
        $currentOpeningTime = OpeningTimes::where('day', today()->dayOfWeekIso)->firstOrFail();
        $openingTime = Carbon::createFromFormat(
            'H:i:s',
            $currentOpeningTime->opening
        );
        $closingTime = Carbon::createFromFormat(
            'H:i:s',
            $currentOpeningTime->closing
        );

        $minutesUntilOpening = now()->minutesUntil($openingTime)->ceilMinute()->count();

        $isStoreOpen = now()->isBetween($openingTime, $closingTime);
        $isStoreClosed = now()->isBetween($closingTime, $openingTime->addDay());

        if ($isStoreClosed && $minutesUntilOpening < 60) {
            abort(401, "We are closed, we will open in " . $minutesUntilOpening . " minutes");
        } else if ($isStoreClosed) {
            abort(401, "We are closed now, we will open at " . $openingTime->hour . ":" . $openingTime->format('i'));
        }

I think maybe it's because it's not getting the day after, because after 00:00 i get the correct text

Activity icon

Replied to 502 Bad Gateway Laravel Nginx

Log is empty from that error

Jan
08
2 weeks ago
Activity icon

Started a new Conversation 502 Bad Gateway Laravel Nginx

I've made an webapplication, and a page called window only screen that should refresh every 30 seconds. But after a few moments i see 502 Bad Gateway

Activity icon

Started a new Conversation Validation Error Not Working Laravel

I've made a request like this

/**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'ordernumber' => ['required', 'string', 'regex:/(^DV90[0-9]{8}$)|(^RA90[0-9]{8}$)|(^Ra90[0-9]{8}$)|(^Dv90[0-9]{8}$)|(^3[0-9]{7}$)/', 'unique:orders,ordernumber'],
            'email' => 'required|email|max:200',
            'numberplate' => 'required',
            ],
        [
            'numberplate.required' => 'Parkeervaknummer is vereist',
        ];

    }

And numberplate.required should have a special message, but it's not working

I get this error

syntax error, unexpected token ",", expecting ";"

Jan
07
2 weeks ago
Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

This is the error i get after importing @fortawesome

Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
   ╷
16 │ @import "[email protected]";
   │         ^^^^^^^^^^^^^^^
   ╵
  C:\xampp\htdocs\renazaandam\resources\sass\app.scss 16:9  root stylesheet
Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

Yeah both, because fon't awesome is not working, and the url is made correctly maybe becaus eof Laravel 8 should it be different I think

Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

Should I sen the file?

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "axios": "^0.21",
        "bootstrap": "^4.0.0",
        "jquery": "^3.2",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "popper.js": "^1.12",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.20.1",
        "sass-loader": "^8.0.0",
        "vue": "^2.5.17",
        "vue-loader": "^15.9.5",
        "vue-template-compiler": "^2.6.10"
    },
    "dependencies": {
        "@fortawesome/fontawesome-free": "^5.15.1",
        "font-awesome": "^4.7.0"
    }
}
Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

Added it, no errors, but now is my css not working properly, like background image is gone

Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

Can't update

$ npm install -g n
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for [email protected]: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Othman Boulal\AppData\Roaming\npm-cache\_logs21-01-07T15_37_12_531Z-debug.log
Activity icon

Replied to NPM RUN DEV DOESN'T WORK PROPERLY

My Imports

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
@font-face {
    font-family: 'Hornbach';
    src: url('fonts/BadhouseBold.ttf') format('truetype'),
    url('../../fonts/BadhouseBold.woff') format('woff');
}

// Variables
@import 'variables';

// Bootstrap
@import '~bootstrap/scss/bootstrap';

////Fontawesome
@import '[email protected]/fontawesome-free/scss/brands';
@import '[email protected]/fontawesome-free/scss/regular';
@import '[email protected]/fontawesome-free/scss/solid';
@import '[email protected]/fontawesome-free/scss/fontawesome';

//Custom 
@import "custom";

Activity icon

Started a new Conversation NPM RUN DEV DOESN'T WORK PROPERLY

I've installed fontawesome with npm install

and when i npm run dev, i get this error

ERROR in ./resources/sass/app.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '../../fonts/BadhouseBold.woff' in 'C:\xampp\htdocs\renazaandam\resources\sass'

And Also my custom font works properly but I still get the Error

Activity icon

Replied to Can't See Message Sent From Controller Laravel

I changed return viewby return redirect and it works good

Activity icon

Replied to Can't See Message Sent From Controller Laravel

So what should i do?

Activity icon

Started a new Conversation Can't See Message Sent From Controller Laravel

When I submit a page, I send a message with confirmation but I can't see it\

This is my Controller

return view('order.create')->with('message', 'Bedankt! Uw bestelling wordt z.s.m. naar uw auto gebracht.
        De gemiddelde wachttijd is 10 minuten.');

And this is my html code

 @if(session('message'))
                        <div class="alert alert-success" role="alert">
                            {{session('message')}}
                        </div>
                    @endif

Thanks already

Activity icon

Replied to Auto Reload Page Every 30 Second

I want only to do it for one page, if i do it on the blade i extend alway, it will refresh all pages so can i do it in the html in stead of the ?

Activity icon

Started a new Conversation Calculate Difference In Minutes Between Created_at And Current Time In Laravel

I want to show in a field the time someone is waiting, and I want to do that by subtracting created_at time by current time in minutes

this is my table

                                <thead>
                                <tr>
                                    <th scope="col">Ordernummer</th>
                                    <th scope="col">E-mail</th>
                                    <th scope="col">Kenteken</th>
                                    <th scope="col">Wachttijd</th>
                                    <th scope="col">Status</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($orders as $order)
                                    <tr>
                                        <th scope="row">{{ $order->ordernumber }}</th>
                                        <td scope="row">{{ $order->email }}</td>
                                        <th scope="row">{{ $order->numberplate }}</th>
                                        <td scope="row">{{ $order->created_at }}</td>
                                        <td scope="row">
                                            @if( $order->status == 0)
                                                Open
                                            @else
                                                Afgehandeld
                                            @endif
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>

And where this is written <td scope="row">{{ $order->created_at }}</td> I want to show there the difference in minutes.

Thanks already

Activity icon

Started a new Conversation Auto Reload Page Every 30 Second

Hello, I have a web application that shows Registered reservations, but it will shown on a screen that no one uses, so it has to refresh every time by itself, how can I add that in the code?

Dec
06
1 month ago
Activity icon

Replied to Error: Attempt To Read Property "articlenumber" On Bool

I send an e-mail only when I submit the last article, i have multiple submit buttons on the view. What I've wanted to do is after i submit the last article, i want to send the whole order in the mail. So, should I create another controller for it? Or something else, can you show me a small example how it should be done. Thank you very much in advance

Activity icon

Replied to Error: Attempt To Read Property "articlenumber" On Bool

Because the client wants all articles in the mail so that he does not have to open the site all the time. And can work easy from the email.

Activity icon

Replied to Error: Attempt To Read Property "articlenumber" On Bool

Can you show me how it works, to show the order on the web i did this

Controller

public
    function show($id)
    {
        $order = Returnorder::findOrFail($id);
        $articles = Returnarticle::all()->where('order_id', '=', $order->id);

        return view('retour.show', [
            'order' => $order,
            'articles' => $articles,       
        ]);
    }

View

				<tr>
                                <th>Contactperson</th>
                                <td>{{$order->contactperson}}</td>
                            </tr>
				@foreach($articles as $article)
                                <tr>
                                    <th scope="row">{{ $article->articlenumber }}</th>
                                    <td>
                                        {{ $article->return_quantity }}
                                    </td>
                                    <td>
                                        @if($article->return_quality == 1)
                                            Verkoopbaar
                                        @elseif($article->return_quality == 2)
                                            Niet verkoopbaar
                                        @endif
                                    </td>
                                </tr>
                            @endforeach

But this layout doesnt work in the mail

Activity icon

Replied to Error: Attempt To Read Property "articlenumber" On Bool

I did that, and once i receive the mail, I see just one article and not all the three I've submitted

Activity icon

Started a new Conversation Error: Attempt To Read Property "articlenumber" On Bool

I want to mail a form after I submit it, but the data I send contains information from two tables who are related with foreign key. It's an order that contains order information and then products of that order from the other table, but once I want to submit i get this error.

This is my Controller

 public function store(Request $request)
    {
        $retourorder = new Returnorder();

        $retourorder->firmaname = request('firmaname');
        $retourorder->contactperson = request('contactperson');
        $retourorder->email = request('email');
        $retourorder->ordernumber = request('ordernumber');
        $retourorder->hbnumber = request('hbnumber');
        $retourorder->customername = request('customername');

        $retourorder->save();

        $admin = \request()->get('admin');

        return view('retour.create_articles', ['retourOrder' => $retourorder->id, 'admin' => $admin]);

    }

    /**
     * Store a newly created resource in storage.
     *
     * @param \Illuminate\Http\Request $request
     * @return \Illuminate\Http\Response
     */
    public function store_articles(Request $request)
    {

        if ($request->hasFile('image')) {
            $filenameWithExt = $request->file('image')->getClientOriginalExtension();
            $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
            $extension = $request->file('image')->getClientOriginalExtension();
            $fileNameToStore = $filename . '_' . time() . '.' . $extension;
            $request->file('image')->move('storage/images', $fileNameToStore);

        } else {
            $fileNameToStore = 'noimage.jpg';
        }

        $retourartikel = new Returnarticle();

        $retourartikel->order_id = request('order_id');
        $retourartikel->articlenumber = request('articlenumber');
        $retourartikel->return_quantity = request('return_quantity');
        $retourartikel->return_quality = request('return_quality');
        $retourartikel->return_reason = request('return_reason');
        $retourartikel->images = $fileNameToStore;

        $retourartikel->save();

        $admin = \request()->get('admin');

        if ($request->submit === 'submit') {
            Mail::to('[email protected]')->send(new Retourmail($retourartikel));
            //Mail::to(\request('email'))->send(new Retourmail($retourartikel));
            return redirect('/retour')->with('message', 'Je retourmelding is succesvol verzonden');
        }
}

First I Store the Order, and then I add products to it, so it works with two orders.

And my Mail looks like this

public function __construct(Returnarticle $returnarticle)
    {
        $this->returnarticle = $returnarticle;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->view('mail.retourmail')->with(['retour' => $this->returnarticle]);
    }
}

And in my Mail layout I try just one line to check if it's working

@foreach($retour as $retourtje)
                <p>{{$retourtje->articlenumber}}</p>
                @endforeach

So Please help me, if you need more information tell me

Oct
27
2 months ago
Activity icon

Replied to CREATE DATABASE WITH FOREIGN KEYS

Can I talk to you in private?

Oct
24
3 months ago
Activity icon

Started a new Conversation CREATE DATABASE WITH FOREIGN KEYS

Hello,

I don't know if I can ask this question here, but I've made a database where I can submit forms and store it in the database, but now I've got some problems.

The database contains and order, and that order should contain multiple products with information of each product. What I've created now is one table, and i can put only one product per order because they are in the same table, but what I want, is create two tables, and first create an order, and then add products to that order on another table. I tried to do it with the documentation of Laravel, but it's a little bit hard.

Can someone help me step by step, I would really appreciate that.

Oct
11
3 months ago
Activity icon

Started a new Conversation CANNOT UPLOAD FILE LARAVEL

I want to upload a file in an edit page with this code

This is the HTML

<input id="attachment" type="file"
                               class="form-control @error('attachment') is-invalid @enderror"
                               name="attachment" value="{{ old('attachment') }}" required
                               autocomplete="attachment" autofocus>

And in the controller this

 if ($request->hasFile('attachment')) {
            $filenameWithExt = $request->file('attachment')->getClientOriginalExtension();
            $filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
            $extension = $request->file('attachment')->getClientOriginalExtension();
            $fileNameToStore = $filename . '_' . time() . '.' . $extension;
            $request->file('attachment')->storeAs('storage/files', $fileNameToStore);

        } else {
            $fileNameToStore = 'No File';
        }

BUt when I submit the page, it stores with No File, so I cannot upload and if I Dump and Die the request is see the filename. Help me