Nael.Saeed

Nael.Saeed

Member Since 2 Years Ago

Experience Points 7,620
Experience Level 2

2,380 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 54
Lessons
Completed
Best Reply Awards 1
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.

09 Sep
1 week ago

Nael.Saeed started a new conversation Url Icon, Title, Description And Feeds Link Fetching

Hi quys, I have been stuck for a while trying to achieve this: I want that when one of my users add a link to his favorites in the website then I want to fetch icon, description, title, and any RSS feeds (rss + atom .. ) exist in that url and save them in my database.

I used to use SimplePie for locating and fetching feeds, but with SimplePie I could not split the work the way I want.

Any advice?

15 Jul
2 months ago

Nael.Saeed left a reply on Form Request Validation For JSON Parameter

@robstar I am not getting this. how would the custom validation rule do the job? If the data its validating is always converted to an array before it is handled by the custom rule? even if the original data sent with the request is in JSON format?

Nael.Saeed left a reply on Form Request Validation For JSON Parameter

@robstar You're still not getting my problem. I am using the JSON validation rule. but the problem is that form request is converting the request data into array instead of JSON including the json_data parameter. Thus a non JSON validation error is returned for the parameter json_data even though it is a valid JSON.

Nael.Saeed left a reply on Form Request Validation For JSON Parameter

@nakov I have updated the question with code

@robstar How would that solve the problem of json data being converted to array before applying the validation rule?

Nael.Saeed started a new conversation Form Request Validation For JSON Parameter

Hi there,

I have an AJAX request sent to my API. This request has a parameter that should contain a JSON formatted data. I want to validate that it is actually JSON. Laravel form request has a 'json' validation rule, but the problem I am facing is that the parameter that I want to validate for JSON gets converted into an array before validation. So how am I supposed to prevent this conversion and do the validation?

Example request data:


{
    "id": 1,
    "name": "John",
    "json_data": {
        "data1": [

        ],
        "data2": [

        ]
    }
}


validation:

/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{

    return [
        'id' => [
            'required'  
        ],
        'title' => [
            'required',
            'string',
        ],
        'json_data' => [
            'required',
            'json',
        ],
    ];
}
14 Jun
3 months ago

Nael.Saeed started a new conversation Redirect To A Sub Folder In Public

Hi everyone, I am facing a weird problem that I've been trying to solve for more than a week by now. I have a Laravel project acting as an API, where there is a folder "dashboard" in the public folder holds inside a REACT project that talk to the API to achieve the work. I need that when user is not logged in I display a page with register and login link. Once user logged in I do a redirect to example.com/dashboard so the react index.html file take the lead. The problem I face is this i use a port for the domain example.com:8855 when user login I redirect to example.com/8855/dashboard but what happens (as chrome inspects shows), that a first 302 redirect is done to example:8855/dashboard then another 301 redirect happens to example.com/dashboard where port is removed.

After so many tests I found that this problem happens only when redirecting to a url where there is a folder with the same name in public folder, ex: example.com:8855/dashboard, example.com:8855/css, example.com:8855/js ...etc

Did any one of you faced such a problem? I am using NGINX server

thanks

10 Apr
5 months ago

Nael.Saeed started a new conversation OrderBy A Relationship Column Of A Relationship

Hi guys, I am facing a problem in here. I have 3 tables posts, threads and comments. a thread contain comments and is attached to a post. So, there is a relation between post and threads and a relation between threads and comments. What I need is to sort posts by the latest where if a post has a thread that contains comments then use the comment created_at else if post has no thread attached then use post created at. so I kind of need order by if exists thread.comments.created_at else post.created_at

is this possible?

09 Jun
1 year ago

Nael.Saeed left a reply on AuthenticateSession Middleware

Hi, I know this is a late reply but I just happened to pass by and wanted to share this and see what you think about it

I tried to move these lines

\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,

from $middlewareGroups => $middleware in App/Http/kernal.php

and auth()->user() worked fine in the constructor. Is there any down side for moving these lines as stated above?

30 May
1 year ago

Nael.Saeed left a reply on A Default Localization Lang File Doesn't Work

hi,

you have to make the call using the file name:

<label for="fname">{{ __('moo.fname') }}</label>

Nael.Saeed left a reply on A Better Way For Attaching And Detaching Pivot Items

I am not sure if there is a better way for creating mass tags at once but I think that you could reduce a bit of sql statements by doing this:

public function update(Article $article, ArticleRequest $request)
    {
        try {
            $article->name = $request->get('name');
            $article->text = $request->get('text');
            $article->save();

            //$article->tags()->detach(); //remove this for that we will be using sync() instead 

            $tags_ids = []; //create an empty array to hold the ids of the tags

            foreach ($request->get('tags') as $item => $value) {
                $tag = Tag::firstOrCreate(['name' => $value]);
                array_push($tags_ids, $tag->id); //add the id to the array 

                //sync removes the attached ids that are not mentioned in the array
                //and attach all newly mentioned ids
                $article->tags()->sync($tags_ids); 
            }

            flash(trans('messages.success'), 'success');
        } catch (\Exception $e) {
            flash(trans('messages.exception'), 'danger');
        }

        return redirect(route('back.articles.index'));
    }

Nael.Saeed started a new conversation Update Relationship Multi Rows In One To One Relationship

Hi, I have 2 tables: table1 -> [id, table2_id] table2 -> [id, status]

I want to update the status of table2 rows where table1 id is in array [1,2,3] and table2_id == id (table2)

how to do that?

03 Apr
1 year ago

Nael.Saeed left a reply on Global Variable That Gets Data From DB

@shez1983 using .env makes values fixed and not dynamic which is not what I am looking for.

Will check out the docs for the caching thing.

thanks

Nael.Saeed left a reply on Global Variable That Gets Data From DB

@rin4ik I need the variable to be available all around the App not only the views, does this work for that?

@shez1983 This is an array of global site options of those an admin can activate or disable. For example: is Paypal payment option enabled or disabled. So does caching work good for this? If yes how to apply that?

Nael.Saeed started a new conversation Global Variable That Gets Data From DB

Hi, I need to get my site global options from the DB when a request is sent to my server. What is the best practice for doing this?

I mean I need to create a variable that is global to be used every where in my application and this variable should get the value or array values from DB once for each request.

Thanks

update: some coders advised me to store values in a session variable. is that a good solution?

06 Feb
1 year ago

Nael.Saeed left a reply on Eager Loading Isn't Passed To View

@skliche

Is your view extending a layout or including any partials before you are trying to dump it? In that case double check that you are not using (and modifying) $forums anywhere.

you where right, this was the reason. Thanks :)

@arukomp @Snapey Thanks for participating

05 Feb
1 year ago

Nael.Saeed started a new conversation Eager Loading Isn't Passed To View

Hi there, I have been playing around with eager loading in Laravel. in the index I tried this:

public function index()
    {
        $forums = Forum::with('subjects')->get();

        return view('forums.index', compact('forums'));
    }

I tried to use dd($forums) in the controller before the "return" statement and the relation was showing up there.

when I tried to dd($forums) first thing in the view the relation didn't show up and I had to reload it to show up. so what is the problem?

Thanks

10 Oct
1 year ago

Nael.Saeed started a new conversation Incorrect String Value” When Trying To Insert ☠

Hi, Previously I had this error to show up when a user enters a ZERO in Arabic language. I converted mysql character set to utf8mb4_general_ci and set it in Laravel config file.

still the problem wasn't solved so I had to make a middleware to convert all Arabic numbers to English when inserted.

today a new problem shows up when a user tries to use the symbol of ☠ in the text.

how do I solve this problem ?

It is driving me crazy

Thanks

26 Sep
1 year ago

Nael.Saeed left a reply on Ajax Request Fails Only On Production Server

@tykus Thanks for your reply.

I have found the error reason. 'X_CSRF_TOKEN' should be ''X-CSRF-TOKEN'.

The weird thing is that it was runing all good on local server!!!

Nael.Saeed started a new conversation Ajax Request Fails Only On Production Server

Hi,

I have an Ajax request that I use to update notifications in my website. This Ajax works fine and get me back with json response when on local server. Once pushed to production response becomes an html/text type instead of normal json response.

is it because I am on https server or is it something else?

@if(Auth::check())
        <!--If user is logged in then load ajax notification updater script-->
        <script type="text/javascript">
            $.ajaxSetup({
                headers: {
                    'X_CSRF_TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });

            var lastOrders = {{$unread_orders}};
            var lastPurchases = {{$unread_purchases}};
            var lastNotifications = {{$unread_notifications}};
            var lastMessages = {{$unread_messages}};

            var interval = 1000 * *60* 3; //get status each 3 mins

            var pSound = false;

            //call the server and check for notifications , messages, purchases, orders
            var update = function () {
                $.ajax({
                    type:'POST',
                    url: 'https://domain.com/update-notif',
                    error: function(response) {
                        clearTimeout(update, interval );
                    },
                    success: function(response) {
                        if(response.orders != lastOrders) {
                            if(response.orders > 0) {
                                $('.has-orders-num').text(response.orders);
                                $('.has-orders-num').removeClass('d-none');
                            } else {
                                $('.has-orders-num').text(response.orders);
                                $('.has-orders-num').addClass('d-none');
                            }

                            if(response.orders > lastOrders) {
                                pSound = true;
                            }

                            lastOrders = response.orders;
                        }

                        if(response.purchases != lastPurchases) {
                            if(response.purchases > 0) {
                                $('.has-purchases-num').text(response.purchases);
                                $('.has-purchases-num').removeClass('d-none');
                            } else {
                                $('.has-purchases-num').text(response.purchases);
                                $('.has-purchases-num').addClass('d-none');
                            }

                            if(response.purchases > lastPurchases) {
                                pSound = true;
                            }

                            lastPurchases = response.purchases; 
                        }

                        if(response.notifications != lastNotifications) {
                            if(response.notifications > 0) {
                                $('.has-notifications-num').text(response.notifications);
                                $('.has-notifications-num').removeClass('d-none');
                            } else {
                                $('.has-notifications-num').text(response.notifications);
                                $('.has-notifications-num').addClass('d-none');
                            }

                            if(response.notifications > lastNotifications) {
                                pSound = true;
                            }

                            lastNotifications = response.notifications;
                        }

                        if(response.messages != lastMessages) {
                            if(response.messages > 0) {
                                $('.has-messages-num').text(response.messages);
                                $('.has-messages-num').removeClass('d-none');
                            } else {
                                $('.has-messages-num').text(response.messages);
                                $('.has-messages-num').addClass('d-none');
                            }

                            if(response.messages > lastMessages) {
                                pSound = true;
                            }

                            lastMessages = response.messages;
                        }
                        setTimeout(update, interval );

                        if(document.hasFocus()) {
                            pSound = false;
                        }

                        if(pSound) {
                            $('#notification-span').html('<audio autoplay="false" src="/resources/audio/notification.mp3" style="display: none;" id="notification-sound">');

                            pSound = false;
                        }
                    }
                })
            };
            setTimeout(update, interval );

            function PlaySound(soundObj) {
                var sound = document.getElementById(soundObj);
                sound.Play();
            }
        </script>

        <span id="notification-span"></span>
    @endif 

Thanks

20 Aug
2 years ago

Nael.Saeed started a new conversation QueryException For The Arabic ZERO CHARACHTER

Hi there,

I am having this serious error showing up whenever a user uses the ARABIC ZERO character in comments or any text, an example:

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD9 ' for column 'description' at row 1 (SQL: update `services` set `description` = sdadasdasda sads adasd asd asd asd asd asd
asd asd asd asd asd asd asd asd asd asd asd asd asd asda d as
d asd asd asd asd asd asd asd asd asd as
das asd asd asd asd asd asd asd asd asd as
asd asd asd asd asdas sdadasdasda ١� , `status` = pendding.edited, `updated_at` = 2017-08-20 14:38:29 where `id` = 3)

i am using utf8mb4_unicode_ci collation for tables and columns. I can't figure out how to solve this problem.

any idea?

by the way I have a filed of varchar which is a title for the service. this filed accepted the Arabic zero. but still other varchar fields show the same error when using it>

24 Jul
2 years ago

Nael.Saeed left a reply on Url\whatever.php Nginx 404 Error Instead Of Laravel 404 Error

@Jeremy.Danner @bashy

server {
    listen 80;
    server_name ip domain.com www.domain.com;
    return 301 https://domain.com$request_uri;
}

server {
    listen 443 ssl http2;
    server_name ip www.domain.com;
    return 301 $scheme://domain.com$request_uri;
}


# Default server configuration
#
server {
        #listen 80 default_server;
        #server_name ip domain.com www.domain.com;

        #listen [::]:80 default_server;

        # SSL configuration
        #
          listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!

    root /var/www/domain/public;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

    server_name domain.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                # try_files $uri $uri/ =404;
                 try_files $uri $uri/ /index.php?$query_string;

        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
         location ~ \.php$ {
                include snippets/fastcgi-php.conf;
        #
        #       # With php7.0-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }

        location ~ /.well-known {
                allow all;
        }
}

Nael.Saeed started a new conversation Url\whatever.php Nginx 404 Error Instead Of Laravel 404 Error

Hi,

I have installed laravel with Nginx using Ubuntu. Everything is working fine so far except for one problem. When a user insert any url like domain.com/user/whatever.php nginx response with 404 error page of its own instead of showing the laravel 404 page.

what am I missing in my nginx config?

21 May
2 years ago

Nael.Saeed left a reply on How To Modify Things In Default Register And Login Processes

@Snapey hi again I have tried to override methods again and it worked. I added this to the LoginController:

use Illuminate\Http\Request;

/**
    * Get the needed authorization credentials from the request.
    * This overrides the credentials function in the
    * Illuminate\Foundation\Auth\AuthenticatesUsers. 
    *
    * @param  \Illuminate\Http\Request  $request
    * @return array
    */
   protected function credentials(Request $request)
   {
       // added 'banned' => 0 to make sure user is not banned
       return [$this->username() => $request['email'], 'password' => $request['password'], 'banned' => 0];
   }

also in my RegisterController:

use Illuminate\Http\Request;
use Illuminate\Auth\Events\Registered;

/**
     * Handle a registration request for the application.
     * Overrides the register method in 
     * Illuminate\Foundation\Auth\RegistersUsers;
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function register(Request $request)
    {
        $this->validator($request->all())->validate();

        event(new Registered($user = $this->create($request->all())));

        return $this->registered($request, $user)
                        ?: redirect($this->redirectPath())->with('status', trans('auth.registered', ['website_name' => 'website'), 'email' => $user->email]));
    }

20 May
2 years ago

Nael.Saeed left a reply on How To Modify Things In Default Register And Login Processes

@Snapey Thanks for your reply. I have already tried to override methods by adding them in the RegisterControler before posting my question here, but got error. Will try it again and get back to you with the result

Nael.Saeed started a new conversation How To Modify Things In Default Register And Login Processes

Hi, I want to modify things like When user register he is redirected to login form to login manually not logged in automatically after registered. i also need to add the check for whether a user is banned or not before log him in.

What is the best way to do this with out hard code modifying classed and traits in illuminate folder

14 May
2 years ago

Nael.Saeed left a reply on Upload Multiple Images In A Form With Multiple Fileds

@MaverickChan as I found out that dropzone.js does the images adding using ajax. I need to add with preview and remove options at the client side until user hit "submit" to the form. Also I need to retrieve those images and show them with delete option in the edit form later on.

Nael.Saeed left a reply on Upload Multiple Images In A Form With Multiple Fileds

@jlrdw thanks for your answer. My question is about client side not server side :)

13 May
2 years ago

Nael.Saeed started a new conversation Upload Multiple Images In A Form With Multiple Fileds

Hello there, I am having troubles doing the upload multiple images thing for adding new product form. Dropezone.js doesn't work for me because I need to do the upload with preview and keep the images at the client side until he/she hits the add new product button. I also need to give the user the ability to remove a selected image or images.

This is part one. Part two is in the edit product form. Where I need to know how to show the user all the images he previously added and give the user the ability to remove and add images as needed. also the final commit should be when the user clicks on edit button not before.

how should I do that?

21 Apr
2 years ago

Nael.Saeed left a reply on How To Create Different Types Of Users Using Eloquent

Well when I need to use multiple types of use accounts I use Sentinel package for laravel. I suggest you use it or create a similar approach where you make one user table that either has all the fields of both standard and professional combined or separate them to a 2nd table combined too. you can use the fields as needed.

Nael.Saeed left a reply on Get Result Of Entities Has All Number Of Words

@thoasty Thanks for the reply. would you please write a full function ?

Nael.Saeed started a new conversation Get Result Of Entities Has All Number Of Words

Hello,

I am stuck at this. I have a products table. I also have an array of words. I need to get the products that has in their title or their description all the words in the array even if the words are separated in the title or the text.

for example: lets say the array is [big colored giant tv]

lets say I have 2 products with the titles: big colored nice and cheap giant tv samsung big colored nice and cheap tv samsung

the result should get me only the product with this title : "big colored nice and cheap giant tv samsung" because it has in its title all the 4 words. but the other title has only 3 of them.

how do I do this?

thanks

12 Apr
2 years ago

Nael.Saeed left a reply on Conditional Relationship Laravel

@willvincent Thank you much. This just worked as I wanted.

Thanks again :)

Nael.Saeed left a reply on Conditional Relationship Laravel

@willvincent thanks for your reply. I thought about this but this way I'll have to iterate on each user to extract the products and products will be ordered by owner not random

Nael.Saeed started a new conversation Conditional Relationship Laravel

Hello guys, I have 2 tables. Users table and Products table.

products table has -> id and user_id
users table has -> id and status

I want to know what is the best way to request this. I want to request all products that have their users' (owners) status == 0

I tried this:

$products->with('user')->where('status', 0)

also I tried to specify the condition in the relation ship in the Product model like this:

public function active_user() {
    return $this->belongsTo(User::class)->where('status', 0);
}

and used the relationship like so:

$products = Products::with('active_users')->get();

still not working

any advice?

27 Mar
2 years ago

Nael.Saeed started a new conversation Users One Table Vs Multi

Hello everyone,

This is my first time doing a bit of medium size project with laravel. I have an authentication system based on Sentinel package. As for my project requirements my users table became filled with so many columns like: first name, last name, email , address , country_code , description, rating, phone_number, company_name , and so on

What should I do? which is better? keep them all in on table? or separate this table into one or more table?

Thanks

05 Jan
2 years ago

Nael.Saeed left a reply on 404.blade.php Page User Logged In Issue

@exorion Hi, thanks for your reply. I found the solution in here:

https://laracasts.com/discuss/channels/laravel/getting-authuser-on-custom-404-page?page=2

Where it looks like the error page is not getting access to the session or whatever. but still looking for the answer that why the default Laravel app didn't do this modification? What bad is to happen after doing so.

now about the second issue if redirecting to /Home instead of / only though I changed the redirectTo to be / in the LoginController. I figured out that I need to manually do the change also in Middleware\redirectIfAuthenticated.php

04 Jan
2 years ago

Nael.Saeed started a new conversation 404.blade.php Page User Logged In Issue

hello I have created a custom 404.blade.php page and placed it views\errors The problem now is that when the page shows up it shows the LOGIN button in the navbar though the user is already logged in and a logged in user navbar should show up instead. Also when I click on this LOGIN button it redirect me to /home because the user is already logged in though i had changed the redirectto in the login controller to be '/' instead of '/home'.

Any idea please ?

03 Jan
2 years ago

Nael.Saeed started a new conversation Validating A Field Upon Another Filed Value Selection

Hello there,

I have a form and I want to validate a filed in there depending on the value of another filed. This is my validation code

$this->validate($request, [
            'name' => 'required|max:255',
            'national_id' => 'required|numeric',
            'birth_date' => 'required|before:today',
            'phone_number' => 'required|digits:10',
            'state' => 'required|exists:states,id',
            // 'city' => 'required|exists:cities,id',
            'city' => [
                'required',
                Rule::exists('cities','id')->where(function ($query) {
                    $query->where('state_id', $state_id);
                })],
            'address' => 'required',
            'section' => 'required',
            'military_service' => 'required|boolean',
            'education' => 'required',
        ]);

I want that the city selected to be one of the cities under the state selected in the field above. I don't know how to get the state_id sent in the 'state' filed in the $request to be compared in the function of WHERE in the city field validation

31 Dec
2 years ago

Nael.Saeed left a reply on Updating Dropdown List B When Choosing From Dropdown List A

@FrancescoZaffaroni @cent040 Thanks for your reply. I need to know how to use that inside my Laravel application. There are alot of examples online about using ajax, but using it the right way inside my Laravel controllers and view.blade.php is what I need to learn

Nael.Saeed started a new conversation Updating Dropdown List B When Choosing From Dropdown List A

hello, I have a form with 2 dropdown lists A and B. I am using bootstrap and Laravel. I want to populate dropdown list B relatively to the option chosen in dropdown list A. What is the best way to do so ?

Thanks

07 Dec
2 years ago

Nael.Saeed left a reply on Namming Convention

@shez1983 Thanks for your reply. I was just wondering about how to do the naming so Laravel does the automatic finding of the table.

Nael.Saeed left a reply on Namming Convention

@martinbean so if the table name contains underscore then I should remove it in the model and controller names?

if I do so then how would a model automatically know the name of the table it should work on?

Nael.Saeed started a new conversation Namming Convention

Hello there,

I have a question about naming convention please. In Laravel tables are named like "employees" then a model is named "Employee" and a controller is named "EmployeeController" now if my table has 2 words in it's name like "employee_histories" then the model should be ? and the controller should be ?

Thanks

18 Oct
2 years ago

Nael.Saeed left a reply on Calling Multi Controllers For One URI

@gabrelbuzzi Thanks for your reply. So even if I need to view something that needs to call a lot of different objects like 10 or even 20 I'll have to create a new CONTROLLER where this controller NEVER call other controllers, but instead uses the Models I already created before to get the 10 or 20 data I need?

Nael.Saeed started a new conversation Calling Multi Controllers For One URI

Hi there Guys, I am still in learning stage of laravel 5.3 I am working on an online shop as to practice and learn the Laravel features. i need to ask about something. As I understood we use separate controller for each http link(request) from the browser. For example:

mywebsite.com/categories -> [email protected]> call Category show view.
mywebsite.com/products-> [email protected] -> Call Products show view.

now lets say I need to show Categories and Products in on view like:

mywebsite.com/somepage

in this case what is the best way to do the thing? do I call a new controller which call both old controllers like:

mywebsite.com/somepage-> [email protected]
->Call both  [email protected] and [email protected] 
->then call the somepageShow?

thanks

13 Oct
2 years ago

Nael.Saeed left a reply on Signed In -> Page 1, NOT Signed In -> Page2

@boynet i just didn't get it right. I thought this was about the routes\web.php file.

Thanks for your assistant :)

Nael.Saeed left a reply on Signed In -> Page 1, NOT Signed In -> Page2

@boynet I understand that controller is what receive the request and then do what is necessary to answer it. When a controller needs data from DB it then request it by the model to view it later through the View. This is the general idea behind the MVC approach. Now the problem is that when I want to point my route to a single controller this is simple. But to point my route between 2 controllers under 2 conditions this what I can't find out how to do it.

Still reading in the routes Doc.

Nael.Saeed left a reply on Signed In -> Page 1, NOT Signed In -> Page2

@boynet Ok I'll read it again and get back to you if things are still vague. I read the routing doc many times before. The problem is that I never used a framework before and this is my first time and I find it all confusing.

Thanks anyway, I can see what are you aiming at :)

Nael.Saeed left a reply on Signed In -> Page 1, NOT Signed In -> Page2

@boynet This is not helping at all. I am a NEWBIE. each answer you give me get it more confusing. Would you please explain more? I don't know how to apply this in my case