Webiondev123

Experience

1,320

0 Best Reply Awards

  • Member Since 1 Week Ago
  • 5 Lessons Completed
  • 0 Favorites

21st November, 2017

Webiondev123 left a reply on What Exactly Is Bootstrapping In Laravel? • 4 hours ago

I see bootstrap occurs at many level of laravel... Does the term mean creating instance?

Webiondev123 started a new conversation What Exactly Is Bootstrapping In Laravel? • 14 hours ago

Please explain with an example

Webiondev123 started a new conversation Return Url Vs Redirect To Url Vs Generate Url • 20 hours ago

In Laravel What is difference between generating URL,returning URL that is views and ridercting to URL?

20th November, 2017

Webiondev123 started a new conversation Understanding Laravel DB::table VS Eqloquent Return Type • 1 day ago

Ok, I am getting a lot of error while working on Laravel database. Now there are two ways: Query builder and Eloquent. I want to know what is the return data type of query builder vs eloquent and how can I access these?

Thanks

18th November, 2017

Webiondev123 left a reply on What Kind Of OOP Concept Is This? • 3 days ago

Cronix thanks but I see the handle method is in Class Frameguard but the above example didn’t even instantiate Frameguard Class. Am I correct to say Laravel does not follow oop syntax?

Webiondev123 started a new conversation What Kind Of OOP Concept Is This? • 3 days ago

What is this Closure $next. Ok I am guessing an object but how a object reference accepts an argument $request? Shouldn’t it call method. Closure in pup are anonymous function but is it that the next is an anonymous function variable defined else where? What’s going on

public function handle($request, Closure $next)
    {
        if ($request->age <= 200) {
            return redirect('home');
        }

        return $next($request);
    }

Webiondev123 started a new conversation How Can I Join These Three Tables? • 3 days ago

How can I execute this sql query in laravel?

  SELECT * FROM `examination` WHERE `id` in (select `exam_id` from
 `exam_supervision`  where `lecturer_id` in (select `id` from `lecturers` where `id`=1));
Laravel seems so confusin. Can anyone please give me the exact laravel query?

thanks

17th November, 2017

Webiondev123 left a reply on Find All The Examinations Taken By A Lecturer ? • 4 days ago

How do I find the examinations based on lecturer id? Shouldn't I pass an id?

Webiondev123 started a new conversation Find All The Examinations Taken By A Lecturer ? • 4 days ago

Ok. I have three database:

examination. pk id lecturers. pk id exam_supervision: fk lecturer_id and exam_id

I want to join these tables to find all exam taken by the lecturer.

So if I implement hasMany method in examination and lecturer model:

examination model class:

 public function supervised()
    {
        return $this->hasMany('exam_supervision');
    }

lecturer model class:

 public function supervises()
    {
        return $this->hasMany('exam_supervision');
    }

then should I do this?


$examinationByLecturer = Exam_supervision::with('examination','lecturers, )->get();


I am confused about laravel syntax. Very confusion

15th November, 2017

Webiondev123 left a reply on Accessing Arrays • 6 days ago

Thanks

Webiondev123 started a new conversation Undefined Offset In Laravel • 6 days ago

I am trying to upload file. Here is my database

id
module_id
name
file
category
ext
size

Here is model:

<?php namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ModuleMaterials extends Model {

    public $timestamps = false;

    protected $table = 'module_materials';

    protected $fillable = ['module_id', 'file', 'category', 'name', 'ext', 'size'];

    /*
    |--------------------------------------------------------------------------
    | SCOPE SECTION
    |--------------------------------------------------------------------------
    */

    public function scopeForModule($query, $id)
    {
        return $query->where('module_id', $id);
    }

here is file upload:

 $name = Input::get('name');
    $ext = Input::get('ext');
    $module_id = Input::get('module_id');
    $category = Input::get('category');

    $file = $name.'.'.$ext; //str_random(12);
    $path = str_replace("\laravel\dev.oasis-portal.my","\dev.oasis-portal.my",base_path()).'\files\'.$module_id.'\'.$file;

    $data = Request::get('file');

    


    //if(File::makeDirectory(public_path().'\'.'TEST', 0777,true))

     

    list($type, $data) = explode(';', $data);
    list(, $data)      = explode(',', $data);

    $data = base64_decode($data);

    if (!is_dir(str_replace("\laravel\dev.oasis-portal.my","\dev.oasis-portal.my",base_path()).'\files\'.$module_id)) {

      File::makeDirectory($path,0777,true);
    }

    //Write to File
    $check = file_put_contents($path, $data);


  

    $fileinformation = array( 'module_id' => $module_id, 'name' => $name, 'file' => $file, 'category' => $category, 
       'ext' => $ext, 'size'=> strlen($data) );

.....

Here is error:


ErrorException in LecturerController.php line 293:
Undefined offset: 1
in LecturerController.php line 293
at HandleExceptions->handleError('8', 'Undefined offset: 1', 'C:\wamp64\www\oasis_portal\laravel\dev.oasis-portal.my\app\Http\Controllers\LecturerController.php', '293', array('name' => 'taskgroup', 'ext' => 'txt', 'module_id' => '46', 'category' => 'Lectures', 'file' => 'taskgroup.txt', 'path' => 'C:\wamp64\www\oasis_portal\dev.oasis-portal.my\files\taskgroup.txt', 'data' => 'data:', 'type' => 'data:')) in LecturerController.php line 293

Webiondev123 started a new conversation Accessing Arrays • 6 days ago

I have this array in angular

$scope.credentials.usergroups = data; //gets data from server How can I access this for specific values. I need to send to server?

this is data:

 console.log( $scope.credentials.description);

 output:

{usergroups: Array(1), title: "how to read the degree in ERD?", group_id: "1", date: Wed Nov 29 2017 00:00:00 GMT+0800 (U Peninsula Standard Time), file: "data:;base64,LyoNCk5hdmljYXQgTXlTUUwgRGF0YSBUcmFuc…zDQotLSAtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQo="}
date
:
Wed Nov 29 2017 00:00:00 GMT+0800 (Malay Peninsula Standard Time)
__proto__
:
Object
file
:
"data:;base64,[garbage]
group_id
:
"1"
title
:
"how to read the degree in ERD?"
usergroups
:
Array(1)
0
:
{id: 1, name: "taskgroup", $$hashKey: "object:342"}
length
:
1
__proto__
:
Array(0)
__proto__
:
Object

14th November, 2017

Webiondev123 started a new conversation How Can I Set The First Page In Laravel? • 1 week ago

I set up new project blog. Now when i do localhost/blog/public it gives laravel text. I want to set up my own welcome page. Do I need to do something in apache httpd-vhost?

How then?

Thanks

Webiondev123 left a reply on Where Do I Find Some Of The Laravel Class Declarations/definitions • 1 week ago

traits in laravel folders?

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

Thanks man. Can you please tell me how can I learn how these php request and response interact..This laravel does not make much sense to me

Webiondev123 started a new conversation Where Do I Find Some Of The Laravel Class Declarations/definitions • 1 week ago

Ok in Authcontroller I have some protected methods but that means in OOP terms it must be defined/declared in Controller class but when I visit Controller.php in Routing.php I cannot find any of those protected names. What am I missing?

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

What I am doing i a way around but better if I get the locked message out there


 {
    if (Auth::User()->status=='lock') {

        Auth::user()->email="/222";
        auth()->logout();
        return back()->with('warning', 'Your account is locked');
    }

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

Thanks...Its not logging in but no message being sent...here is my login.blade.php I need a message to come when locked user tries to log in


<form class="box login form_total_inner" method="post" action="<% url('/login') %>">
    
    <input type="hidden" name="_token" value="<% csrf_token() %>">
    
    <fieldset class="boxBody">
    <div class="boxBody_inner">
      <!--<label>Username </label>-->
      <label><i class="fa fa-user" aria-hidden="true"></i><!--Username--></label>
      <input name="email" type="text" tabindex="1" placeholder="University ID" required> </div>
      <div class="boxBody_inner"><label><i class="fa fa-unlock" aria-hidden="true" ></i><!--Password--></label>
      <!--<label><a href="#" placeholder="Password"  class="rLink" tabindex="5">Forget your password?</a>Password</label> -->
      <input name="password"  placeholder="Password" type="password" tabindex="2" required></div>
    <!--<a href="#" class="rLink" tabindex="5">Forget your password?</a>-->
    </fieldset>

    <fieldset>


    

     
        @if($errors->has('password'))
        <div class="panel-body lgn_bdy">
                <span class="help-block">
                    <strong class="lgn_error"><% $errors->first('password')  %></strong>
                    
                </span>
            </div>
            @endif
        

        @if($errors->has('email'))
        <div class="panel-body lgn_bdy">
                <span class="help-block">
                    <strong class="lgn_error"><% $errors->first('email') %> Or your password has been locked. Contact admin</strong>
                    
                </span>
            </div>
            @endif

        
    </fieldset>

    <footer>
      <label><input type="checkbox" tabindex="3">Keep me logged in</label>
      <center><input type="submit" class="btnLogin" value="Login" tabindex="4"></center>
    </footer>


Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago


namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Auth\AuthController;

use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Auth;

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/';

    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => 'logout']);
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|confirmed|min:6',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return User
     */
    protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }

  protected function authenticated(Request $request, $user)
   {
    if ($user->status=='lock') {
        auth()->logout();
        return back()->with('warning', 'Your account is locked');
    }
    return redirect()->intended($this->redirectPath());
   }



}

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

namespace App\Http\Controllers\Auth; use App\Http\Controllers\Auth\AuthController;

use App\User; use Validator; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers; use Auth;

class AuthController extends Controller {

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

/**
 * Where to redirect users after login / registration.
 *
 * @var string
 */
protected $redirectTo = '/';

/**
 * Create a new authentication controller instance.
 *
 * @return void
 */
public function __construct()
{
    $this->middleware('guest', ['except' => 'logout']);
}

/**
 * Get a validator for an incoming registration request.
 *
 * @param  array  $data
 * @return \Illuminate\Contracts\Validation\Validator
 */
protected function validator(array $data)
{
    return Validator::make($data, [
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|confirmed|min:6',
    ]);
}

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return User
 */
protected function create(array $data)
{
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);
}

protected function authenticated(Request $request, $user) { if ($user->status=='lock') { auth()->logout(); return back()->with('warning', 'Your account is locked'); } return redirect()->intended($this->redirectPath()); }

}

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

Ramjith its giving me this error

FatalThrowableError in AuthController.php line 74: Type error: Argument 1 passed to App\Http\Controllers\Auth\AuthController::authenticated() must be an instance of App\Http\Controllers\Auth\Request, instance of Illuminate\Http\Request given, called in C:\wamp64\www\oasis_portal\laravel\dev.oasis-portal.my\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php on line 102

Webiondev123 left a reply on Use Logged In User Info In Login.blade.php • 1 week ago

Actually the code I am working on was written by someone else. He put aSessionguard.php function called login in the form action field. When the user submits it the login function is triggered. I do not know how to capture the user info to do some checking?

Webiondev123 started a new conversation Namespace Vs Use? • 1 week ago

What is the purpose of namespace and use. Are they both equivalent to import and include? Please explain

Thanks

13th November, 2017

Webiondev123 started a new conversation Use Logged In User Info In Login.blade.php • 1 week ago

I have field in user database called status. When the user has lock status the login.blade.php should give the notification you are locked. I am unable to give this notification even though I am able to lock user. Here is my lock code in Sessionguard.php

public function login(AuthenticatableContract $user, $remember = false)
{

       $result = DB::table('users')
      ->where('email', 'LIKE', '%'.$_POST['email'].'%')
      ->where('status', 'lock')
      ->get();
     
     if($result){

        return view('lock'); //only returns the log in screen
       

    }

Webiondev123 started a new conversation Scope In Eloquent • 1 week ago

Hi

I was watching episode eloquent and there was a function scopeIncomplete. My question is how come part of a function variable which ia scope is treated like a keyword? I find it strange. Am I missing something?

10th November, 2017

Webiondev123 left a reply on Mkdir():no Such File Or Directory • 1 week ago

Thanks a lot!..silly mistake of mine

Webiondev123 started a new conversation Mkdir():no Such File Or Directory • 1 week ago

Hi. I am new here. I have got a job for php developer. Yesterday while trying to create a folder from laravel I started getting this error mkdir(): no such file or directory. I first tried using mkdir() to upload bit then I tried to create a folder using Storage::fileDirectory() or Storage::makeDirectory(). I tried putting in parameters such as base_path and public_path and permission 0777 here is an example

Storage::fileDirectory(public_path, 'Test', 0777);

The error pointa to the file Local.php in vendor where it is using mkdir... I tried changing it to Storage::fileDirectory still same error.

What am I doing wrong?

Thanks

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.