tim3011

tim3011

Member Since 3 Years Ago

Experience Points 5,400
Experience Level 2

4,600 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 32
Lessons
Completed
Best Reply Awards 0
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.

05 Jan
2 years ago

tim3011 left a reply on Upload Image To A Custom Folder

thanks man appreciate it

tim3011 left a reply on Upload Image To A Custom Folder

thanks for the reply but the storage disk path does not work within the mobile devices environment .I can only upload on the desktop, if I use my mobile the file is not uploaded I get error

file does not exists on the path

thats why will prefer to use straight php if you know how or why that is please help

tim3011 started a new conversation Upload Image To A Custom Folder

I have my uploads folder in the same level as the storage folder and would like to upload file to the uploads folder but I am getting error message

failed to open stream: Permission denied

I am using the php function

move_uploaded_file($_FILES['picture']['tmp_name'], "uploads/" . $_FILES['picture']['name']);

and would like to continue using that not the laravel one

Storage::disk('local')->put($file->getFilename().'.'.$extension,  File::get($file));

'''
as this does not work for me 
the question is how to get the move file function to take the storage path or get the permission to my desired storage folder
03 Jan
2 years ago

tim3011 started a new conversation File Upload Not Working With Laravel On Android Device

I happen to have a multi data form with image upload and that won't work with android devices changed my form to raw PHP and it works fine what am I missing as a plug in my laravel application for this to work within laravel frame work.

<?php

namespace App\Http\Controllers;

use App\Http\Requests;
use Request;
use Illuminate\Support\Facades\Input;
use Validator;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\File;
use DB;
use Auth;
use Illuminate\Support\Facades\Redirect;
use Session;
use Carbon\Carbon;

class TestController extends Controller
{
 if (Input::file('picture')->isValid()) {
     $destinationPath = 'uploads'; // upload path
      $extension = Input::file('picture')->getClientOriginalExtension(); // getting image extension
     $fileName = rand(11111,99999).'.'.$extension; // renameing image
      Input::file('picture')->move($destinationPath, $fileName); // uploading file to given path
     

            
               $spotCheckImage = new SpotCheckImagePath();
                 $spotCheckImage->imgname =  $fileName;
                 $spotCheckImage->imagepath = 'uploads/'. $fileName;
                 $spotCheckImage->spotCheckComment()->associate($spotCheckComment);
                $spotCheckImage->save();
 // sending back with message
      Session::flash('success', 'Records Saved successfully'); 
      return Redirect::to('testform');
    }
}
   
20 Dec
2 years ago

tim3011 started a new conversation File Upload

I am trying to upload pictures from a form which works fine on a desktop and on a mobile the files are not being uploaded

   $destinationPath = 'uploads'; // upload path
      $extension = Input::file('picture')->getClientOriginalExtension(); // getting image extension
      $fileName = rand(11111,99999).'.'.$extension; // renameing image
      Input::file('picture')->move($destinationPath, $fileName); // uploading file to given path
24 Nov
2 years ago

tim3011 left a reply on Blade Input Text Boxees Not Displaying Numbers

thanks man it was not showing and I figured that field was not populated at all some of those things terrible day thanks

tim3011 started a new conversation Blade Input Text Boxees Not Displaying Numbers

I have a query that i run and would like that to populate a form .I can get the other fields selected but I have a phone number field ,saved in the database as a varchar but for some reason it comes blank with nothing on the value and no errors are thrown

her is the blade code

<div class="row">
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label>Mobile</label>
                                                <input type="text" class="form-control" placeholder="mobile" value="{{$directcont}}" name="mobile" >
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                            <div class="form-group">
                                                <label>Land Line</label>
                                                <input type="text" class="form-control" placeholder="Landline" value="{{$hometele}}" name="landline"  >
                                            </div>
                                        </div>
                                    </div>
``
and here is the  controller code
  $cand = Candidate::where('fk2_ID', '=', $userid)
                 ->first();

     if($cand!=null)
     {
$candID=$cand->iddp_candidates;
     $fname=$cand->Name;
     $sname=$cand->sName;
     $nname=$cand->Likestobecalled;
     $hometele=$cand->HomeTelNo;
     $directcont=$cand->MobileTelNo;

return view('home')->with ( compact ('fname','sname','hometele','directcont','nname')); }

please if you spot anything advise any help appreciated
22 Nov
2 years ago

tim3011 left a reply on Invalid Argument Supplied For Foreach()

thanks guys tried this with get() and works fine

  $posts = DB::table('dp_userappliedfor')
               ->WHERE ('dp_userappliedfor.fk1_ID','=',$userid)
               
               ->orderBy('id', 'asc')
               ->get();

tim3011 started a new conversation Invalid Argument Supplied For Foreach()

have a controller with this

 
      $posts =DB::statement( "select * from dp_userappliedfor where fk1_ID =".$userid." order By id desc");
   
  return view('ApplicantHistory')->withPosts( $posts);

and a blade with this

  @foreach( (array) $posts  as $post )
                                      <tr>
                                      <td>{{ $post->id }}</td>
                                          <td>{{ $post->jobtitle }}</td>
                                          <td>{{ $post->dateapplied }}</td>
                                          <td>{{ $post->company }}</td>
                                          <td>{{ $post->closingdate }}</td>
                                          <td>{{ $post->jobstatus }}</td>

                                      </tr>
                                      @endforeach 

but for some reason i get the error Invalid argument supplied for foreach() nay help is much appreciated

29 Sep
2 years ago

tim3011 left a reply on Apache Server Laravel 5.2

after reading and understanding , laravel uses the public folder to index the website to be able to host it on an apache server or shared hosting you need to take the public folder in the application out of the initial application folder and put it on the www folder of the server which is the public folder of the server and put all files in your laravel public folder into that server public folder change all paths in autoload files to point to the location where the website files are which will be the laravel folder at the same level as the www folder not inside but at the same level in your root server if all done according go to the browser and type your address and you have the site showing .

28 Sep
2 years ago

tim3011 left a reply on SQLSTATE[HY000]: General Error: 1267 Illegal Mix Of Collations (utf8_general_ci,COERCIBLE) And (utf8_unicode_ci,COERCIBLE) For Operation '='

The sad solution was to both change the db collation and recreate the views/functions to force them to use the current collation.

tim3011 started a new conversation Update Not Working On Laravel 5.2

I have a record set that I would like to update followed all the tutorials on CRUD but seem not to get it to work here is what I have so far

$userUp =Address::find( Input::get( 'userID' ));
          $userUp->address1 = Input::get( 'address1');
          $userUp->address2 = Input::get('address2');
         $userUp->address3 = Input::get( 'address3' );
         $userUp->address4 = Input::get( 'address4' );
         $userUp->pcode = Input::get( 'postcode' );
 $userUp->save(); 

when this ran it gives me error

creating default object from empty value laravel

when I DD() the first line I get null but if I do the same for the input i get the input value for the id also tried this

$userUp =Address::where('ID', $userid)
          ->update([
           'address1'=>$input['address1'],
         'address2'=>$input['address2'],
         'address3'=>$input['address3'],
         'address4'=>$input['address4'],
         'pcode'=>$input['postcode'],

$userUp->save(); 

and still get the same as above but if I try this

$userUp =DB::statement("UPDATE Address SET address1 = '".Input::get('address1')."', address2 = '".Input::get('address2')."', address3 = '".Input::get('address3')."', address4 = '".Input::get('address4')."', pcode = '".Input::get('postcode')."' WHERE ID =".Input::get( 'userID' ).";" );

DD() will give me true but nothing happens on the database here is how my route looks like

Route::patch('userfprofile', '[email protected]');
30 Aug
2 years ago

tim3011 started a new conversation Laravel Hosting On Wamp

I have followed a tutorial here @ https://github.com/petehouston/laravel-deploy-on-shared-hosting on how to install laravel application on a shared hosting and also here @ https://medium.com/laravel-news/the-simple-guide-to-deploy-laravel-5-application-on-shared-hosting-1a8d0aee923e but have come to a difficult when I visit the localhost here is the error dump please help `

FatalErrorException in Encrypter.php line 100:
Call to undefined function openssl_decrypt()
in Encrypter.php line 100
at FatalErrorException->__construct() in HandleExceptions.php line 133
at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 118
at HandleExceptions->handleShutdown() in HandleExceptions.php line 0
at Encrypter->decrypt() in EncryptCookies.php line 95
at EncryptCookies->decryptCookie() in EncryptCookies.php line 76
at EncryptCookies->decrypt() in EncryptCookies.php line 59
at EncryptCookies->handle() in Pipeline.php line 136
at call_user_func_array:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Router.php line 726
at Router->runRouteWithinStack() in Router.php line 699
at Router->dispatchToRoute() in Router.php line 675
at Router->dispatch() in Kernel.php line 246
at Kernel->Illuminate\Foundation\Http\{closure}() in Pipeline.php line 52
at call_user_func:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:52}() in Pipeline.php line 52
at Pipeline->Illuminate\Routing\{closure}() in CheckForMaintenanceMode.php line 44
at CheckForMaintenanceMode->handle() in Pipeline.php line 136
at call_user_func_array:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:136}() in Pipeline.php line 136
at Pipeline->Illuminate\Pipeline\{closure}() in Pipeline.php line 32
at call_user_func:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:32}() in Pipeline.php line 32
at Pipeline->Illuminate\Routing\{closure}() in Pipeline.php line 103
at call_user_func:{C:\wamp\cruitement\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:103}() in Pipeline.php line 103
at Pipeline->then() in Kernel.php line 132
at Kernel->sendRequestThroughRouter() in Kernel.php line 99
at Kernel->handle() in index.php line 54
at {main}() in index.php line 0

can any spot what i missing please thanks in advance please note all the extensions are enabled on my serve do't know what the problem is if Laravel has a tutorial on this please point to the right direction

08 Aug
2 years ago

tim3011 started a new conversation SQLSTATE[HY000]: General Error: 1267 Illegal Mix Of Collations (utf8_general_ci,COERCIBLE) And (utf8_unicode_ci,COERCIBLE) For Operation '='

I am trying to query a view created on my database but get this error i have tried changing the view to a new view but still getting the same error my whole database is set up to

  'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',

so this is what I have tried

$onformance= DB::table('fullCompleted')
                     ->where('result','=','Success COLLATE utf8_unicode_ci')

but it still not showing anything please help or just point me to read about eloquent, mysql I have tried all

05 Aug
2 years ago

tim3011 left a reply on Distinct Not Working In Eloquent

@marick if I do a get how do you propose I do the count since I do.t want to pull any records but count them

tim3011 started a new conversation Distinct Not Working In Eloquent

I am trying to run a distinct count with these query but its not working it brings the results back but with wrong information any help please here is the current code so far please note that the commented code has been tried to achieve the same thing but still get the same results even if i take out the comments

 $sql=DB::table('job')->selectRaw('DISTINCT driver') //DB::Table('jobs')->distinct('driver')
           // ->JOIN ('drivers' , 'drivers.Code','=','job.Driver')
          // ->WHERE ('drivers.CURRENT','=','YES')
          //->WHERE ('drivers.Employed','=','S/C' )
          //->WHERE ('job.ColDate' ,'=',  $today )
          //->groupBy('driver')
           ->COUNT();

the is the actual sql

select count(distinct driver) from job inner join drivers on drivers.Code= job.Driver where drivers.CURRENT = 'YES' and drivers.Employed ='S/C' and job.ColDate =now()
02 Aug
2 years ago

tim3011 started a new conversation How To Set Select Value On A Html Helper Drop-down

in have a drop down dynamically populated but seem to have a problem as I select it the value selected is the index instead of value looked at the rendered html the value is the value selected but I actually want the one which was populated example

<div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 

this is the array being passed to the processing form function


Controller.php', '47', array('eddate' => '1470096000', 'eddates' => '2016-08-02 00:00:0000', 'edtime' => '2016-08-02 00:00:0000', 'datetime_from' => '1969-12-31 23:53:0000', 'input' => array('_token' => 'njDL5GlSEqtQtk9QbE86e7VSM6h9i2JGoS0FR3vC', 'call_sign' => '8', 'First_Name' => '/'))) 

the value on my drop down

<select class="form-control" id="sel" onchange="fetch_select(this.value);" name="call_sign"><option value="0"></option><option value="1"> BUD0</option><option value="2">118RS</option><option value="3">23A01</option><option value="4">606RC</option><option value="5">A2B01</option><option value="6">AA001</option><option value="7">AA002</option><option value="8">AA003</option>
the controller receiver
 
$input=Request::all();

        $code=$input['call_sign'];

Please note that I am only looking for a example on how to set value on the select dynamically because my code at present populates the select and do not know how to set value if you look at the rendered html you might see what I mean.I need the other values not these

option value="6"

i need this as my values

>AA001<

tim3011 left a reply on Select Dropdown Returning Index Value Instead Of Selected Value

@d3xt3r man no one forces you to answer question you answer them as you wish so do iI.I would like someone willing to help to help not show off in your article you recommended where on that article do they talk about the dynamic populated select get your feature and put me there it won't hinder my improvement or make you rich so [email protected]@ckoff

tim3011 left a reply on Select Dropdown Returning Index Value Instead Of Selected Value

@d3xt3r have you got code to show how I can achieve this please cause your link has not got the answer to my problem I want to see a working example with html helpers setting the value or just correct the posted HTML

tim3011 left a reply on Select Dropdown Returning Index Value Instead Of Selected Value

@d3xt3r the value being passed to the selected value comes from the value property in the select and with this html helper the value is the index so how do i change that or just give me a straight forward html to do the select without the html helpers where i will set the value to the populated values like so but the problem here is getting the right syntax

<select onchange="fetch_select(this.value);">
           <option>
              Select Driver
           </option>
           
           <?php
             $host = '@@@@@@@@';
             $user = '@@@@@@';
             $pass = '@@@@@@@';
           
             mysql_connect($host:3307, $user, $pass);

             mysql_select_db('dmn_db');
           
             $select=mysql_query("select code from drivers order by code desc");
             while($row=mysql_fetch_array($select))
             {
              echo "<option>".$row['code']."</option>";
             }
           ?>

         </select>

tim3011 started a new conversation Select Dropdown Returning Index Value Instead Of Selected Value

I have this drop down dynamically populated and the value selected is index instead of value help please the drop down on blade

 <div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 

this is the array being passed to the processing form function

Controller.php', '47', array('eddate' => '1470096000', 'eddates' => '2016-08-02 00:00:0000', 'edtime' => '2016-08-02 00:00:0000', 'datetime_from' => '1969-12-31 23:53:0000', 'input' => array('_token' => 'njDL5GlSEqtQtk9QbE86e7VSM6h9i2JGoS0FR3vC', 'call_sign' => '8', 'First_Name' => '/'))) 

the value on my drop down

<select class="form-control" id="sel" onchange="fetch_select(this.value);" name="call_sign"><option value="0"></option><option value="1"> BUD0</option><option value="2">118RS</option><option value="3">23A01</option><option value="4">606RC</option><option value="5">A2B01</option><option value="6">AA001</option><option value="7">AA002</option><option value="8">AA003</option>
the controller receiver

$input=Request::all();

        $code=$input['call_sign'];

tim3011 left a reply on Straight Php To Laravel Syntax

@phpMick tried as per your suggestion nothing changes i will paste my code again if you can help please

on the blade i have this

<script type="text/javascript">
  $.ajaxSetup({
            headers: {'X-CSRF-TOKEN': '{{ csrf_token() }}'},
            
        });
function fetch_select(val)
{
 
   $.ajax({
     type: 'post',
     url: 'spotCheck',
     data: {
       '_token': '{!! csrf_token() !!}',
       get_option:val
     },
     success: function (response) {
       document.getElementById("new_select").innerHTML=response; 
     }
   });
}
</script>
<script type="text/javascript">
    
    function submit() {   
      form = document.getElementById('test_form');
      form.submit();      
    }
  
  </script>
  {!! Form::Open(['url'=>'spotCheck','files' => true,'id'=>'test_form']) !!}
                {{ csrf_field() }}
            
              <div class="form-group">
                    <div class="row">
                       <div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 
                         <div class="col-md-4">
                           <label class="control-label">Picture</label>
                           <img src="{{$dphoto}}" alt="with responsive image feature" class="img-responsive img-circle">
                         </div>
                    </div>
        </div>
        <div class="form-group">
                   <div class="row">
                     <div class="col-xs-8">
                       <label class="control-label">Driver Full Name</label>
                       <input type="text" class="form-control" name="First_Name" id="new_select"   />

on the controller

    public function getDriverNamePicture()
    { 
       if (Request::ajax()) 
    {
        if (Session::token() !== Request::header('csrftoken')) 
        {
            // Change this to return something your JavaScript can read...
            throw new Illuminate\Session\TokenMismatchException;
        }else if(isset($_POST['get_option']))
   { 

     $state = $_POST['get_option'];
     $sql = DB::table('driver')
            ->select('drvname')
            ->where('code', $state)
            ->first()
            ->drvname;
            $new_string = explode('', $sql);
   
     exit;
   }
    } 
    
   
   return Response::json( $sql);
    }
}

on the route I have this

Route::post('spotCheck', '[email protected]');

I have gone on to add this to my layout file

 <meta name="_token" content="{!! csrf_token() !!}"/>

at the footer 
    <script type="text/javascript">
$.ajaxSetup({
   headers: { 'X-CSRF-Token' : $('meta[name=_token]').attr('content') }
});
</script>

on the browser inspection I get this

send @jquery.min.js4
ajax @jquery.min.js4
fetch_select       @spotCheck:29
onchange @spotcheck:120

all that i understand what its saying but I get this at the end which i don't understand

Listpicker_handleMouseUp @about;blank:3138

tim3011 left a reply on Select Combo Not Return The Value Selected

@tomi the drop down on blade

 <div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 

this is the array being passed to the processing form function

Controller.php', '47', array('eddate' => '1470096000', 'eddates' => '2016-08-02 00:00:0000', 'edtime' => '2016-08-02 00:00:0000', 'datetime_from' => '1969-12-31 23:53:0000', 'input' => array('_token' => 'njDL5GlSEqtQtk9QbE86e7VSM6h9i2JGoS0FR3vC', 'call_sign' => '8', 'First_Name' => '/'))) 

the value on my drop down

<select class="form-control" id="sel" onchange="fetch_select(this.value);" name="call_sign"><option value="0"></option><option value="1"> BUD0</option><option value="2">118RS</option><option value="3">23A01</option><option value="4">606RC</option><option value="5">A2B01</option><option value="6">AA001</option><option value="7">AA002</option><option value="8">AA003</option>

tim3011 started a new conversation Select Combo Not Return The Value Selected

I have a dynamic populated drop down and when I try to get the value from it, it gives me the count value so as to say the index value of the selected value any way to fix this.

tim3011 left a reply on Straight Php To Laravel Syntax

@snapey

Route::post('spotCheck', '[email protected]');
01 Aug
2 years ago

tim3011 left a reply on Straight Php To Laravel Syntax

@Snapey seen your reply somewhere about a similar question please advice been on browser network tools and this is what happens any help please.

Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://localhost:8000/spotCheck Failed to load resource: the server 
``

tim3011 left a reply on Query That Uses Ajax As An Action Listerner

@JeffreyWay I am trying to solve the above problem and everyone on this community seems not to know the answer so for the value of money help how do I solve this

tim3011 started a new conversation Query That Uses Ajax As An Action Listerner

I am trying to have a USER FILL UP THE FORM WHICH IS PARTLY FILLED BY AJAX WHEN A USER FILLS THE COMBO BOX MAY I HAVE A WORKING EXAMPLES OF THESE AS I HAVE TRIED AND NO ONE HAS A CLUE.

here is my implementation in straight php if i can have this in laravel eloquent thanks in advance

     <center>
       <div id="select_box">

         <select onchange="fetch_select(this.value);">
           <option>
              Select Driver
           </option>
           
           <?php
              $host = 'localhost';
             $user = @@@@@@@@@';
             $pass = '@@@@@@@@@@@@@@@@@@';

           
           mysql_connect($host, $user, $pass,3306);

             mysql_select_db('dmn_db');

           
              $select=mysql_query("select code from drivers order by code desc");
             while($row=mysql_fetch_array($select))
             {
             echo "<option>".$row['code']."</option>";
             }
           ?>

         </select>

         <select id="new_select">
         </select>
      
       </div>     
     </center>

and here is the php I call please help

if(isset($_POST['get_option']))
   {
     $host = 'localhost';
     $user = @@@@@@@@@@;
     $pass = '@@@@@@@@@@@@@@@';
           
     mysql_connect($host, $user, $pass,3306);

     mysql_select_db('dmn_db');
      

     $state = $_POST['get_option'];
     $find=mysql_query("select drvname from drivers where code='$state'");
     while($row=mysql_fetch_array($find))
     {
       echo "<option>".$row['drvname']."</option>";
     }
   
     exit;
   }

I have tried asking this here https://laracasts.com/discuss/channels/code-review/straight-php-to-laravel-syntax but no response if laravel does not work with ajax then what is the alternative to achieve this any welcome help

29 Jul
2 years ago

tim3011 left a reply on Straight Php To Laravel Syntax

@Snapey nothing happens it does not fire up or bring any error read something about a missing CSRF token not sure how to implement that

tim3011 left a reply on Straight Php To Laravel Syntax

@Snapey The current page is spotcheck and I am not really familiar with ajax calls and ajax in generally if you would elaborate or show example or something I will be gratefull

tim3011 started a new conversation Straight Php To Laravel Syntax

I have a form that I would like a user to fill but during the filling of the form I want to populate some fields with data from the database .When a user clicks the select drop down and select something the select is suppose to trigger the ajax to call a control and populate part of the form.I have written this in straight php and it works now I want to translate it to laravel syntax here is my code so far tell me when you spot some thing wrong or out of the ordinary. code on the controller


public function getDriverNamePicture()
    { 
    
    if(isset($_POST['get_option']))
   { 

     $state = $_POST['get_option'];
     $sql = DB::table('driver')
            ->select('drvname')
            ->where('code', $state)
            ->first()
            ->drvname;
            $new_string = explode('', $sql);
   
     exit;
   }
   return Response::json( $sql);
    }

code on the route


Route::post('spotCheck', '[email protected]');

code on the blade


//the script
<script type="text/javascript">

function fetch_select(val)
{
   $.ajax({
     type: 'post',
     url: 'spotCheck',
     data: {
       get_option:val
     },
     success: function (response) {
       document.getElementById("new_select").innerHTML=response; 
     }
   });
}

</script>

//the html

 <div class="row">
                       <div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 
                         <div class="col-md-4">
                           <label class="control-label">Picture</label>
                           <img src="Koala.jpg" alt="with responsive image feature" class="img-responsive img-circle">
                         </div>
                    </div>
                     <div class="row">
            <div class="col-xs-8">
                <label class="control-label">Start Time</label>
                <input type="text" class="form-control" name="stime" required />
            </div> 
        </div>
                </div>
                <div class="form-group">
                   <div class="row">
                     <div class="col-xs-8">
                       <label class="control-label">Driver First Name</label>
                       <input type="text" class="form-control" name="First_Name" id="new_select" />
                     </div> 
                  </div>

tim3011 started a new conversation Ajax Select On Laravel How To Implement

I have a form that I would like a user to fill but during the filling of the form I want to populate some fields with data from the database .When a user clicks the select drop down and select something the select is suppose to trigger the ajax to call a control and populate part of the form.I have written this in straight php and it works now I want to translate it to laravel syntax here is my code so far tell me when you spot some thing wrong or out of the ordinary. code on the controller

public function getDriverNamePicture()
    { 
    
    if(isset($_POST['get_option']))
   { 

     $state = $_POST['get_option'];
     $sql = DB::table('driver')
            ->select('drvname')
            ->where('code', $state)
            ->first()
            ->drvname;
            $new_string = explode('', $sql);
   
     exit;
   }
   return Response::json( $sql);
    }

code on the route

Route::post('spotCheck', '[email protected]');

code on the blade

//the script
<script type="text/javascript">

function fetch_select(val)
{
   $.ajax({
     type: 'post',
     url: 'spotCheck',
     data: {
       get_option:val
     },
     success: function (response) {
       document.getElementById("new_select").innerHTML=response; 
     }
   });
}

</script>
//the html
 <div class="row">
                       <div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel','onchange' => 'fetch_select(this.value);' ]) !!}
                       </div> 
                         <div class="col-md-4">
                           <label class="control-label">Picture</label>
                           <img src="Koala.jpg" alt="with responsive image feature" class="img-responsive img-circle">
                         </div>
                    </div>
                     <div class="row">
            <div class="col-xs-8">
                <label class="control-label">Start Time</label>
                <input type="text" class="form-control" name="stime" required />
            </div> 
        </div>
                </div>
                <div class="form-group">
                   <div class="row">
                     <div class="col-xs-8">
                       <label class="control-label">Driver First Name</label>
                       <input type="text" class="form-control" name="First_Name" id="new_select" />
                     </div> 
                  </div>

tim3011 started a new conversation Bootstrap Select Form Helper Syntax

hi guys anyone knows how to add an on change event on a bootstrap select here is my code so far

<div class="col-xs-8">
                          {!! Form::label ('Call Sign:',null, ['class'=>"control-label"])!!}
                          {!! Form::select('call_sign', $drive, null, ['class' => 'form-control' , 'id' => 'sel',onchange='fetch_select(this.value);' ]) !!}
                       </div> 

and on the on change i get an error help please

FatalErrorException in b9587610fee8813483533f89f85bac413f13b02e.php line 42:
syntax error, unexpected '=', expecting ']'
27 Jul
2 years ago

tim3011 started a new conversation Laravel On Ubuntu Apache

I have built my website on laravel 5.2 and installed laravel on my server I can do all the commands related to laravel and build the web site but when I run the website I get the front page (Welcome page )from there I can't navigate to other pages like login ,register, I built my auth through command prompt.

tim3011 started a new conversation Php Artisan Command On Apache Server

how do you get to build a laravel 5 application on the apache server after installing it since the server does not recognise artisan command any suggestions welcome, all the tutorial and articles just i came accross just show how to install we also need to know how to run build it once you install on Ubuntu server any articles with full explanation will help thanks in advance

tim3011 started a new conversation Apache Serve Laravel 5.2

could some one please direct me on where I can get instruction on how to run my application on an Apache server .I have my server running laravel already I followed instruction on how to install all working fine I can get the landing page but the problem is how do I work on it installing all the dependencies I want and make:model,make:controller .and where is my .env file cause i cant find it in here dir and how do i composer update

20 Jul
2 years ago

tim3011 left a reply on Routing How To Index Page In View /folder From The Route

thanks much appreciated thats' how you learn next time I will know that

tim3011 left a reply on Routing How To Index Page In View /folder From The Route

@SaeedPrez thanks for your help I have run the list controller command and got that my controllers do not exist the controllers are in controller and in folder auth {controller/auth/thecontroller.php} the command gives me this path

App\Http\Controllers\auth.AuthController does not exist
``
how do I reference   that on route

tim3011 left a reply on Routing How To Index Page In View /folder From The Route

@SaeedPrez sorry man no change keep getting the same error

Sorry, the page you are looking for could not be found.

1/1
NotFoundHttpException in RouteCollection.php line 161:

here is the route again

Route::post('/auth/login', '[email protected]')->name('auth.login');
Route::get('/auth/login', '[email protected]')->name('auth.login');

and here is the controller again

  public function getSignin()
    {
        // Is the user logged in?
        if (Auth::check())
        {
            //return Redirect::route('welcome');
            return redirect()->route('view.welcome');
        }

        // Show the page
        return View('auth.login');
       
    }
      

tim3011 started a new conversation Routing How To Index Page In View /folder From The Route

please could anyone guide me I have a route that I want to link to a page in views /folder the file is in the folder so as the controller is in controller /folder how do I reference this in route so far I have this

Route::get('/folder/login', '[email protected]');
Route::post('/folder/login', '[email protected]');

and on the controller I have this

public function getSignin()
    {
        // Is the user logged in?
        if (Auth::check())
        {
            return Redirect::route('welcome');
        }

        // Show the page
        return View('folder.login');
    }
19 Jul
2 years ago

tim3011 left a reply on Default Log In Not Working

@d3xt3r the application can register,send forgotten password link .when I follow the forgotten password link It allows me in now the problem is that I don,t have a clue why it won't recognize my password the first time (normal log in without having to click on the forgotten password)

tim3011 left a reply on Default Log In Not Working

I have not touched it thats' why I am amazed as to whats wrong with it or what to do

tim3011 started a new conversation Default Log In Not Working

I have implemented a default log in system as per laracast 's tutorial but for some reason the application can register,send forgotten password link .when I follow the forgotten password link It allows me in now the problem is that I don,t have a clue why it won't recognize my password the first time any suggestion will be appreciated.Please note this post is no way related to any post that l have post on this forum. Just for clarity the default system is still as default as it can be it has not been messed about

tim3011 left a reply on Auth:Log In Not Working

changed nothing started a new application where I wanted to use the default systems rather change it and progress from there but its not letting me in .This is a new problem not related to other posts. @d3xt3r

18 Jul
2 years ago

tim3011 started a new conversation Auth:Log In Not Working

I have a default auth system and for some reasons I can register ,request the forgotten pass and I can't log in .the only time I can log in is when I request the forgotten password .The system seems to be doing all the other bits in the background like writing to the database and querying the database for the logger details but won't let me in. Any help on where to look or what to solve will be appreciated.

tim3011 started a new conversation Override Users Id With Custom Id

Is there a way to override the User id in the users model for the Login register auth to realize my own id instead of laravel's own something like so

 $attributes = array(
            'id' => $user->admin_id,

but where do i put this to work

17 Jul
2 years ago

tim3011 started a new conversation Password Encrpytion

Sorry guys to ask this dump question but the fact is l don't know can anyone explain to me l am using laravel 5.2 and l use the built in authentication system for my login but l have a different system written in VB so these two systems share the database, l would like to use the same table for login,but l tried that and laravel won't match the password any suggestion to solving this appreciated.The password in the database is encrypted using md5.

13 Jul
3 years ago

tim3011 left a reply on Replacing The Laravel Authentication With A Custom Authentication Errors

thanks that will be helpful if you show what you have done I had already done something on the authenticatesUsers and I think I went to far, now it only loads no errors but it does not take me inside the application .anything that will help appreciated and if you know of an video article i can follow as well thanks need to get this working had been on it for two days running thanks everyone who helps

<?php

namespace Illuminate\Foundation\Auth;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Lang;

trait AuthenticatesUsers
{
    use RedirectsUsers;

    /**
     * Show the application login form.
     *
     * @return \Illuminate\Http\Response
     */
    public function getLogin()
    {
        return $this->showLoginForm();
    }

    /**
     * Show the application login form.
     *
     * @return \Illuminate\Http\Response
     */
    public function showLoginForm()
    {
        $view = property_exists($this, 'loginView')
                    ? $this->loginView : 'auth.authenticate';

        if (view()->exists($view)) {
            return view($view);
        }

        return view('auth.login');
    }

    /**
     * Handle a login request to the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function postLogin(Request $request)
    {
        return $this->login($request);
    }

    /**
     * Handle a login request to the application.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function login(Request $request)
    {
        $this->validateLogin($request);

        // If the class is using the ThrottlesLogins trait, we can automatically throttle
        // the login attempts for this application. We'll key this by the username and
        // the IP address of the client making these requests into this application.
        $throttles = $this->isUsingThrottlesLoginsTrait();

        if ($throttles && $lockedOut = $this->hasTooManyLoginAttempts($request)) {
            $this->fireLockoutEvent($request);

            return $this->sendLockoutResponse($request);
        }

        $credentials = $this->getCredentials($request);

        if (Auth::guard($this->getGuard())->attempt($credentials, $request->has('remember'))) {
            return $this->handleUserWasAuthenticated($request, $throttles);
        }

        // If the login attempt was unsuccessful we will increment the number of attempts
        // to login and redirect the user back to the login form. Of course, when this
        // user surpasses their maximum number of attempts they will get locked out.
        if ($throttles && ! $lockedOut) {
            $this->incrementLoginAttempts($request);
        }

        return $this->sendFailedLoginResponse($request);
    }

    /**
     * Validate the user login request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return void
     */
    protected function validateLogin(Request $request)
    {
        $this->validate($request, [
            $this->loginUsername() => 'required', 'Password' => 'required',
        ]);
    }

    /**
     * Send the response after the user was authenticated.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  bool  $throttles
     * @return \Illuminate\Http\Response
     */
    protected function handleUserWasAuthenticated(Request $request, $throttles)
    {
        if ($throttles) {
            $this->clearLoginAttempts($request);
        }

        if (method_exists($this, 'authenticated')) {
            return $this->authenticated($request, Auth::guard($this->getGuard())->user());
        }

        return redirect()->intended($this->redirectPath());
    }

    /**
     * Get the failed login response instance.
     *
     * @param \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    protected function sendFailedLoginResponse(Request $request)
    {
        return redirect()->back()
            ->withInput($request->only($this->loginUsername(), 'remember'))
            ->withErrors([
                $this->loginUsername() => $this->getFailedLoginMessage(),
            ]);
    }

    /**
     * Get the failed login message.
     *
     * @return string
     */
    protected function getFailedLoginMessage()
    {
        return Lang::has('auth.failed')
                ? Lang::get('auth.failed')
                : 'These credentials do not match our records.';
    }

    /**
     * Get the needed authorization credentials from the request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    protected function getCredentials(Request $request)
    {
        return $request->only($this->loginUsername(), 'Password');
    }

    /**
     * Log the user out of the application.
     *
     * @return \Illuminate\Http\Response
     */
    public function getLogout()
    {
        return $this->logout();
    }

    /**
     * Log the user out of the application.
     *
     * @return \Illuminate\Http\Response
     */
    public function logout()
    {
        Auth::guard($this->getGuard())->logout();

        return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
    }

    /**
     * Get the guest middleware for the application.
     */
    public function guestMiddleware()
    {
        $guard = $this->getGuard();

        return $guard ? 'guest:'.$guard : 'guest';
    }

    /**
     * Get the login username to be used by the controller.
     *
     * @return string
     */
    public function loginUsername()
    {
        return property_exists($this, 'Username') ? $this->Username : 'EmailAddress';
    }

    /**
     * Determine if the class is using the ThrottlesLogins trait.
     *
     * @return bool
     */
    protected function isUsingThrottlesLoginsTrait()
    {
        return in_array(
            ThrottlesLogins::class, class_uses_recursive(static::class)
        );
    }

    /**
     * Get the guard to be used during authentication.
     *
     * @return string|null
     */
    protected function getGuard()
    {
        return property_exists($this, 'guard') ? $this->guard : null;
    }
}

I only changed the attributes to match what I have please help

tim3011 left a reply on Replacing The Laravel Authentication With A Custom Authentication Errors

can you share your override maybe I try that please @ohffs