jamalali

jamalali

Member Since 1 Year Ago

Experience Points 400
Experience Level 1

4,600 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-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.

16 Aug
1 month ago

jamalali left a reply on Hosting A Laravel, Lumen API, Vue.js System

@jlrdw Thanks for that info. Yes, I've not even started on the front-end yet. I've been working on the admin system, which is a Laravel installation. Parts of the admin system consumes the api, which is a seperate Lumen installation.

Which hosting provider can you recommend? Yes, I don't have the knowledge to set something up myself and at the monent I don't have the time to learn how to do it. So a dedicated server company is the way I'll go with this for now.

15 Aug
1 month ago

jamalali started a new conversation Hosting A Laravel, Lumen API, Vue.js System

I am currently developing a web-based business system for a small manufacturing company. The system will be a public facing website, a password protected admin website and an api. Here is a link to an low-level diagram to explain the propsed system:

https://tinyurl.com/y5mctyos

My question is regarding hosting. What is the best hosting solution? Which hosting providers are capable of handling up-scale?

My idea is to have the front-end website, the api and the back-end admin website all on their own ip address. The back-end will be doing a lot of heavy work like sending out emails and watching for live changes to orders and I want the api to be as quick as possible so I want that well away from the back-end server. The front-end I'm thinking will just be front-end code without any server-side scripting.

Is this the best way to set this up? Feel free to suggest an alternative model, I'm all ears.

03 Jul
2 months ago

jamalali left a reply on Conditional Parameter In Route Helper

@JENKY -

<a href="{{ route('orders.index', array_filter(['type' => $order_type_filter_id])) }}">
    Orders
</a>
                    

Nice!

02 Jul
2 months ago

jamalali left a reply on Conditional Parameter In Route Helper

The "orders" route is a resource route:

Route::resource('orders', 'Orders\OrdersController')

Is there a way of adding an optional parameter on the index method?

jamalali started a new conversation Conditional Parameter In Route Helper

<a href="{{ route('orders.index', ['type' => $order_type_filter_id]) }}">
    Orders
</a>

I have this route in which I add a parameter i.e. "type" so for example "/orders?type=1" This is working fine. However when $order_type_filter_id is null the generated url is "/orders?"

How can I conditionally add the "type" paramter when generating the url via the route helper?

10 Sep
1 year ago

jamalali left a reply on User Authentication Custom Middleware

Great thread this is!

1 question though. How would you check for isAdmin, isOwner, isMember in a blade template?

07 Sep
1 year ago

jamalali left a reply on Laravel, JQuery, Bootstrap, Laraval-Mix

@36864 scripts are loading in their respective slots

jamalali started a new conversation Laravel, JQuery, Bootstrap, Laraval-Mix

This is driving me crazy!

I'm in the process of building a website and I've got a some of couple of stacks.

/layouts/app.blade.php:

<html>
    <head>
        @stack('scripts')
    </head>

    <body>
        <div id="app">
            @include('components.header')
            <main id="main">
                @yield('content')
            </main>
            @include('components.footer')
        </div>
        
         <!-- Scripts -->
        <script src="{{ asset('js/manifest.js') }}"></script>
        <script src="{{ asset('js/vendor.js') }}"></script>
        <script src="{{ asset('js/app.js') }}"></script>
        @stack('footer_scripts')
    </body>
    
</html>

/home/index.blade.php:

@extends('layouts.app')

@section('content')
<h1>
    Hello World!
</h1>
@endsection

@push('scripts')
    // template specific scripts (e.g. <script src="https://pi-test.sagepay.com/api/v1/js/sagepay.js"></script>)
@endpush

@push('footer_scripts')
<script>
$(document).ready(function() {
    alert('document is now ready!');
});
</script>
@endpush

webpack.mix.js:

let mix = require('laravel-mix');

mix.js('resources/assets/js/app.js', 'public/js')
        .extract(['jquery', 'popper.js', 'bootstrap'])
        .sass('resources/assets/sass/app.scss', 'public/css');

In my console I'm getting TypeError: $ is not a function

What am I doing wrong?

jamalali left a reply on Running Mix For Multiple Javascript Files

@timo.heil Have you found a solution for this? (i.e to extract admin and frontend libraries to different vendor files)

05 Sep
1 year ago

jamalali left a reply on Common Methods For All Routes

@Sergiu17 Thanks for your reply. I just discovered View Composers. They're my new favourite thing!

jamalali started a new conversation Common Methods For All Routes

What is the best practise to have common processes that take place on each request. For example I need to build a list of links from the database which will display on the whole website. And in future I'll be building a CMS.

What I have done so far in /app/http/controllers/controller.php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;

class Controller extends BaseController {
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
    
    public function __construct(Request $request) {
        // Do stuff
    }
}

Another question arises. How would any variables be passed to the view without specifying the name of the view template?

09 Aug
1 year ago

jamalali left a reply on Creating Routes Dynamically

@cmdobueno Thanks a lot dude! I'll give it a go and get back to you.

jamalali left a reply on Creating Routes Dynamically

@cmdobueno I am aware of the problems you are pointing out hence why I thought dynamically creating each category route like in my original question.

Another thought was to create groups. E.g.:

foreach ($categories as $category) {
    
    Route::prefix($category->slug)->group(function() {
        
        Route::get('', '[email protected]');
        
        if ($category->hasChildren) {
            
            foreach($category->children as $childCategory) {
                
                Route::prefix($childCategory->slug)->group(function() {
                    
                    Route::get('', '[email protected]');
                    
                });
            }
        }
    });
}

If I did do it like the above, with the nested groups, how would I inject the category?

08 Aug
1 year ago

jamalali left a reply on Creating Routes Dynamically

@cmdobueno Ok, I'll try that. Thank you!

Would routes to a product page come before or after?

Route::get('{category_slug}/{child_category_slug?}/{product_slug}','[email protected]');

jamalali started a new conversation Creating Routes Dynamically

Is it OK (or even possible) to create routes from a database table like in the code below. Almost like a catch-all for category index pages, while also passing in the category name/id as a paramater.

routes/web.php

$categories = App\Categories::all();

foreach($categories as $category) {
    
    Route::get($category->slug, '[email protected]');
    
    if ($category->hasChildren) {
            
        foreach($category->children as $childCategory) {

            Route::get($category->slug . '/' . $childCategory->slug, '[email protected]');
        }
    }
}

I'm re-building a website and want to keep the same url structure.

There are about 20 top level categories at the moment. Is it good practice to even create routes like this?