jahstation

jahstation

Member Since 2 Years Ago

Experience Points 1,460
Experience Level 1

3,540 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 2
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.

27 Nov
9 months ago

jahstation left a reply on Multiple Laravel Site On One Vps

@JLRDW - Please put me in the right direction...if im on the wrong path

jahstation left a reply on Multiple Laravel Site On One Vps

thanks a lot goatshark!

i will try to investigate a little bit more, because i need it just as deploy "area" no one else will looking for access.

but if i well understand with some other page of the manual that u have linked to me, how apache "serve" is defined in .conf in /sites-aviable then the .htaccess define how the folder serve the index...

i dont have any particular configuration over sites-aviable or apache2.conf so i imagine that i need to put hands on .htaccess or I wrong? i can define differen port for different laravel istance as well i guess... yes im a little bit in confusion but the things sound easy to me...

jahstation left a reply on Multiple Laravel Site On One Vps

not clear to me...because in this case they use even a different ip for each istance... ive the same ip for every site, i need to go like in localhost configuration where from localhost u can serve localhost/site1 localhost/site2.... etc.

jahstation started a new conversation Multiple Laravel Site On One Vps

I need to host more than one laravel site on the same virtual machine that is on a server of ovh.

No domain bought on it, the name is defined on /etc/hosts as

xx.xx.xx.xx vpsname.net vpsName where xx is a number of the ip address;

I take this project it from another man that go away and i can talk with him,anyway is configuration is:

/var/www/html/site1 (apache under ubuntu server 18)

If u try to access to ip or vpsName the index of the site1 is showed to the user.

inside the laravel's public folder I found the .htaccess with this on it:

Options -MultiViews

RewriteEngine On

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

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

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Wich one is the best way to move to a configuration like:

urlvps.com/site1 urlvps.com/site2 urlvps.com/siteN wich files needs to be modded?

I take a look over: /etc/apache2 but i cannot see any mods in effect!

thanks

26 Sep
11 months ago

jahstation started a new conversation Channel.bind From Pusher Give Me Infinite Loop

Im a very beginner in js world... anyway Im trying to integrate this js lib https://mattboldt.com/typed.js on html page that contains even a "pusher" function for loading data from a channel (laravel broadcasted event). - the final goal is a real time typing-txt to be seen on a screen- So I've the script like this in my blade page:

var pusher = new Pusher('xxxxxxxxxxxx', { cluster: 'xxxx', forceTLS: true });

var channel = pusher.subscribe('xxxxx');

var options = {
    strings: ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"],
    typeSpeed: 80
}

var typed = new Typed(".element1", options);


channel.bind('App\Events\TextAdded', function(data) {
    console.log(data.testo);
    var txt = JSON.stringify(data.testo);
    var typed2 = new Typed('.element', {
        strings: [txt],
        typeSpeed: 80
    });

});

the first inizialazed outside the "channelbind" part of Typed works well...

then at the first event the inside part of works good, after at every next event the Typed declaration goes in pain and start to write and cancel his sentence every second, without hope to stop it without reloading the page manually... memba that var txt = JSON.stringify(data.testo); helps me to make this part works at least the first time, otherwise even the very first event went in pain.

10 Sep
1 year ago

jahstation started a new conversation Is Events/listener The Right Way To Do So?

I need to waiting (listen) for a request from client trough API route, that will send me some text, when the request is received i need to confirm it to the client and send the text to a blade view not back to the client's api.

I dont think that i can do everything in a controller logic.

wich one is the smarter way to do that in laravel? Events/listener? seem a little bit complicated to me, but if is the faster way i'll study it in deep...

11 Jul
1 year ago

jahstation started a new conversation Saving File In A Specific User Folder And Show It

I've a strange problem on my saveFile() method:

public function saveFile(Request $request){
        $username=Auth::user()->name;
        if ( preg_match('/\s/', $username) ){
            $username= preg_replace('/\s+/','', $username);
        }
        if(! Storage::disk('public')->has("users/".$username."_".Auth::user()->id)){
            Storage::makeDirectory("public/users/".$username."_".Auth::user()->id);
        }

        $patz=asset(Storage::url("users/".$username."_".Auth::user()->id));
        $now= new \Carbon\Carbon();
        $fileName = 'ddt_'.$username."_".$now->getTimestamp().'.'.$request->ddt_file->getClientOriginalExtension();

        $pathComplete = Storage::putFileAs(
            $patz, $request->file('ddt_file'), $fileName
        );
       
        $ddt_file_url= new Ddt_file_url();  //salvare ddt e poi prendere id
        $ddt_file_url->fileUrl = $pathComplete;
        $ddt_file_url->fileName = $fileName;
        $ddt_file_url->company()->associate(Auth::user()->id);
        $ddt_file_url->save();
        return $ddt_file_url;
    }

And for the showing part I'm using:

@if($ddtS->ddt_file_url_id)
     <a href="{{$ddt_urls->where('id',$ddtS->ddt_file_url_id)->first()->fileUrl}}"
               download="{{$ddt_urls->where('id',$ddtS->ddt_file_url_id)->first()->fileName}}">
           <button  type="button" class="btn btn-default">
                        Download ddt file <span class="fa icon-icona_download-01"></span>
            </button>
  </a>
@else
 <p>-</p>
@endif 

Keep in mind that the user's folder are under Storage/users/username_id and all storage is linked to public with the artisan istruction "php artisan storage:link"

26 Mar
1 year ago

jahstation left a reply on Insert Translation Even In Script Part

fair :) but if there is not faster way i strongly suggest to laravel devs to put as next feature!

jahstation left a reply on Insert Translation Even In Script Part

the first solution is complicated but works... but I don really like closure on route file, imo. second thing no way to make it work.

any faster/easier way to achieve the job?

jahstation started a new conversation Insert Translation Even In Script Part

I'm using the translation, in blade template.

My blade page have in the footer part things like:

@push('scripts')
<link href={{asset('/css/bootstrap2-toggle.min.css')}} rel="stylesheet">
<script src={{asset('/js/bootstrap2-toggle.min.js')}}></script>
<script src="{{asset("js/jquery.smartWizard.js")}}"></script>
<script src={{asset('/js/stepper.js')}}></script>
<script src={{asset('/js/validationJquery.js')}}></script>
@endpush

I need to force some parts of my JS file, with translation. If I write inside the file (public/js/steppers.js for example) things like: var cancelVal={{ __('messages.tempCreat_txtLock') }}; This not works;

If I write:

<script>
        var cancelVal={{ __('messages.tempCreat_txtLock') }};
    </script>

or

<script>
        var cancelVal={!! __('messages.tempCreat_txtLock') !!};
    </script>

or

<script>
        var cancelVal=' '+{{ __("messages.tempCreat_txtLock") }}+' ';
    </script>

or

<script>
        var cancelVal=' '+{!! __("messages.tempCreat_txtLock") !!}+' ';
    </script>

Before or inside the PUSH(script) part, this works and in the doom I can see the correct value, but highlited in red, in the dom I can see thing like:

<script>
        var cancelVal=lock;   <-- Lock is not defined
    </script>

Or

<script>
        var cancelVal=''+Lock+'';   <-- Lock is not defined
    </script>

And in the file public/js/stepper.js the variable "cancelVal" is not defined.

How can I make it works?

thanks a lot

19 Mar
1 year ago

jahstation left a reply on Why Propery_exist Error On Blade Page

forget it.. i miss an "S"

jahstation started a new conversation Why Propery_exist Error On Blade Page

  @php
            if(($template) && (property_exist($template,'content'))){
                if( $template->content->description)
                    $testo=$template->content->description;
                else
                 $testo='-';

                if($template->content->title)
                    $titolo=$template->content->title;
                else
                    $titolo= '-';

                if($template->content->questions){
                    $domande=$template->content->questions;
                    $numDomande=count($template->content->questions);
                }else
                    $domande='';

            }else{
                $testo='-';
                $titolo= '-';
                $domande='';

            }
            @endphp

why this code on blade page, give me back this error?

https://ibb.co/bZ77xx

16 Mar
1 year ago

jahstation left a reply on Manual Pagination Without A Model

i made this:

$perPage=5; $total=count($risultati);

$res = new Paginator($risultati, $total, $perPage);

and then on the front page (by blade) something like:

{{$feedbacks->links()}}

its render new pages links at the end of the table now, but if click on them the result is:

http://localhost:8000/beforelink/idsomething

http://localhost:8000/?page=2

and not http://localhost:8000/beforelink/idsomething?page=2

jahstation left a reply on Manual Pagination Without A Model

no problem to slice an array via php, but then how to make the fantastic {{$something->links()}} works on front page?

@tomopongrac the solution on the link not works, and is based to another post where the solution is not clear to me...

jahstation started a new conversation Manual Pagination Without A Model

Is it possible? I found this on manual, but isnt clear to me how to solve this: https://laravel.com/docs/5.6/pagination#manually-creating-a-paginator

I've an array of things that is not related to a model, and i need to paginate the result...

thanks

12 Mar
1 year ago

jahstation left a reply on How It Possible An Error In Foreach With This Checks -on Blade Page-

ok the problem was silly.... apologize to all and thanks for the contributors, this is the solution:

$risp=""; if(is_array($response) || is_object($response)){ if(property_exists($response,'keywords')) { if($response->keywords){ foreach($response->keywords as $keyword){ $risp.=$keyword.", "; } }else{ $risp=''; } } }

jahstation left a reply on How It Possible An Error In Foreach With This Checks -on Blade Page-

yes, $replies is a var, something mine, passed to the view...

I check "$response->keywords" as array or I wrong?

jahstation started a new conversation How It Possible An Error In Foreach With This Checks -on Blade Page-

the value $response exist before this checks, the value are correct, and yes I've an object, but laravel raise every time:

Invalid argument supplied for foreach() (View: /home/natty/workspace/vAssistant/vAss/resources/views/editStepperHtml.blade.php)


if(property_exists($response,'keywords')){
    if (is_array($response) || is_object($response)){
        foreach($response->keywords as $keyword){
             $risp.=$keyword.", ";
        }
        }
}

to me sounds so strange!

06 Feb
1 year ago

jahstation left a reply on Simple Regex Validation Fails

thanks! it works! just added "[" and ]

            'regex:/[\[email protected]$\*\(\)_=\?;\':\[\]\",.]/',
02 Feb
1 year ago

jahstation started a new conversation Simple Regex Validation Fails

I need a way to add a regex to a validator, but it seem a little bit problematic to me, even I followed as described in the doc to put all rules on array.

I need that my password can contain at least (or more) these symbols " [][email protected]$*()_-=?;':",. "

so the regex to me is something like [list of symbols]

I write my code as:

$rules = array(
        'password' =>array('required',
        'min:6','confirmed',
        'regex:[[email protected]$*()_=?;\':\",.]'),
        'userName'=> array('required','min:3','max:25'),
        'email' => array('required','email'),
        'type' => array('required','max:13'),
    );

but every time an error is raised!

(1/1) ErrorException preg_match(): Compilation failed: nothing to repeat at offset 3 in ValidatesAttributes.php (line 1050)

22 Jan
1 year ago

jahstation left a reply on Column Not Find After Run A "composer Update"

hi to all I found a possible reason... and its so strange to me, a class, i cant remeber now wich one sorry, from the Auth package (vendor/laravel/framework/src/illuminate/foundation/auth/) was simply cut before the end! so there was half method and the class (or the trait i cant remeber) was not properly closed! I solve it simply by copying file from another laravel installation... the main thing is that composer update ran without error!!!!!

thanks to all contributors

18 Jan
1 year ago

jahstation left a reply on Column Not Find After Run A "composer Update"

yes im revert to the last working backup... but to me is still no sense that a composer update broke all! thanks anyway for your tips

17 Jan
1 year ago

jahstation left a reply on Column Not Find After Run A "composer Update"

no is the template where ive based all my laravel app... funny!

jahstation left a reply on Column Not Find After Run A "composer Update"

another cool feature for me: if i open the home from the "icognito mode" the framework show me the page but the login not works anymore

jahstation left a reply on Column Not Find After Run A "composer Update"

no... this is the code present even online -where the site still works- and i didnt touch anything in this class

public function handle($request, Closure $next, $guard = null) { if (Auth::guard($guard)->guest()) { if ($request->ajax() || $request->wantsJson()) { return response('Unauthorized.', 401); } else { return redirect()->guest('login'); } }

    return $next($request);
}

jahstation left a reply on Column Not Find After Run A "composer Update"

your function show me the user!

trying to troubleshooting ive found that the code that rise the error is inside Class "Authenitcate" function "handle"

Auth::guard($guard)->guest()

jahstation left a reply on Column Not Find After Run A "composer Update"

adding the complete path on the model so "App\Models\User" and then import it on web.php, it works!

jahstation left a reply on Column Not Find After Run A "composer Update"

this is the composer update output:

composer update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 27 updates, 0 removals

  • Updating tijsverkoyen/css-to-inline-styles (2.2.0 => 2.2.1) Loading from cache
  • Updating symfony/polyfill-mbstring (v1.5.0 => v1.6.0) Loading from cache
  • Updating symfony/var-dumper (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/routing (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/process (v3.3.10 => v3.4.3) Loading from cache
  • Installing symfony/polyfill-php70 (v1.6.0) Loading from cache
  • Updating symfony/http-foundation (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/event-dispatcher (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/debug (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/http-kernel (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/finder (v3.3.10 => v3.4.3) Loading from cache
  • Updating symfony/console (v3.3.10 => v3.4.3) Loading from cache
  • Updating ramsey/uuid (3.7.1 => 3.7.2) Loading from cache
  • Updating symfony/translation (v3.3.10 => v3.4.3) Loading from cache
  • Updating mtdowling/cron-expression (v1.2.0 => v1.2.1) Loading from cache
  • Updating erusev/parsedown (1.6.3 => 1.6.4) Loading from cache
  • Updating doctrine/inflector (v1.1.0 => v1.2.0) Loading from cache
  • Updating watson/bootstrap-form (1.1.11 => 1.1.14 Downloading: 100% .
  • Updating spatie/laravel-permission (1.13.0 => 1.15.0) Downloading: Connectin Downloading: 100%
  • Updating ixudra/curl (6.13.0 => 6.16.0) Downloading: 100%
  • Updating symfony/yaml (v3.3.10 => v3.4.3) Downloading: 100%
  • Updating phpunit/php-file-iterator (1.4.2 => 1.4.5) Loading from cache
  • Updating phpunit/php-token-stream (1.4.11 => 2.0.2) Loading from cache
  • Updating phpdocumentor/type-resolver (0.3.0 => 0.4.0) Loading from cache
  • Updating phpdocumentor/reflection-docblock (3.2.2 => 4.2.0) Loading from cache
  • Updating phpspec/prophecy (v1.7.2 => 1.7.3) Loading from cache
  • Updating myclabs/deep-copy (1.6.1 => 1.7.0) Loading from cache
  • Updating phpunit/phpunit (5.7.22 => 5.7.26) Downloading: 100% Writing lock file Generating autoload files

Illuminate\Foundation\ComposerScripts::postUpdate php artisan optimize Generating optimized class loader The compiled services file has been removed. [email protected]:~/workspace/vAss$ php artisan serve

jahstation left a reply on Column Not Find After Run A "composer Update"

the only operation made from before (site working) and after (site broken) is to run "composer update" that was run without errors, and no edit over the composer.json. the template is still to update so!

so im with a broken site with a non update template that have a bug! :D whatta lovely day!

ive no idea about what i can show you to try to solve the probelm... the file that u mention are not edited!

jahstation left a reply on Column Not Find After Run A "composer Update"

ok maybe i made a wrong step runnings composer update. but i didnt think to broke all!

by the way no edit con composer.json file

jahstation left a reply on Column Not Find After Run A "composer Update"

no this not solve my problems, and the controller are not modified from before/after composer update!

I read that can be a problem about primary key of the user and i try to add: protected $primaryKey = 'id';

on my user's model, but again this didnt fix my issue

jahstation started a new conversation Column Not Find After Run A "composer Update"

I run gentelella admin template over laravel 5.4, after seeing that there is some bug that are fixed with the new relase of Gentelella I tried to run: composer update on my root project folder to fix issue, the command was ok with no error rised during exectution.

After i try to access to the home page of my project but ive received this error message:

(2/2) QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause' (SQL: select * from users where `` = 1 limit 1) in Connection.php (line 647)

where i wrong something? thanks thanks

16 Jan
1 year ago

jahstation left a reply on Auth Without A Model

I found this tutorial online, it can be usefull? https://www.georgebuckingham.com/blog/laravel-52-auth-custom-user-providers-drivers/

to me is a likkle bit complicate to follow because it mix concept from auth and no... so i dont really get some basic point...

on the laravel manual is showed as silly thing, but isnt to me!

jahstation left a reply on Auth Without A Model

thanks a lot, ill check and ill let u know if it works for me! cheers

jahstation started a new conversation Auth Without A Model

I've a project where for a quick start ive implemented security with auth using the classic "user model". Now ive to update it using an external login service (REST). Wich is the most convenient way to do it without trashing all the auth part?

27 Dec
1 year ago

jahstation left a reply on A Simple Client/server Game

apologize maybe is a silly question, but to me is not clear how to laravel have a connection/socket with a specific user. Keep in mind that maybe im complete out of the road...

jahstation started a new conversation A Simple Client/server Game

I'd like to understand if it possible implements an application in a pure multi client/server way... don't mind about the specific thing but I'd like implementes a server that invite in a sort of "room" (page) just 3 -or more- user registred on the platform (for the start is enough that only those can login on this specific page) and then those users sends "something" to the server, the server waiting for all players reply's and then close the room/page.

So:

  • the server sets a temporary room for some given users;
  • the users(clients) invited can only access to this page;
  • clients send something back to the server;
  • server waiting for "N" client reply, then send them back a message, and the room is no more active;

the first 2 step are not so complicated in my mind but i cannot imagine how to do the last 2 step, any tips are so wellcome.

thanks

07 Sep
2 years ago

jahstation left a reply on Problem Serving Stored File In Local

ok im feel a little bit stupid now... the problem comes from some special char in the file name... thanks a lot for every tips they helped me alot in understanding how storage works!

06 Sep
2 years ago

jahstation left a reply on Problem Serving Stored File In Local

im really confused! thanks for your help bashy!

  1. saving file like:

  $pathComplete=$request->ddt_file->storeAs($patz,$fileName);

And then save it on the db is the right choice?

  1. as I said there is a folder for each user under Storage/app/public/users:

    1- Storage/app/public/users/user1

    2- Storage/app/public/users/user2

    n- Storage/app/public/users/userN

And so on. Is it the correct way to do it?

I'm lost on a thing that seems so easy!!!

jahstation left a reply on Problem Serving Stored File In Local

$url=Storage::url('users/USERX/FILEx.png');
echo "<img src='".asset($url)."' />";

give me a broken link! even if the src seems ok like:

<img src="http://localhost:8000/storage/users/USERX/FILEx.png">

with or without the edit that you suggest me!

jahstation left a reply on Problem Serving Stored File In Local

in my db there is a relative path from users so something like "users/USERX/fileX.png"

what you mean by chancing the root.....

thanks

jahstation started a new conversation Problem Serving Stored File In Local

I've a form that upload even some files for user in a personal user's folder. I've done that with code like:

if(! Storage::disk('public')->has("users/".$username."_".Auth::user()->id))
{
                Storage::makeDirectory("public/users/".$username."_".Auth::user()->id);
 }
$patz="public/users/".$username."_".Auth::user()->id;
$now= new \Carbon\Carbon();
$fileName = 'ddt_'.$username."_".$now->toAtomString().'.'.$request->ddt_file->getClientOriginalExtension();
  $pathComplete=$request->ddt_file->storeAs($patz,$fileName);

then i save the url in db table for having it ready to serve!

This save my files on: /storage/app/local/users/USERX/fileX_date_.originalextension

Then i made a sym link with the instruction php artisan storage:link

But then there is no way to show this file to front end! On my config/filesystem.php there is:

'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

when im using commands like: $url=Storage::url('users/USERX/FILEx.png'); the result is a string like: /storage/users/USERX/fileX.png if i put it in assett() function not works!

where I wrong?

24 Jul
2 years ago

jahstation started a new conversation Change Table For Entrust And Auth

I need to move my default user table as a more complex one that will be "companies", so i need to understand how to move all models and relations of those (Auth and https://github.com/Zizaco/entrust ) for make it works again because now is just a big mess!

I put all field from user in new table called companies, then is better to manual rename the other migrations or is best to solve it from config file and how? thanks to any contributor

04 Jul
2 years ago

jahstation left a reply on Validation Rules Abstraction

rules are the same how can i name error bag then

28 Jun
2 years ago

jahstation left a reply on Validation Rules Abstraction

hold on ive some more problem:

im using modal for creating form on the html/blade page, one is for a new data the other is for editing.

so how can i add this feature with the approach that you show me:

Named Error Bags If you have multiple forms on a single page, you may wish to name the MessageBag of errors, allowing you to retrieve the error messages for a specific form. Simply pass a name as the second argument to withErrors:

return redirect('register') ->withErrors($validator, 'login');

jahstation left a reply on Validation Rules Abstraction

ok i think that now is clear thanks a lot! to resume:

-i can make a general request for store and update method too

-i can add a method like message() to the req class to personalize some of the message? cheers

jahstation left a reply on Validation Rules Abstraction

ehy @Snapey can you please link me some example of this approach style, thanks

27 Jun
2 years ago

jahstation started a new conversation Validation Rules Abstraction

Hi to all, I've a silly question for some expert that drive me crazy and maybe is so simple to solve: validation how to make it aviable for any method on a controller.

If i write a store method inside a controller and i put some validation everything works perfect:

public function store(Request $request) { $this->validate($request, [ 'name' => 'required|max:255', 'business_name' => 'required', 'address' => 'required', 'email' => 'required|email|max:255', 'phone' => 'required|alpha_num', 'vat_number' => 'required|regex:/^[0-9]{11}$/', ]); ..... }

but I'd like to have these rules aviable for any method thats need validation, for example for the update method. And even try to personalize some message; So I add 2 protected variables in my controller called "$rules" and "$message" then ive included the "use Illuminate\Support\Facades\Validator;"

so is like: protected static $messages = [ 'required' => 'The :attribute field is required.', ];

protected static $rules= [
    'name' => 'required|max:255',
    'business_name' => 'required',
    'address' => 'required',
    'email' => 'required|email|max:255',
    'phone' => 'required|alpha_num',
    'vat_number' => 'required|regex:/^[0-9]{11}$/',
];

Then on the method I try to call something like:

public function store(Request $request){

$validator = Validator::make($request, $rules, $messages);

But from that point: 1- the variable rules/message are not aviable, why? 2- is it the correct abstraction? 3- if the Validator::make fail then how the errors are sended back to frontend? do i need to explict it or the old code that using $errors on blade template is still working?

11 Nov
2 years ago

jahstation left a reply on Elixir.ready Is Not A Function

the componets are not loaded by the browser.. . i followed this one step by step! https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13 and how u suggested i put:

npm install vue
npm install -g vue-cli
npm install --save-dev babel-preset-es2015
npm install --save-dev buble-loader buble
npm install -g buble
npm install laravel-elixir-babel --save-dev

then after registering the components on resources/assets/js/app.js and compiling right with gulp, i've inserted the component on my home page. But i can see just a blank panel with nothing... why?