darknesseyes

darknesseyes

Member Since 3 Years Ago

Experience Points 18,365
Experience Level 4

1,635 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 187
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

24 Feb
2 years ago

darknesseyes left a reply on Ideas Or Best And Easiest Way To Make Timetable For My School Management System

is there anything wrong with my question? 8 hours no answer?

darknesseyes started a new conversation Ideas Or Best And Easiest Way To Make Timetable For My School Management System

I am a teacher programming a school management system for my school and I created CRUD for all tables with their relationship

#users [name-email-api_token-password] #roles [name-label] #permissions. [name-label] #students [name-academic_id] #sections [name] #subjects [name] #halls [name] #Days [name - order] five days a week. [1-2-3-4-5-6] #periods [name - order - start - end ] seven periods a day.[1-2-3-4-5-6-7]

Now I want to make a timetable

I’m thinking to make a table called “timetable” #timetable with fields [ day_order - period_order - user_id -hall_id]

And then create components with vuejs as follows:

1- [cell] component {has its own day_order and period_order based on its position in timetable component. The cell component will get the user_id from teachers droplist and make ajax call to larval with [user_id,day_order, period_order ] -fetch the result -And display the subject name and the hall name in the cell If there is no result for query then the cell will be empty

2- [timetable] component displays cell components in a table

|| teachers droplist || —————————————————————

   |Period 1            | period 2. |. period 3  |  period 4   | ..etc             

============================================================================================ Sun | cell component | cell 1.2 | cell 1.3 | cell 1.4 | cell 1.5 | ============================================================================================ Mon | cell component | E-3 H102 | cell | cell | cell | =================================================================================== Tues | cell component | cell | cell | cell | cell | =================================================================================== Wed | cell component | cell | E-3 H103. | cell | cell | =================================================================================== Thur | cell component | cell | cell | cell | cell | ===================================================================================

is this a good idea or there is a simpler and easier way to do it ?

30 Jan
2 years ago

darknesseyes started a new conversation I Can't Load Styles And Js Files In All My Laravel Application

I extracted header in a partial called head.blade.php which contain link to my stylesheet

<!-- Bootstrap Core Css --> <link href="{{ADMIN}}plugins/bootstrap/css/bootstrap.css" rel="stylesheet"> in routes/web.php I defined a constant ADMIN

define('ADMIN','admin/');

my admin master page looks like the following

` @include('layouts.head')

@include('layouts.page_loader')

 @yield('top_bar')

@include('layouts.sidebar')

@include('layouts.right_sidebar') @yield('dashboard')

@include('layouts.footer') ` now when I login and redirected to home page, everything works fine when I navigate to roles/index , everything works fine but when I navigate to roles/1 everything breaks the link to stylesheet becomes ' http://localhost:8000/roles/admin/plugins/boostrap/css/bootstrap.css

` roles is added to url

I tried in routes/web.php

define('ADMIN', public_bath('admin/')); but everything breaks down, getting this result

file:///C:/Users/sultan/lama/public/admin/plugins/boostrap/css/bootstrap.css

how to fix it ??

08 Dec
3 years ago

darknesseyes left a reply on How To Query A Table With Multiple Ids From Other Tables ?

I think I'll redesign my tables and their relationships

i'm thinking to make one to many relationship between levels and matches and then many to many relationship between players and matches

class Level extends Model
{
    /**
     * // the level can have many matches
     */
    public function matches()
    {
        return $this->hasOne(‘App\Match');
    }
}

class Match extends Model { /** * Get the level for this match. */ public function level() { return $this->belongsTo(‘App\Level'); } }

many to many between players and matches

class Match extends Model { /** * . */ public function players() { return $this->belongsToMany('App\Player'); } }


class Player extends Model { /** * . */ public function matches() { return $this->belongsToMany('App\Match'); } }

darknesseyes left a reply on How To Query A Table With Multiple Ids From Other Tables ?

@ralee thanks yes, it worked but I got an array with two arrays inside

array:2 [▼
  0 => array:10 [▼
    "id" => 1
    "title" => "LEVEL ONE"
    "date" => "2015-12-13 00:00:00"
    "level_id" => 1
    "player_one" => 3
    "player_two" => 5
    "created_at" => "2015-12-07 07:38:56"
    "updated_at" => "2015-12-07 07:38:56"
    "name" => "John"
    "age" => 34
  ]
  1 => array:10 [▼
    "id" => 1
    "title" => "LEVEL ONE"
    "date" => "2015-12-13 00:00:00"
    "level_id" => 1
    "player_one" => 3
    "player_two" => 5
    "created_at" => "2015-12-07 07:38:56"
    "updated_at" => "2015-12-07 07:38:56"
    "name" => "darknesseyes"
    "age" => 34
  ]
]

i don't know but I feel that there is a better way , instead of having two arrays , I want only one array. easier to iterate through and get result.

darknesseyes left a reply on How To Query A Table With Multiple Ids From Other Tables ?

@ralee I tried that but I got this

SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'players' (SQL: select `matches`.*, `players`.`name`, `players`.`age`, `levels`.`title` from `matches` inner join `players` on `players`.`id` = `matches`.`player_one` inner join `players` on `players`.`id` = `matches`.`player_two` inner join `levels` on `levels`.`id` = `matches`.`level_id` limit 1)

darknesseyes left a reply on How To Query A Table With Multiple Ids From Other Tables ?

yes only two players per match. yes of course I have read laravel docs and watched many series of laracasts . I know how to use many to many relatioships and one to one , one to many

that's why I tried => join

I don't know what kind of relationship when you have table like this matches id player_one // it is an id from players table player_two // it is an id from players table level_id

07 Dec
3 years ago

darknesseyes started a new conversation How To Query A Table With Multiple Ids From Other Tables ?

I have the following tables

players with fields [name - age] levels with fields [ title - from_date - to_date] matches with fields [title - player_one - player_two - level_id - date] where => player_one represents an id of a player from players table as well as player_two

how to query the names of player_one ,player_two and also the title of levels

I tried -> join

but I couldn’t get the name of player_two

this is my code

public function index()
{

 $matches = Match::join('players', 'players.id', '=', 'matches.player_one')
                     ->join('levels', 'levels.id', '=', 'matches.level_id')
                     ->select('matches.*', 'players.name','players.age','levels.title')
                     ->get()->toArray();
        dd($matches);
return view('matches.index', compact('matches'));
}
29 Nov
3 years ago

darknesseyes started a new conversation How To Delete A File Or A Photo From The Folder When Deleting It From Database?

I want when I delete a file or a photo from the database to be deleted also from the folder

how to do that in laravel?

darknesseyes left a reply on Admin Middleware Problem

thank you guys for the explanation, now I understand how the middleware works, i'll practise more on that . I really appreciate the help, Thanks again

darknesseyes left a reply on Admin Middleware Problem

I really need help

darknesseyes left a reply on Admin Middleware Problem

public function handle($request, Closure $next) {

if($this->auth->check()){

if(Auth::user()->hasRole('admin')){
     return redirect('users');
    
   }else{

return redirect('home');

}

} return $next($request); }

i got error This webpage has a redirect loop

ERR_TOO_MANY_REDIRECTS

darknesseyes left a reply on Admin Middleware Problem

okay good but how ?

darknesseyes started a new conversation Admin Middleware Problem

#project Problems

#4

How to protect these routes

users roles permissions groups

by using admin middleware ?

I created Admin middleware

I added these lines to kernel.php

    \App\Http\Middleware\Admin::class,


    'admin' => \App\Http\Middleware\Admin::class,

this is my admin middleware

namespace App\Http\Middleware;

use Closure; use Illuminate\Contracts\Auth\Guard; use Auth;

class Admin { /** * The Guard implementation. * * @var Guard */ protected $auth;

/**
 * Create a new filter instance.
 *
 * @param  Guard  $auth
 * @return void
 */
public function __construct(Guard $auth)
{
    $this->auth = $auth;
}

/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Closure  $next
 * @return mixed
 */
public function handle($request, Closure $next)
{

if(Auth::user()->hasRole('admin')){

return redirect('home');

}

return $next($request);

}

}

when I logout I get this error

FatalErrorException in Admin.php line 39:Call to a member function hasRole() on a non-object

in Admin.php line 39

really I couldn’t understand the middleware this

these are the routes

Route::group(['middleware' => 'admin'], function() { Route::resource("permissions","PermissionController"); Route::resource("roles","RoleController"); Route::resource("groups","GroupController"); Route::resource("users","UserController"); });

21 Nov
3 years ago

darknesseyes left a reply on How To Use Hashids Class With Laravel ?

I got this error when I updated the composer

  • mitch/hashids 1.0 requires illuminate/support 4.x -> satisfiable by illuminate/support[v4.0.0, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
  • don't install illuminate/support v4.1.8|don't install laravel/framework v5.1.0

I think it supports only laravel 4 not 5.1

darknesseyes started a new conversation How To Use Hashids Class With Laravel ?

this the link on github

https://github.com/ivanakimov/hashids.php

how can I use it with laravel or if there is any alternative way to hash ids

19 Nov
3 years ago

darknesseyes started a new conversation FatalErrorException In MemberController.php Line 85:Call To A Member Function GetClientOriginalName() On A Non-object

#project Problems

#1

I can’t upload and image

here is my html code :

            <div class="form-group">
           {!! Form::label('avatar','upload one image:') !!}
           {!! Form::file('avatar',['class'=>'form-control']) !!}
                
           @if($errors->has("avatar"))
           <span class="help-block">{{ $errors->first("avatar") }}</span>
           @endif
            </div>

the controller method store :

public function store(MemberRequest $request) { $avatar = $request->file("avatar”);

    $name = time().$avatar->getClientOriginalName();

}

when I submit the form i get this error

FatalErrorException in MemberController.php line 85:Call to a member function getClientOriginalName() on a non-object

I tried If($request->hasFile($avatar){

return “I have the file “; } else{ return “Error”; }

when I submit the form the page displays the word Error

I tried var_dump($avatar);

the page displays NULL

what’s wrong with my code?

17 Oct
3 years ago

darknesseyes left a reply on Fetch Associative Array From Pivot Table And Pass It To View ?

this is exactly what I need , thank you so much

16 Oct
3 years ago

darknesseyes started a new conversation Fetch Associative Array From Pivot Table And Pass It To View ?

Hi everyone, I'm really stuck

I have two tables

groups id title

subjects id title

group_subject group_id subject_id

how can I fetch associative array , pass it to view and iterate to make

menu with submenu

group 1 -math -art

group 2 -chemistry -physics