Asked  7 Months ago    Answers:  5   Viewed   39 times

Okay--I know this is a really elementary issue, but I can't figure it out. This is a question regarding Laravel.

Basically, I have my stylesheets embedded in my default layout view. I'm currently just using regular css to link them, such as:

<link rel="stylesheet" href="css/app.css" />

It works great when I am at a single level route such as /about, but stops working when I go deeper, such as /about/me.

If I look at Chrome's developer console I see some of the following errors (only for the deeper routes):

Resource interpreted as Stylesheet but transferred with MIME type text/html: "".

So clearly it is now looking for the css inside the "about" folder--which of course isn't a folder at all.

I just want it to look in the same place for the assets regardless of the route.



For Laravel 4 & 5:

<link rel="stylesheet" href="{{ URL::asset('assets/css/bootstrap.min.css') }}">

URL::asset will link to your project/public/ folder, so chuck your scripts in there.

Note: For this, you need to use the "Blade templating engine". Blade files use the .blade.php extension.
Wednesday, March 31, 2021
answered 7 Months ago

Something like this should work for you.


Route::get('/dashboard', ['as'=>'dashboard', 'uses'=> 'DashboardController@dashboard']);


use AppHttpRequests;
use AppHttpControllersController;

use AppUser;
use AppAdmin;

class DashboardController extends Controller {
    public function dashboard(){
        if ($this->auth->user()->hasRole('admin') )
            return $this->showAdminDashboard();
        elseif ($this->auth->user()->hasRole('user') )
            return $this->showUserDashboard();
        else {

    private function showUserDashboard()
        return view('dashboard.user');

    private function showAdminDashboard()
        return view('dashboard.admin');

Edits per comment

It sounds like something like this approach might be what you are looking for.


$uses = 'PagesController@notfound';
if( $this->auth->user()->hasRole('admin') )
    $uses = 'AdminController@index';
elseif ($this->auth->user()->hasRole('user') )
    $uses = 'UsersController@index';

Route::get('/dashboard', array(
    ,'uses'=> $uses

That said, I feel like having a DashboardController works better. I find when using a dashboard, I pull from a variety of models for the opening page to get statistics about the site. I would use the DashboardController only for this general information. From the Dashboard, I would like to other pages that have the specific items you want to view/edit. This way if the admins need to access view/edit the same information as the users, you do not need to rewrite code. You can just update the security on that particular controller to allow for both groups.

Wednesday, March 31, 2021
answered 7 Months ago

To use a blade template you must have the .blade in file name, for example in your case it should be


Otherwise, it won't render. Read more on Laravel Site. Here is an example from one of my testing projects (index.blade.php), since you had a typo @extends('layout.master') it should be something like this


This is a sample of laravel 4 using blade template engine.
This is home page using HomeController and home.blade template.
Saturday, May 29, 2021
answered 5 Months ago

If you did not specify keys for the elements of $organisationsOwned you can use the element's index to determine if it's the first one:

@foreach($organisationsOwned as $index => $organisationOwned)
  <td><input type="radio" name="organisations" id="{!! $organisationOwned->id !!}" @if (!$index) {!! "checked" !!} @endif></td>
Saturday, May 29, 2021
answered 5 Months ago

I think if you tried creating a bitmap with the power of 2 axis sizes and then add your bitmap it should work just fine. maybe something like

Bitmap.createBitmap(notPowerOf2Bitmap, offx, offy, xsize, ysize, bitmapFlag)

other than that, I would say suffer through the photoshop process. How many pictures you got?

Monday, September 27, 2021
Boudewijn Smit
answered 4 Weeks ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :