Jump to content

Learning Basic Laravel & phpVMS 7


in2tech

Recommended Posts

First off should I ask these type questions here or in the Off Top Bantor area? I think since they are related to phpVMS 7 & Laravel this will be alright, but let me know if I am wrong. So after getting Laravel installed and learning some very basic, I mean basic thing's about Laravel & phpVMS I have a few questions and some info.

1 - Is it possible to add a new function that would point to a view for say Awards in the http/routes/web.php and create a NEW view in the views folder and point it to the view and would it work? Just curious. Might give it a try just for the heck of it.

 

2- Also in digging around ( sorry if I am not suppose too ), I always wondered how I could change the number of pilots that show up on the Home page. Right now it is set for 4, and that is all it shows total! So I dug around and noticed a file that could be changed in the Http/Controllers/Frontend area called HomeController.php and guess what I found? This code and changed it, and it worked :)

 

	<?php
	namespace App\Http\Controllers\Frontend;
	use App\Interfaces\Controller;
use App\Models\User;
use Illuminate\Database\QueryException;
	/**
 * Class HomeController
 */
class HomeController extends Controller
{
    /**
     * Show the application dashboard.
     */
    public function index()
    {
        try {
            $users = User::orderBy('created_at', 'desc')->take(8)->get();
        } catch (QueryException $e) {
            return view('system/errors/not_installed');
        }
	        return view('home', [
            'users' => $users,
        ]);
    }
}
	

Changed the 4 to an 8 , where it states take(8), and now I can list up to 8 NEW pilots :) Just having fun digging and learning the basics! Of 8 is it as NEW pilots register it kicks off the oldest one so it will never go over whatever number you make it. If that makes sense. And then of course there is the Pilot List anyway, which shows them all!

So now it looks like this:

 

2018-10-19_0243

I can show up to 8 of the newest pilots registrations instead of just 4. But like I said doubt you would want more or even change it, as you have the pilot/users list. But I must say I do at least like 8 :) Just messing around as I said! As you can see I also reformatted the way it looks, etc...

Edited by in2tech
Link to comment
Share on other sites

On 10/25/2018 at 9:33 AM, Nabeel said:

Nice! I can convert the pilot count into a setting.

For #1 - I'm not sure what you're trying to do.

That would be cool, where would it be, admin panel? Yeah so long since I posted this, I am not sure what #1 means either anymore. I was more likely asking if I could make a NEW route and a View for info, I guess, but not really sure anymore :) 

 

Sorry, should have made it more clear when I posted it! I'm old and just forgot!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...