alanaasmaa

alanaasmaa

Member Since 3 Years Ago

Tampere

Experience Points 19,030
Experience Level 4

970 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 161
Lessons
Completed
Best Reply Awards 2
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.

08 Sep
2 years ago

alanaasmaa left a reply on Get Data Out From Axios ? (JAVASCRIPT)

@thomas_ilspa Maybe u could try something like this ?

getUsers() {
    axios.get('/users').then(function (result) {
        doSomething(result.data);
    });
}

doSomething(data) {
    console.log(data);
}

Also i would recommend to handle failed requests and do some validation to data.

05 Sep
2 years ago

alanaasmaa left a reply on When Will Lumen 5.5 Release?

@MaxMatteo Do you have a source ?

15 Mar
2 years ago

alanaasmaa started a new conversation Could Some Webpack Exper Give Me Best Webpack Config For Laravel ?

Hello,

So i have fighted alot with webpack and i'm sure if some expert could show own or fix mine would be awesome.

So this is my gulfile:

process.env.DISABLE_NOTIFIER = true;
const   elixir = require('laravel-elixir'),
        postStylus = require('poststylus'),
        postcss = require('gulp-postcss'),
        cssnano = require('cssnano'),
        lost = require('lost'),
        axis = require('axis'),
        rupture = require('rupture'),
        autoprefixer = require('autoprefixer-stylus');

require('elixir-tinypng');
require('laravel-elixir-postcss');

elixir.config.sourcemaps = true;

elixir(mix => {
    mix
    .stylus('app.styl', './resources/assets/postcss/', {
        compress: true,
        use: [
            axis(),
            rupture(),
            autoprefixer(),
            postStylus(['lost'])
        ],
    })
    .postcss('app.css', {
        plugins: [
            require('cssnano')
        ]
    })
    .stylus('admin.styl', './resources/assets/postcss/', {
        compress: true,
        use: [
            axis(),
            rupture(),
            autoprefixer(),
            postStylus(['lost'])
        ],
    })
    .postcss('admin.css', {
        plugins: [
            require('cssnano')
        ]
    })
    .webpack('app.js')
    .webpack('admin.js')
    .version([
        'css/app.css',
        'js/app.js',
        'css/admin.css',
        'js/admin.js'
    ])
    .tinypng({
        key: 'xxx',
        sigFile: '.tinypng-sigs',
    })
    .browserSync({
        proxy: 'xxx',
        notify: false,
        open: false
    });
});

And here is my webpack conf.

var webpack = require('webpack'),
    ModernizrWebpackPlugin = require('modernizr-webpack-plugin');
module.exports = {
    devtool: 'eval-cheap-module-source-map',
    cache: true,
    plugins: [
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.DefinePlugin({
            'process.env': {
                  'NODE_ENV': JSON.stringify('production')
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                warnings: false
            },
            sourceMap: false,
            comments: false
        }),
        new webpack.ProvidePlugin({
            axios: "axios",
            vex: "vex-js"
        }),
        new ModernizrWebpackPlugin({
            'options': [
                'html5shiv',
                'setClasses'
            ],
            'feature-detects': [
                'input',
                'css/objectfit'
            ]
        })
    ],
};

My webpack feels slow and refreshes the site alot. Maybe cause i have two of them ? Also how can i load scripts only on right page ?

25 Feb
2 years ago

alanaasmaa left a reply on Get Data Out From Axios ? (JAVASCRIPT)

@ejdelmonico I know that, but i mean how could i use it outside function(response).

If i just console.log it i cant access it outside. Right now im doing it like that

createAlbum: function(event) {
    event.preventDefault();
    if (typeof gallery.createAlbumPage == 'undefined') {
        axios.get('/admin/gallery/albums/create')
        .then(function(response, data) {
            gallery.createAlbumPage = response.data;
            openCreateAlbum();
        });
    } else {
        openCreateAlbum();
    }
    function openCreateAlbum() {
        vex.open({
            unsafeContent: gallery.createAlbumPage,
            contentClassName: 'popup'
        });
    }
}

alanaasmaa started a new conversation Get Data Out From Axios ? (JAVASCRIPT)

Hello,

i just cant figure out how could i get the data out of axios ?

createAlbum: function(event) {
    var data;
    event.preventDefault();
    axios.get('/admin/gallery/albums/create')
        .then(function(response, data) {
            data = response.data;
        });
    console.log(data);
}

I got it out once by exporting it to object and saving it.

Example

var gallery = {
    createAlbum: function(event) {
        event.preventDefault();
        axios.get('/admin/gallery/albums/create')
            .then(function(response, data) {
                gallery.data = response.data;
            });
    }
}

But this does not feel the right way to save the request like that ?

18 Feb
2 years ago

alanaasmaa left a reply on Webpack Global Import ?

I fixed it with this :)

I created webpack.config.js in root with this content:

var webpack = require('webpack');

module.exports = {
    devtool: 'source-map',
    plugins: [
        new webpack.optimize.OccurrenceOrderPlugin(),
        new webpack.DefinePlugin({
            'process.env': {
                  'NODE_ENV': JSON.stringify('production')
            }
        }),
        new webpack.optimize.UglifyJsPlugin({
            compressor: {
                warnings: false
            },
            sourceMap: true,
            comments: false
        }),
        new webpack.ProvidePlugin({
            axios: "axios"
        })
    ],
};

I hope it helps someone.

alanaasmaa started a new conversation Webpack Global Import ?

Hello,

So im new with webpack. (Also half year in js).

My problem is that my app.js is 718kb in size. When my all scripts and imports in total is 248kb.

And the second problem is that in my app.js

I require (should i use import for those too ? ) these like that:

import axios from 'axios';

const navbar = require('./navbar'),
    gallery = require('./galleria');

Now how can i use axios in galleria.js and maybe in some other files ?

EDIT: Every time i need some help, i google alot and can't find anything. Then im like okey enought for this i ask for help. And then i find solution myself straight away. Could anyone explain me why this is happening all the time ? It weels like i should always write my thoughs so i would code much faster.

Anyways i fixed the size problem myself. Now i only need a way to global import.

13 Nov
2 years ago

alanaasmaa started a new conversation Get Elixir Task Messages.

Hi, im trying to create a new elixir task and i would ike to output messages like these :

┌───────────────────┬───────────────────────────────┬───────────────────────────                                                                                                                                                                                               ───────┬────────────────────┐
│ Task              │ Summary                       │ Source Files                                                                                                                                                                                                                    │ Destination        │
├───────────────────┼───────────────────────────────┼───────────────────────────                                                                                                                                                                                               ───────┼────────────────────┤
│ mix.stylus()      │ 1. Compiling Stylus           │ resources\assets\stylus\ap                                                                                                                                                                                               p.styl │ public\css\app.css │
│                   │ 2. Autoprefixing CSS          │                                                                                                                                                                                                                                 │                    │
│                   │ 3. Concatenating Files        │                                                                                                                                                                                                                                 │                    │
│                   │ 4. Writing Source Maps        │                                                                                                                                                                                                                                 │                    │
│                   │ 5. Saving to Destination      │                                                                                                                                                                                                                                 │                    │
├───────────────────┼───────────────────────────────┼───────────────────────────                                                                                                                                                                                               ───────┼────────────────────┤
│ mix.webpack()     │ 1. Transforming ES2015 to ES5 │ resources\assets\js\app.js                                                                                                                                                                                                      │ public\js\app.js   │
│                   │ 2. Writing Source Maps        │                                                                                                                                                                                                                                 │                    │
│                   │ 3. Saving to Destination      │                                                                                                                                                                                                                                 │                    │
├───────────────────┼───────────────────────────────┼───────────────────────────                                                                                                                                                                                               ───────┼────────────────────┤
│ mix.version()     │ 1. Versioning                 │ public\css\app.css                                                                                                                                                                                                              │ public\build       │
│                   │ 2. Rewriting File Paths       │                                                                                                                                                                                                                                 │                    │
│                   │ 3. Saving to Destination      │                                                                                                                                                                                                                                 │                    │
│                   │ 4. Copying Source Maps        │                                                                                                                                                                                                                                 │                    │

My task looks like this

elixir.extend('cssnano', function() {
    new elixir.Task('cssnano', function() {
        return gulp.src('./public/css/*.css')
            .pipe(cssnano({
                safe:true,
                autoprefixer: {add:true}
            }))
            .pipe(gulp.dest('./public/css/'));
    })
    .watch('./resources/assets/stylus/**/*.styl');
});

I would be glad if this is possible.

22 Oct
2 years ago

alanaasmaa started a new conversation Multible Domains One Adminpanel ?

Hello,

My and gf are trying to build a project, that would need us to develope a website. Then customers can buy their own site via our site. Smallest pack would use our domain like site1.domain.com and so on. I think i know how i would do that. But when customer would like to get own domain. like mydomain.com and still use our database and our updates and stuff how would i do that.

Should i build one laravel site, then for every customer some api with lumen ? The main thing is that shopping cart should be same for every site. If i go to domain1.com and domain2.com shopping cart should remember whats inside domain1.com.

Maybe we are not very good for this very large project but it would be nice to try. It may never be ready or never do anything good but we are just planning.

I hope you understanded what is my question.

06 Oct
2 years ago

alanaasmaa started a new conversation What You Think For My Laravel 5.3 Startup.

Hi, I made clean laravel 5.3 startup pack into my git account.

What you guys think about that ? Would you use it ? What would you add/change/remove ?

I made this in 1-2 hours so there might be bugs. I use it with my and my gf next project. I also try to get my hand dirty with vue.js.

https://github.com/alanaasmaa/Laravel-5.3-Startup https://github.com/alanaasmaa/Laravel-5.3-Startup https://github.com/alanaasmaa/Laravel-5.3-Startup

All feedback and forks and everything are welcome ! ♥

16 Aug
3 years ago

alanaasmaa started a new conversation PHP 5.4 Next To PHP 7

Hello, i have vagrant homestead setted up.

I need very old version of PHP to upgrade one site. I have tried to install php 5.4 with phpbrew with no sucess. I think im pretty sure that i have installed everything that phpbrew needs.

Here is my output..

[email protected]:~$ phpbrew install php-5.4.10 +default+fpm+mysql
===> phpbrew will now build 5.4.10
===> Loading and resolving variants...
Downloading http://museum.php.net/php5/php-5.4.10.tar.bz2 via curl extension
[==================================================================] 10.63/10.63MB 100%
===> Extracting /home/vagrant/.phpbrew/distfiles/php-5.4.10.tar.bz2 to /home/vagrant/.phpbrew/build/tmp.1471325715/php-5.4.10
===> Moving /home/vagrant/.phpbrew/build/tmp.1471325715/php-5.4.10 to /home/vagrant/.phpbrew/build/php-5.4.10
===> Checking patches...
Checking patch for replace apache php module name with custom version name
===> Configuring 5.4.10...


Use tail command to see what's going on:
   $ tail -F /home/vagrant/.phpbrew/build/php-5.4.10/build.log


===> Checking patches...
Checking patch for php5.3.29 multi-sapi patch.
Checking patch for php5.3.x on 64bit machine when intl is enabled.
Checking patch for openssl dso linking patch
===> Building...
Error: Make failed:
The last 5 lines in the log file:
/usr/bin/ld: ext/openssl/xp_ssl.o: undefined reference to symbol '[email protected]@OPENSSL_1.0.0'

//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

Makefile:252: recipe for target 'sapi/cli/php' failed

make: *** [sapi/cli/php] Error 1

Please checkout the build log file for more details:
         tail /home/vagrant/.phpbrew/build/php-5.4.10/build.log
[email protected]:~$

Here are my warnings from log

/usr/bin/ld: warning: libssl.so.1.0.0, needed by /usr/lib/x86_64-linux-gnu/libcurl.so, may conflict with libssl.so.1.0.2
/usr/bin/ld: ext/openssl/xp_ssl.o: undefined reference to symbol '[email protected]@OPENSSL_1.0.0'
//lib/x86_64-linux-gnu/libssl.so.1.0.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:252: recipe for target 'sapi/cli/php' failed
make: *** [sapi/cli/php] Error 1

Google is not helping me with this case, thanks !

I Got it wokring somehow... i didnt use +default.. Everythime when i ask help i figure it out myself.. :D

Problem was with openssl version.

22 Jul
3 years ago

alanaasmaa left a reply on Remove "comma" From Last Array Item...

@leandromatos Thanks this worked ! :) I thought about something like that but i was like maybe there is simpler code, but if it works why do fix it.

I always try to make my code as simple and short as possible. I know it might not be the best solution and maybe not the best way to learn but i like to keep things simple and short. This is my src = https://github.com/alanaasmaa/Portfolio

alanaasmaa left a reply on Remove "comma" From Last Array Item...

@martinbean & @m4nt4s thanks but i just don't get it

My article model

public function tags()
    {
        return $this->belongsToMany('App\Models\Tag');
    }   

alanaasmaa started a new conversation Remove "comma" From Last Array Item...

So my code is like this

<dd><i class="fa fa-tags"></i> @foreach($article->tags as $key => $tag)<a href="/tags/{{ $tag->slug }}"> {{ $tag->name}} </a>@endforeach</dd>

It prints tag1 tag2 tag3 i would like tag1, tag2, tag3

I have tried implode(",", $array); & explode(",", $array);

Almost every way i can think about in blade view.

17 Jul
3 years ago

alanaasmaa left a reply on Laravel|nginx|php7|Ubuntu 16 = 502 Bad Gateway

Changed fastcgi_pass unix:/var/run/php7.0-fpm.sock; to fastcgi_pass 127.0.0.1:9000; And now it works.

16 Jul
3 years ago

alanaasmaa left a reply on Laravel|nginx|php7|Ubuntu 16 = 502 Bad Gateway

No help :/

EDIT: I have tryed as much as i can find from google. I don't understand what could be wrong.

alanaasmaa started a new conversation Laravel|nginx|php7|Ubuntu 16 = 502 Bad Gateway

Hello,

I'm using nginx first time (usually used apache) and i can't get it working. I rebuilded my droplet from digital ocean multible times.

I used this tutorial to set it up: https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04

Ecept one line is fastcgi_pass unix:/var/run/php7.0-fpm.sock;

Also used this. I have also used alot of other tutorials reinstall removed and everything. I just cant get this fixed.

My domain is alanaasmaa.eu

my dir is /var/www/laravel/public


server {

    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /var/www/laravel/public;
    index index.php index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        include                  fastcgi_params;
        fastcgi_keep_conn on;
        fastcgi_index            index.php;
        fastcgi_split_path_info  ^(.+\.php)(/.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php7.0-fpm.sock;
    }
}

15 Jul
3 years ago

alanaasmaa left a reply on Any Way To Clean Up My BlogController ?

@JMarcher could you give asmall example/startup ? Im in bed atm just came from club i try tp check traits tomorrow. ETA in 10hours

14 Jul
3 years ago

alanaasmaa left a reply on Any Way To Clean Up My BlogController ?

@martinbean Thanks ! I got it allready working :)

public function compose(View $view)
    {
        $view->with('categories', Category::getSortedCategories());
        $view->with('tags', Tag::all());
    }

Src: https://github.com/alanaasmaa/Portfolio/

alanaasmaa left a reply on Any Way To Clean Up My BlogController ?

@gcwilliams Thanks, this looks simpler but i think View Composer is more expandable and keeps code cleaner. But this is also good information ! :)

I followed the tutorial and i got it working ! :) THanks all !

alanaasmaa left a reply on Any Way To Clean Up My BlogController ?

@martinbean Thanks, this looks neat.

However i'm pretty new to php so little startup would be nice.

On doc's there is

public function compose(View $view)
    {
        $view->with('count', $this->users->count());
    }

I don't get what means ->with('count',... EDIT: DOes this mean to include it inside views that includes count ?

I did this

//BlogController.php index function

public function index() {
        $articles = Article::with('tags', 'category')->latest()->paginate(9);

        return view('pages.blog', compact('articles'));
    }
//AppServiceProvider.php boot function
public function boot()
    {
        view()->composer(
            ['blog', 'tags', 'categories'],
            'App\Http\ViewComposers\BSidebarComposer'
            );  
    }

//BSidebarComposer compose function
public function compose(View $view)
    {
        $view->with('categories', Category::all(););
    }

//sidebar.blade.php Categories part
@foreach($categories as $category)
    <li>
        <a href="/categories/{{ $category->slug }}">{{ $category->name }}</a>
    </li>
@endforeach

This does not work... I made folder Providers insde app directory and namespace is correct.

EDIT2: I found tutorial https://scotch.io/tutorials/sharing-data-between-views-using-laravel-view-composers i try to follow it.

alanaasmaa started a new conversation Any Way To Clean Up My BlogController ?

Hi,

I need to get categories and tags array for my every blog view to print them on my sidebar. I'm pretty new to php and i was thinking is there a way to make these public to whole controller ?

This is my BlogController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Models\Article;
use App\Models\Category;
use App\Models\Tag;
use App\Models\User;

class BlogController extends Controller
{
    public function index() {
        $articles = Article::with('tags', 'category')->latest()->paginate(9);
        $categories = Category::all();
        $tags = Tag::all();

        return view('pages.blog', compact('articles','categories','tags'));
    }

    public function article($slug) {
        $article = Article::findBySlug($slug);
        $categories = Category::all();
        $tags = Tag::all();

        return view('pages.articles_show', compact('article','categories','tags'));
    }

    public function categories($slug) {
        $articles = Category::findBySlug($slug)->articles()->latest()->paginate(9);
        $categories = Category::all();
        $tags = Tag::all();

        return view('pages.categories', compact('articles','categories','tags'));
    }

    public function tags($slug) {
        $articles = Tag::findBySlug($slug)->articles()->latest('articles.created_at')->paginate(9);
        $categories = Category::all();
        $tags = Tag::all();
        
        return view('pages.tags', compact('articles','categories','tags'));
    }

    public function portfolio() {
        $articles = Article::with('tags', 'category')->where('type', 2)->latest()->paginate(9);
        $categories = Category::all();
        $tags = Tag::all();

        return view('pages.portfolio', compact('articles','categories','tags'));
    }
    public function portfolioItem($slug) {
        $article = Article::findBySlug($slug);
        $categories = Category::all();
        $tags = Tag::all();

        return view('pages.portfolio_show', compact('article','categories','tags'));
    }
}

alanaasmaa left a reply on Auth::user() Returns Null

The vide that jlrdw is talking abot is this -> https://laracasts.com/series/whats-new-in-laravel-5-2/episodes/3

And also you don't need to use other auth routes than Route::auth();

If you do artisan route:list you can see routes that ::auth() outputs.

---------------------------------------+------------+
| Domain | Method   | URI                     | Name | Action                                                          | Middleware |
+--------+----------+-------------------------+------+-----------------------------------------------------------------+------------+
|        | GET|HEAD | /                       |      | App\Http\Controllers\[email protected]                       | web,web    |
|        | GET|HEAD | article/{slug}          |      | App\Http\Controllers\[email protected]                     | web,web    |
|        | GET|HEAD | blog                    |      | App\Http\Controllers\[email protected]                       | web,web    |
|        | GET|HEAD | categories/{slug}       |      | App\Http\Controllers\[email protected]                  | web,web    |
|        | GET|HEAD | login                   |      | App\Http\Controllers\Auth\[email protected]          | web,guest  |
|        | POST     | login                   |      | App\Http\Controllers\Auth\[email protected]                  | web,guest  |
|        | GET|HEAD | logout                  |      | App\Http\Controllers\Auth\[email protected]                 | web        |
|        | POST     | password/email          |      | App\Http\Controllers\Auth\[email protected] | web,guest  |
|        | POST     | password/reset          |      | App\Http\Controllers\Auth\[email protected]              | web,guest  |
|        | GET|HEAD | password/reset/{token?} |      | App\Http\Controllers\Auth\[email protected]      | web,guest  |
|        | GET|HEAD | portfolio               |      | App\Http\Controllers\[email protected]                   | web,web    |
|        | GET|HEAD | portfolio/{slug}        |      | App\Http\Controllers\[email protected]               | web,web    |
|        | GET|HEAD | register                |      | App\Http\Controllers\Auth\[email protected]   | web,guest  |
|        | POST     | register                |      | App\Http\Controllers\Auth\[email protected]               | web,guest  |
|        | GET|HEAD | tags/{slug}             |      | App\Http\Controllers\[email protected]                        | web,web    |
+--------+----------+-------------------------+------+-----------------------------------------------------------------+------------+

Also it does not need to be in web middleware group.

alanaasmaa left a reply on Class 'User' Not Found (How To Get User By Id ? )

@EventFellows Actually this worked ! :D Lol

Im pretty new to PHP. I try to learn everything as fast as possible. I got my first web development job starting from next month. I know HTML and CSS. And a bit PHP now i have to MASTER PHP AND JS.

Usually my development process goes by reading other's github jobs and manually copying parts of the code.

alanaasmaa left a reply on Class 'User' Not Found (How To Get User By Id ? )

@SaeedPrez Thanks this worked !

Is this some security thing or just good practice to do queries in controller ?

And also I love this community ! I think this is the reason i'm sticking with laravel !

alanaasmaa started a new conversation Class 'User' Not Found (How To Get User By Id ? )

Hello,

It's me again ! So now i have another problem that i have tryed to fix for a while now.

I'm trying to print Username to my blog that created a post.

<li><i class="fa fa-user"></i> {{User::find($article->user_id)}}</li>

But it's giving me Class User not found.

My user model and all other models are in App\Models

<?php

namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword;
    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public function articles()
    {
        return $this->hasMany('App\Models\Article');
    }
}

What i have tryed to do to fix my problem ?

  1. Used google ALOT
  2. Tryed to add "use app\Models\User" in almost everywhere that is connected somehow with my blog.
  3. I have edited my User.php model
  4. I have double checked all namespaced (also in config directory)

It seems like Class User is removed in laravel 5.2 do i have to use Auth:: or what do i have to do ?

If i go to artisan tinker and do

  1. use App\Models\User;
  2. User::find(1);

it outputs me the data i need..

08 Jul
3 years ago

alanaasmaa started a new conversation Laravel Can't Find My Css And Js.

Hello, i tryed to push my site online for testing purpouses.

I'm using some random free hosting site for my portfolio and it was confusing but i got it online. Everything seems to work except laravel can't find my css.

It tryes to find them @ domain.com/css/app.css but the right url is domain.com/public/css/app.css

Im using this type of url

I have pushed all my files public_html witch is default apache directory for my host.

I know i can set it like asset('public/css/app.css') but i think it should work like that too with some cfg.

06 Jul
3 years ago

alanaasmaa left a reply on ERROR: I Want To Use Just Lost Not Stylus Lost But Still With Stylus

I got it working !!

I was using my gulpfile wrong, also i added axis.

Fixed version:

var elixir = require('laravel-elixir'),
    poststylus = require('poststylus'),
    rupture = require('rupture'),
    lost = require('lost'),
    axis = require('axis');

require('laravel-elixir-stylus');
require('laravel-elixir-imagemin');

elixir.config.sourcemaps = true;

elixir(function(mix) {

    mix
    .stylus('app.styl', null, {
        use: [
            axis(),
            rupture(),
            poststylus(['lost'])
        ]
    })

    .version([
        'css/app.css'
    ])

    .scripts([
        'components/**/*.js',
        'app.js'
    ])
    .imagemin({
        optimizationLevel: 3,
        progressive: true,
        interlaced: true
    })

    .browserSync({ 
        proxy: 'cv.dev',
        notify: false
    });
});

alanaasmaa left a reply on ERROR: I Want To Use Just Lost Not Stylus Lost But Still With Stylus

Okei i fount out that the error is coming becose of rupture. If i remove all rupture css it works.

Anyone has idea how to fix this ?

05 Jul
3 years ago

alanaasmaa started a new conversation ERROR: I Want To Use Just Lost Not Stylus Lost But Still With Stylus

Hello, i would like to use stylus and lost sepreatly. Then i can update my lost grid if there is updates.

I have some weird error in post CSS

[13:12:47] Finished 'stylus' after 28 ms
{ [CssSyntaxError: /home/vagrant/Code/cv/resources/assets/stylus/app.styl:103:1: Unknown word]
  name: 'CssSyntaxError',
  message: '/home/vagrant/Code/cv/resources/assets/stylus/app.styl:103:1: Unknown word',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-stylus',
  __safety: { toString: [Function: bound ] } }

My gulpfile.js

var elixir = require('laravel-elixir');
    postStylus = require('poststylus')
    rupture = require('rupture');
    lost = require('lost');

require('laravel-elixir-stylus');
require('laravel-elixir-imagemin');

elixir.config.sourcemaps = true;

elixir(function(mix) {

    mix
    .stylus('app.styl', null, {
        use: [postStylus(['lost', 'rupture'])]
    })

    .version([
        'css/app.css'
    ])

    .scripts([
        'components/**/*.js',
        'app.js'
    ])
    .imagemin({
        optimizationLevel: 3,
        progressive: true,
        interlaced: true
    })

    .browserSync({ 
        proxy: 'cv.dev',
        notify: false
    });
});

FULL SOURCE CODE: https://bitbucket.org/AlanAasmaa/cv If someone has experience with lost grid can someone tell me if this is the right way of using it ? My nth-childs are messed up body. styl :https://bitbucket.org/AlanAasmaa/cv/src/1a0e421cc694c87af245093ced312034d2ee2483/resources/assets/stylus/component/body.styl?at=master&fileviewer=file-view-default

index.blade.php: https://bitbucket.org/AlanAasmaa/cv/src/1a0e421cc694c87af245093ced312034d2ee2483/resources/views/pages/index.blade.php?at=master&fileviewer=file-view-default

I had my first web developer job interview today and i really would like to master lost and postCSS and so on :)

30 Jun
3 years ago

alanaasmaa left a reply on Lost Grid | What Im Doing Wrong ?

Nothing. Would it be a bad practice if i disable lost cycle and i would create a new class that i give every last box ?

EDIT: Actually i dont have to disable cycle if i use that new .e class.

@lost flexbox flex;
@lost gutter 15px;
@lost cycle none;

.e {
  margin-right: 0 !important;
}
<section class="container">
    <div class="half box">
    <h4>Half is a bit smaller</h4>
    <p>These 1/3 should be on the same line</p>
    </div>
    <div class="quarter box"><h4>1/4</h4>
    </div>
    <div class="quarter box e"><h4>1/4</h4>
    </div>
    <div class="third box"><h4>1/3</h4>
    </div>
    <div class="one box"><h4>1</h4>
    </div>
    <div class="one box"><h4>2</h4>
    </div>
    <div class="one box"><h4>3</h4>
    </div>
    <div class="one box"><h4>4</h4>
    </div>
    <div class="one box"><h4>5</h4>
    </div>
    <div class="quarter box e"><h4>1/3</h4>
    </div>
    <div class="quarter box"><h4>1/4</h4>
    </div>
    <div class="quarter box"><h4>1/4</h4>
    </div>
    <div class="quarter box"><h4>1/4</h4>
    </div>
    <div class="quarter box"><h4>1/4</h4>
    </div>
</section>

http://i.imgur.com/QkfnlmD.png It weels like it would give me more control but harder to make site responsive?

alanaasmaa left a reply on Lost Grid | What Im Doing Wrong ?

Not really

CSS:

@lost flexbox flex;
@lost gutter 15px;

.container {
  lost-center: 1140px;
  lost-utility: clearfix;
  lost-flex-container: row;
}
.box {
  margin-top: 10px;
  background-color: white;
  box-shadow: 1px 1.732px 5px 0px rgba(4,5,6,.2);
  padding: 15px;
  //box-sizing: border-box;
  word-wrap: break-word;
}

HTML:

<section class="container">
    <div class="half box"><h4><span>Half is a bit smaller</h4></span>
    <p>These 1/3 should be on the same line</p>
    </div>
    <div class="half">
        <div class="quarter box"><h4><span>1/3</h4></span>
        </div>
        <div class="quarter box"><h4><span>1/3</h4></span>
        </div>
    </div>
</section>

This fixes my problem but i think its not good that every div has display: flex;. If i add display: flex; to .container or .box or .half it wont fix.

div {
  display:flex;
}

I got it working by making a class .nest . Is this a good practice ?

//CSS
.nest {
  display:flex;
}

//HTML
    <div class="half nest">
        <div class="half box"><h4>1/3</h4>
        </div>
        <div class="half box"><h4>1/3</h4>
        </div>
    </div>

alanaasmaa started a new conversation Lost Grid | What Im Doing Wrong ?

Hello, I would like to build a boxy layout. But i'm having a hard time to understand lost and flexbox.

My boxes get sometimes messy and i don't understand why they are not on the right line or position. And it weels like they are not expanding right sometimes. For example these 1/3 boxes on the image should be next to each other. http://i.imgur.com/29pWb17.png

You can check my code @ https://bitbucket.org/AlanAasmaa/cv

Also if you see any other mistakes or not so good code please tell me. I would like to learn the best way possible. And Lost Grid looks awesome if you master it with flexbox. It weels amazing i just don't know how to use it.

21 Jun
3 years ago

alanaasmaa left a reply on Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

Finally got it working my manually editing package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.0.0",
    "gulp": "^3.9.1",
    "laravel-elixir": "^6.0.0-4",
    "laravel-elixir-stylus": "^2.0.2",
    "laravel-elixir-stylus-bundle": "^1.2.1"
  }
}

13 Jun
3 years ago

alanaasmaa left a reply on Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

Okei got it working. I copyed my node directory from other project.

alanaasmaa left a reply on Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

@bobbybouwmann okei now when i restarted homestead/vagrant i get new error

[email protected]:~/Code/hiphop$ gulp watch
module.js:340
    throw err;
    ^

Error: Cannot find module 'laravel-elixir'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/vagrant/Code/hiphop/gulpfile.js:1:76)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:36

I did npm install again and now i get again same error

[email protected]:~/Code/hiphop$ gulp
module.js:340
    throw err;
    ^

Error: Cannot find module 'laravel-elixir/dist/tasks/CssTask'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/vagrant/Code/hiphop/node_modules/laravel-elixir-stylus/index.js:1:77)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

But when i try with my other project it works.. I try to copy node folder from there.

[email protected]:~/Code/Laravel$ gulp
[13:25:56] Using gulpfile ~/Code/Laravel/gulpfile.js
[13:25:56] Starting 'default'...
[13:25:56] Starting 'stylus'...

Fetching Stylus Source Files...
   - resources/assets/stylus/app.styl


Saving To...
   - public/css/app.css

[13:26:26] Finished 'default' after 30 s
[13:26:28] gulp-notify: [Laravel Elixir] Stylus Compiled!
[13:26:28] Finished 'stylus' after 32 s
[13:26:28] Starting 'stylus'...

Fetching Stylus Source Files...
   - resources/assets/stylus/blog.styl


Saving To...
   - public/css/blog.css

[13:26:29] gulp-notify: [Laravel Elixir] Stylus Compiled!
[13:26:29] Finished 'stylus' after 211 ms
[13:26:29] Starting 'stylus'...

Fetching Stylus Source Files...
   - resources/assets/stylus/admin.styl


Saving To...
   - public/css/admin.css

[13:26:29] gulp-notify: [Laravel Elixir] Stylus Compiled!
[13:26:29] Finished 'stylus' after 134 ms
[13:26:29] Starting 'stylus'...

Fetching Stylus Source Files...
   - resources/assets/stylus/lightslider.styl


Saving To...
   - public/css/lightslider.css

[13:26:29] gulp-notify: [Laravel Elixir] Stylus Compiled!
[13:26:29] Finished 'stylus' after 355 ms
[13:26:29] Starting 'version'...

Fetching Version Source Files...
   - public/css/app.css
   - public/css/blog.css
   - public/css/admin.css


Saving To...
   - public/build

[13:26:29] Finished 'version' after 107 ms
[13:26:29] Starting 'scripts'...

Fetching Scripts Source Files...
   - resources/assets/js/components/*.js
   - resources/assets/js/app.js


Saving To...
   - public/js/all.js

[13:26:38] gulp-notify: [Laravel Elixir] Scripts Merged!
[13:26:38] Finished 'scripts' after 8.53 s
[13:26:38] Starting 'scripts'...

Fetching Scripts Source Files...
   - resources/assets/js/lightslider.js


Saving To...
   - public/js/lightslider.js

[13:26:38] gulp-notify: [Laravel Elixir] Scripts Merged!
[13:26:38] Finished 'scripts' after 134 ms
[13:26:38] Starting 'browserSync'...
[13:26:38] Finished 'browserSync' after 173 μs
[email protected]:~/Code/Laravel$

alanaasmaa left a reply on Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

@bobbybouwmann Wow thanks, how i didn't come up with this myself ! Thank you very much again !

alanaasmaa left a reply on Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

@bobbybouwmann Yes same error

And i havent used rupture i plan to use it seems useful. https://www.npmjs.com/package/rupture

alanaasmaa started a new conversation Cannot Find Moudle 'laravel-elixir/dist/tasks/csstask'

Hello, I havent worked with laravel for a long time and now i started to learning it again.

I created a new project and istalled gulp and stylus. But if i run gulp or gulp watch i get a error

[email protected]:~/Code/hiphop$ gulp
module.js:340
    throw err;
    ^

Error: Cannot find module 'laravel-elixir/dist/tasks/CssTask'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/home/vagrant/Code/hiphop/node_modules/laravel-elixir-stylus/index.js:1:77)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
[email protected]:~/Code/hiphop$

My Package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "bootstrap-sass": "^3.0.0",
    "gulp": "^3.9.1",
    "laravel-elixir": "*",
    "laravel-elixir-stylus": "^2.0.2"
  }
}

My gulpfile

var elixir = require('laravel-elixir');
var rupture = require('rupture');

require('laravel-elixir-stylus');

elixir.config.sourcemaps = true;

elixir(function(mix) {

    mix
    .stylus('app.styl', null, {
        use: [
            require('poststylus')(['lost']), rupture()
        ]
    })

    .version([
        'css/app.css'
    ])

    .scripts([
        'app.js'
    ])

    .browserSync({ 
        proxy: 'hiphop.dev',
        notify: false
    });
});

Thanks !

19 Feb
3 years ago

alanaasmaa left a reply on Can't Connect To Laravel.dev (Homestead)

Got it to work. I had port forwared somehow wrong. Opened Oracle VM and edited them there. Thanks all !

17 Feb
3 years ago

alanaasmaa left a reply on Can't Connect To Laravel.dev (Homestead)

@DPJack i use 192.168.150.10 and its also in hosts file

alanaasmaa left a reply on Can't Connect To Laravel.dev (Homestead)

@JoeDawson you mean restart or reload ?

alanaasmaa started a new conversation Can't Connect To Laravel.dev (Homestead)

Hello, so i have had this problem for a while. Todally randomlly i am not anymore able to connect my website.

I used to conenct with laravel.dev (I didn't had to use any port). Everything worked well. I use Oracle VM Virtualbox and all settings seems to be allright. My homestead conf seems to be allright. My nginx settings seem to be fine.

Google chrome gives me ERR_CONNECTION_TIMED_OUT I cant ping this ip but i can connect via SSH

Also even if i try laravel.dev:8000 <- nothing.

If i do gulp watch and try to connect with browserfy ips still nothing. Local: http://localhost:3000 External: http://10.0.2.15:3000

Also hostfile is okei.

Weirdest thing is that i can still connect to MySQL and SSH MySQL i connect with localhost 33060

Anyone knows how to fix this ?

EDIT: i just did http://127.0.0.1:8000/ and it connected.

EDIT2: I just restarted vagrant and now 127.0.0.1:8000 gives ERR_CONNECTION_REFUSED and laravel.dev gives ERR_CONNECTION_TIMED_OUT

Maybe something wrong with homestead ports ? Can someone send me default configs.

13 Jan
3 years ago

alanaasmaa left a reply on Laravel 5.2 Image Upload, Correct Name On Database.

From series http://laravelcoding.com/blog/laravel-5-beauty-the-10-minute-blog

I use, i dont know if there is any help but here:

  public function uploadFile(UploadFileRequest $request)
  {
    $file = $_FILES['file'];
    $fileName = $request->get('file_name');
    $fileName = $fileName ?: $file['name'];
    $path = str_finish($request->get('folder'), '/') . $fileName;
    $content = File::get($file['tmp_name']);

    $result = $this->manager->saveFile($path, $content);

    if ($result === true) {
      return redirect()
          ->back()
          ->withSuccess("File '$fileName' uploaded.");
    }

    $error = $result ? : "An error occurred uploading file.";
    return redirect()
        ->back()
        ->withErrors([$error]);
  }

alanaasmaa started a new conversation Best Way To Handle Routes ?

There is so many ways to handle routes in laravel. I cant decide how and what way should i use.

This is my routes file right now. I'd like to clean this up. Should i use controllers or resources or both ?

I wanna only learn best ways to do stuff that's easy to read and simple to modify/upgrade/expand. There were not much information in google.

<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['middleware' => 'web'], function () {
    Route::auth();
    // MISC ROUTES
    Route::get('/', 'PagesController@index');
    Route::get('terms-of-service', 'PagesController@terms');
    Route::get('privacy', 'PagesController@privacy');
    Route::get('combo', 'PagesController@combo');
    // BLOG ROUTES
    Route::get('blog', 'BlogController@index');
    Route::get('blog/{slug}', 'BlogController@showPost');
    // USER PAGE ROUTES - RUNNING THROUGH AUTH MIDDLEWARE
    Route::group(['middleware' => 'auth'], function () {
        // INCEPTIONED MIDDLEWARE TO CHECK TO ALLOW ACCESS TO CURRENT USER ONLY
        Route::group(['middleware' => 'currentUser'], function () {
            Route::resource('profile','ProfilesController', ['only' => ['show','edit','update']]);
        });
        Route::get('profile/{username}', ['as' => '{username}', 'uses' => 'ProfilesController@show']);
        Route::get('dashboard/profile/{username}', ['as' => '{username}','uses' => 'ProfilesController@show']);
        // ADMIN ROUTES - RUNNING THROUGH AUTH MIDDLEWARE & ADMIN NAMESPACE
        Route::group(['namespace' => 'admin'], function () {
            Route::resource('admin/post', 'BlogPostController', ['except' => 'show']);
            Route::resource('admin/tag', 'BlogTagController', ['except' => 'show']);
            Route::get('admin/upload', 'UploadController@index');
            Route::post('admin/upload/file', 'UploadController@uploadFile');
            Route::delete('admin/upload/file', 'UploadController@deleteFile');
            Route::post('admin/upload/folder', 'UploadController@createFolder');
            Route::delete('admin/upload/folder', 'UploadController@deleteFolder');
        });
    });
    // ADMINISTRATOR ACCESS LEVEL PAGE ROUTES - RUNNING THROUGH ADMINISTRATOR MIDDLEWARE
    Route::group(['middleware' => 'administrator'], function () {
        // TEST ROUTE ONLY ROUTE
        Route::get('administrator', function () {echo 'Welcome to your ADMINISTRATOR page '. Auth::user()->email .'.';});
    });
    // EDITOR ACCESS LEVEL PAGE ROUTES - RUNNING THROUGH EDITOR MIDDLEWARE
    Route::group(['middleware' => 'editor'], function () {
        //TEST ROUTE ONLY
        Route::get('editor', function () {echo 'Welcome to your EDITOR page '. Auth::user()->email .'.';});
    });
    // AUTHENTICATION ALIASES/REDIRECTS
    Route::controllers([
        'auth'      => 'Auth\AuthController',
        'password'  => 'Auth\PasswordController',
    ]); 
    // REGISTRATION EMAIL CONFIRMATION ROUTES
    Route::get('/resendEmail', 'Auth\AuthController@resendEmail');
    Route::get('/activate/{code}', 'Auth\AuthController@activateAccount');
    // LARAVEL SOCIALITE AUTHENTICATION ROUTES
    Route::get('/social/redirect/{provider}', [
        'as'    => 'social.redirect',
        'uses'  => 'Auth\AuthController@getSocialRedirect'
    ]);
    Route::get('/social/handle/{provider}', [
        'as'    => 'social.handle',
        'uses'  => 'Auth\AuthController@getSocialHandle'
    ]);
    Route::get('login', function () {return redirect('auth/login');});
    Route::get('logout', function () {return redirect('auth/logout');});
    Route::get('register', function () {return redirect('auth/register');});
});
12 Jan
3 years ago

alanaasmaa left a reply on Gulpfile.js Is There Better (Shorter) Way Do To All This ?

@retake i tryed it but i dont want the mixing of stylus files. I want them to be different. This way it makes only one app.css

Put thanks for reply :)

alanaasmaa started a new conversation Gulpfile.js Is There Better (Shorter) Way Do To All This ?

So my gulfile looks like this:

var elixir = require('laravel-elixir');
var rupture = require('rupture');

require('laravel-elixir-stylus');

elixir.config.sourcemaps = true;

elixir(function(mix) {

    mix.stylus('app.styl', null, {
            use: [
                require('poststylus')(['lost']), rupture()
            ]
    });
    mix.stylus('blog.styl', null, {
            use: [
                require('poststylus')(['lost']), rupture()
            ]
    });
    mix.stylus('admin.styl', null, {
            use: [
                require('poststylus')(['lost']), rupture()
            ]
    });

    mix.version([
        'css/app.css',
        'css/blog.css',
        'css/admin.css'
    ]);

    mix.scripts([
        'app.js'
    ]);

    mix.browserSync({ 
        proxy: 'laravel.dev',
        notify: false
    });
});

Is there better/faster or simpler way to do all this ?

I'd like to geep my site as small as possible.

For my base i use app.style For admin site i use admin.style And for blog i use app.style and blog.styl. I use 2 css for blog becose every catecroy will look different so i dont want users that use example only Forum ( coming soon with different forum.styl later) do download everything.

I try to keep my page size as small as possible. I wanna make my first project to wow other peoples. Im only using https://html5boilerplate.com/. Is there any other good small frameworks/tips/tricks every site should use.

My design uses lost framework. It's pretty hard to learn everything but i think im doing pretty good job.

11 Jan
3 years ago

alanaasmaa left a reply on Lost Grid Tutorials Or Examples ?

I did something like that now i have two problems i cant defeat.

  1. I cant get #right id get actually to right side
  2. I have some weird empty space in front of my dropdown. image: http://snag.gy/Q9vuw.jpg
.topnav {
    lost-utility: clearfix;
    border-bottom 3px solid #D9D9D9
    .logonav {
        lost-column: 2/12
        height: 60px;
        line-height: 60px;
        font-size: 22px;
        font-weight: 900;
        text-transform: uppercase;
    }
    nav {
        position: relative;
        
        &:first-child {
            lost-column: 7/12
        }
        &:last-child {
            lost-column: 3/12
        }       
        li {
            list-style: none;
            display: inline-block;
            float: left;
            
            &[class^="active"] {
                border-bottom: 3px solid;
                border-color: #0066CC;

                &>a:hover {
                    border-bottom: 0 !important;
                }
            }
            &>a {
                position: relative;
                display: inline-block;
                padding: 0 10px;
                line-height: 40px;
                height: 40px;

                &:hover {
                    border-bottom: 3px solid;
                    border-color: #0066CC;
                }
                &.active {
                    border-bottom: 3px solid;
                    border-color: #0066CC;
                }
                &[class^="trigger-"] {
                    padding-right: 0px;
                }
            }
        }
    }
    #right {
    float: right !important;
    
    li {
        ul {
            display: none;
            position: absolute;
            left: 0;
            margin: 0;
            background: #fff;
            border-radius: 2px;
            z-index: 1000;
            >li {
                    clear: both;
                    list-style: none;
                    display: block;
                    padding: 0 10px;
                    margin: 0;
                    width: 100%;
                }
        }
        &:hover ul{
            display: block;         
        }
    }
}
}
    
    
.navimg {
        width : 40px;
        vertical-align: middle;
        border-radius: 50%;
}
<div class="topnav">
  <section class="container">
    <div class="logonav">
      <a href="/" class="logo">NAME</a>
    </div>
      <nav id="main">
        <ul>
          <li class="{{ Request::segment(1) === '/' ? 'active' : null }}"><a href="/">Home</a></li>
          <li class="{{ Request::segment(1) === 'blog' ? 'active' : null }}"><a href="{{ url('blog' )}}">Blog</a></li>
        </ul>
      </nav>
      <nav id="right">
        @if (Auth::check())
          <li><a href="/profile/{{ Auth::user()->name}}">{{ Auth::user()->name }} <i class="fa fa-arrow-down"></i></a>
            <ul>
              <li><a href="/profile/{{ Auth::user()->name}}">My Profile</a></li>
              <li><a href="/logout">Logout</a></li>
            </ul>
            <img class="navimg" src="{{ Gravatar::src(Auth::user()->email, 40)  }}">
          </li>
        @else 
        <ul>
          <li><a href="/login">Login</a></li>
          <li><a href="/register">Register</a></li>
        </ul>
        @endif
      </nav>
  </section>
</div>