DanielLaravel

DanielLaravel

Member Since 2 Years Ago

Experience Points 320
Experience Level 1

4,680 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 0
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.

15 Jun
2 years ago

DanielLaravel left a reply on Vuejs + Laravel Axios Array Problem

I find out what was wrong,

I had two problems, one was my view tags variables, this is the right way since i need to loop through my nom object with his index like this:

<select class="form-control" v-model="nombre">
    <option v-for="nom in nombre">@{{ nom.cedula }}</option>
</select>

the second problem was my return at my vuejs file, i was returning one single output into a loop, this is the right way:

    var app = new Vue({
                el: '#root',
                data: {
                    cedula: '',
                    nombre: [],
                },
                watch: {
                    cedula: function() {
                        this.nombre = ''
                        if (this.cedula.length == 1) {
                            this.buscarCedula()
                            this.nombre = "Consultando cédula...";
                        }
                    }
                },
                methods: {
                    buscarCedula: _.debounce(function() {
                        axios.get('http://localhost/miapp/public/personas/mostrar')
                            .then(function(response) {

                                if (!response.data.error) {
                                    return app.nombre = response.data;

                                } else {
                                   return app.nombre = response.data.error;
                                }
                            })
                            .catch(function(error) {
                                app.nombre = error;
                            })
                    }, 500)
                }
)};
13 Jun
2 years ago

DanielLaravel started a new conversation Vuejs + Laravel Axios Array Problem

Hello, my problem is im trying to loop and array from Axios query into my blade template query is giving me no errrors but tells me is undefined multiple times on my select tag.

I have a simple Axios query from my Laravel Controller:

public function consultaPersonas()
    {
        $consulta = persona::all();
        if(!$consulta)
        {
            $consulta = ['error' => 'No hay registros'];
        }
        return $consulta;
    }

this query will bring me this little array:

[{"cedula":"15678453","nombre":"LUIS CHACON","edad":30},{"cedula":"2536524","nombre":"MARIO ORTEGA","edad":21},{"cedula":"25632541","nombre":"VANESSA ALCALA","edad":24}]

This is the Select Tag i want to loop:

<select class="form-control" v-model="nombre">
    <option v-for="nom in nombre">@{{ nombre }}</option>
</select>

Here's my Vuejs code:

var app = new Vue({
    el:'#root',
    data: {
        cedula:'',
        nombre:[],
    },

    watch: {
        cedula: function () {
            this.nombre = ''
            if(this.cedula.length == 1) {
                this.buscarCedula()
            this.nombre = "Consultando cédula...";
            }
        }
    },

    methods: {
        buscarCedula: _.debounce(function (){   
            axios.get('http://localhost/miapp/public/personas/mostrar')
                .then(function (response){

                    let datos = response.data;
                    let validar = datos.error;

                    if(!validar) {
                        app.nombre =
                        datos.cedula + ' - ' +
                        datos.nombre + ' - ' +
                        datos.edad;

                    }
                    else
                    {
                        app.nombre = validar;
                    }
                })
                .catch(function (error){
                    app.nombre = error;
                })
        }, 500)
    }
    

What am i doing wrong? Thanks.

10 May
2 years ago

DanielLaravel started a new conversation Vuejs 2 + Laravel 5

Hello Laracast community, i need to use Vue Axios / Resource, i managed to make a HTML select box loaded from my database in my view, after i select any record i need to use another value from that record and put it into an HTML input, for example: in my html select i click on my "stpr_tx_descripcion" attribute, after that i need another atribute, the "stpr_in_ticket", but i don't know how make it dynamically.

This is what i got so far:

Im using Laravel to return a query object to my view like this:

$query= spr_tipo_per_rep::all('stpr_tx_descripcion','stpr_in_ticket');
->with('query',$query);

In my view im using the Html select which loads the record:

<select  v-model="descripcion" >
                    <option value="">Select value</option>
                    @foreach($query as $data)              
                    <option value="{{ $data->stpr_tx_descripcion }}">{{ $data->stpr_tx_descripcion }}</option>
                    @endforeach
                </select>

Below that i need to put the value from "stpr_in_ticket" atribute which is another detail into my input using vue:

<input type="text" v-model="???" readonly="readonly">

Thanks.

06 Apr
2 years ago

DanielLaravel started a new conversation Laravel 5 Eloquent And Models Error

Hello Laracast community, im having this error with Eloquent models while trying to make multiple model joins:

BadMethodCallException in Builder.php line 2450: Call to undefined method Illuminate\Database\Query\Builder::adminis()

These are my models:

<?php

    namespace App\Modelos;

    use Illuminate\Database\Eloquent\Model;

    class srh_inf_persona extends Model
    {
        protected $table = 'srh_inf_personas';

        protected $primaryKey = ['infp_cedula'];

        public function adminis()
        {
            return $this->hasMany('App\Modelos\srh_infa_admini');
        }
    }

class srh_inf_admini extends Model
{
    protected $table = 'srh_inf_adminis';
    public $timestamps = 'false';

    protected $primaryKey = ['infa_cedula'];

    public function persona()
    {
        return $this->belongsTo('App\Modelos\srh_inf_persona');
    }
}

and this is my controller:

<?php

namespace App\Http\Controllers\Controladores;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Modelos\srh_inf_persona; // Llamado del modelo SRH_INF_PERSONA
use App\Modelos\srh_inf_admini; // Llamado del modelo SRH_INF_PERSONA

class SolicitudController extends Controller
{
    public function nuevasolicitud($ced)
    {       
        $consulta = srh_inf_persona::select('infp_cedula')->adminis()
        ->where('infp_cedula',$ced)
        ->first();

        return view('permisos.solicitud',[ 'personas' => $consulta ]);
    }

}

Any idea what the problem is? Thanks alot.

05 Apr
2 years ago

DanielLaravel started a new conversation Laravel 5 And Dingo + JWT Problem

Hello Laracast community, I need to use JWT to make my API catch and comunicate between another Laravel projects and keep the user session, so far i've configuring Dingo API and Tymondesign JWT-Auth, but cannot generate the Token after i send username and password, when i do it by GET method i get "{"error":"invalid_credentials"}", this is my configuration:

´´´$api = app('Dingo\Api\Routing\Router'); // $api = app('api.router');

$api->version('v1', function($api) {

$api->get('autenticar','App\Http\Controllers\[email protected]');

});´´´

´´´ public function autenticar(Request $request) { $credentials = ([$request->username,$request->password]); try { // attempt to verify the credentials and create a token for the user if (! $token = JWTAuth::attempt($credentials)) { return response()->json(['error' => 'invalid_credentials'], 401); } } catch (JWTException $e) { // something went wrong whilst attempting to encode the token return response()->json(['error' => 'could_not_create_token'], 500); }

    return response()->json(compact('token'));
}

´´´ I've testing the username and password and the values are getting to the controller but i can't manage to generate token so far. If i take off "all filters" and get to generate the Token i get this error " {"result":false,"token":"invalid_credentials"} ", and when i do it by POST method i get this error:

´´´{"message":"405 Method Not Allowed","status_code":405,"debug":{"line":218,"file":"/home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php","class":"Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException","trace":["#0 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(205): Illuminate\Routing\RouteCollection->methodNotAllowed(Array)","#1 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(158): Illuminate\Routing\RouteCollection->getRouteForMethods(Object(Dingo\Api\Http\Request), Array)","#2 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\Routing\RouteCollection->match(Object(Dingo\Api\Http\Request))","#3 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\Routing\Router->findRoute(Object(Dingo\Api\Http\Request))","#4 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Dingo\Api\Http\Request))","#5 /home/dchacon/public_html/trackye/vendor/dingo/api/src/Routing/Adapter/Laravel.php(81): Illuminate\Routing\Router->dispatch(Object(Dingo\Api\Http\Request))","#6 /home/dchacon/public_html/trackye/vendor/dingo/api/src/Routing/Router.php(513): Dingo\Api\Routing\Adapter\Laravel->dispatch(Object(Dingo\Api\Http\Request), 'v1')","#7 /home/dchacon/public_html/trackye/vendor/dingo/api/src/Http/Middleware/Request.php(126): Dingo\Api\Routing\Router->dispatch(Object(Dingo\Api\Http\Request))","#8 [internal function]: Dingo\Api\Http\Middleware\Request->Dingo\Api\Http\Middleware\{closure}(Object(Dingo\Api\Http\Request))","#9 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Dingo\Api\Http\Request))","#10 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#11 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#12 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#13 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#14 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#15 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#16 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#17 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#18 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#19 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#20 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#21 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#22 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#23 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#24 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#25 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#26 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Dingo\Api\Http\Request), Object(Closure))","#27 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#28 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Dingo\Api\Http\Request))","#29 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Dingo\Api\Http\Request))","#30 /home/dchacon/public_html/trackye/vendor/dingo/api/src/Http/Middleware/Request.php(127): Illuminate\Pipeline\Pipeline->then(Object(Closure))","#31 /home/dchacon/public_html/trackye/vendor/dingo/api/src/Http/Middleware/Request.php(103): Dingo\Api\Http\Middleware\Request->sendRequestThroughRouter(Object(Dingo\Api\Http\Request))","#32 [internal function]: Dingo\Api\Http\Middleware\Request->handle(Object(Illuminate\Http\Request), Object(Closure))","#33 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)","#34 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))","#35 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))","#36 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))","#37 /home/dchacon/public_html/trackye/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))","#38 /home/dchacon/public_html/trackye/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))","#39 {main}"]}}´´´

This if my .env file:

´´´ Options -MultiViews

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

RewriteCond %{HTTP:Authorization} ^(.) 
RewriteRule . - [e=HTTP_AUTHORIZATION:%1]

´´´

this is my api.php file: ´´´<?php 'standardsTree' => env('API_STANDARDS_TREE', 'vnd'), 'subtype' => env('API_SUBTYPE', 'trackye'), 'version' => env('API_VERSION', 'v1'), 'prefix' => env('API_PREFIX', 'api'), 'domain' => env('API_DOMAIN', null), 'name' => env('API_NAME', 'trackye api'), 'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true), 'strict' => env('API_STRICT', false), 'debug' => env('API_DEBUG', true), 'auth' => [ 'jwt' => 'Dingo\Api\Auth\Provider\JWT' ], 'transformer' => env('API_TRANSFORMER', Dingo\Api\Transformer\Adapter\Fractal::class), 'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'), formats' => [

    'json' => Dingo\Api\Http\Response\Format\Json::class,
],

];´´´

and my .env

´´´API_NAME=trackye api API_DEBUG=true API_PREFIX=api API_DEFAULT_FORMAT = json API_TRANSFORMER = Dingo\Api\Transformer\Adapter\Fractal´´´

04 Apr
2 years ago

DanielLaravel started a new conversation Laravel 5 API

Hello Laravel community, i'm working on a API for Laravel 5.3 right now. The API already has my own login interface and after users login they will see some URL's that will take them to another Laravel projects by separate and these projects will validate or receive the login authentication, the challenge is that the API must generates some sort of Token, like JWT, which helps me to redirect to these Laravel projects and make the user login persist throught all systems.

So far i've managed to make a Dynamic database user login which validates user and it's privileges not the ´´´.env´´´ DB_USERNAME and DB_PASSWORD acording to the project needs, and i've trying to make Dingo + JWT Packages to work but had no success so far, because it's hard to configure and only returns me routing errors and null tokens.

I need some ideas to keep going, like another packages, etc.

Thank you very much.

31 Mar
2 years ago

DanielLaravel left a reply on Laravel 5.3 Wish List

Hello, i would like to easily set dynamic connections, for example the username and password introduced by the client, and not the one in the .env file, to avoid setting connection like this:

Config::set("database.connections.yourCustomConfig", [
    "host" => "1.2.3.4",
    "database" => "differentDBName",
    "username" => "user",
    "password" => "password"
]);

and avoid instancing this in all Models.

29 Mar
2 years ago

DanielLaravel started a new conversation Database Connections

I'm using Laravel 5. I see Laravel uses .env to connect databases for example DB_USERNAME and DB_PASSWORD, but i want to log in and use my username and password from my form to connect with those values from withim my oracle database with a table name "dba_users" which has the user and password and some others fields

i want to do that becauses each user has their own granted permissions(roles) to some tables, thus Oracle would manage the user login permissions and not the .env DB_USERNAME.

Maybe i could set a new connection parameters where i put my username and password sent by the login form?

Thank you Laravel community.