nero

nero

Member Since 3 Years Ago

Experience Points 1,870
Experience Level 1

3,130 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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

19 Jan
5 months ago

nero started a new conversation How To Apply The Translation In The .js Script

I created a page to upload images. I use javascript to enhance the appearance. I want to apply the language translation to the CHANGE button in the xxx.js. script. If the html tag is in the blade as usual I use the {{trans ('global.CHANGE')}} pattern. But how do you write if the CHANGE button code is at xxx.js? How do I write in the javascript code in the xxx.js file? the following code code xxx.js:

            fileReader.onload = function(e) {
                // Show thumbnail and remove button.
                $fileTab.prepend(getImageThumbnailHtml(e.target.result));
                $browseFileButton.find('span').text('CHANGE');
                $removeFileButton.css('display', 'inline-block');
            };

Or is there another way?

01 Jan
5 months ago

nero left a reply on Email Not Sent Using Laravel Queues

@SHEZ1983 - [2019-01-02 02:50:04] local.ERROR: Unable to open file for reading [storage/uploads/member/resume/2018/07/Anggun Jane_153053851833.pdf] {"exception":"[object] (Swift_IoException(code: 0): Unable to open file for reading [storage/uploads/member/resume/2018/07/Anggun Jane_153053851833.pdf] at F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\ByteStream\FileByteStream.php:131) [stacktrace] #0 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\ByteStream\FileByteStream.php(77): Swift_ByteStream_FileByteStream->getReadHandle() #1 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\ContentEncoder\Base64ContentEncoder.php(40): Swift_ByteStream_FileByteStream->read(8192) #2 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMimeEntity.php(555): Swift_Mime_ContentEncoder_Base64ContentEncoder->encodeByteStream(Object(Swift_ByteStream_FileByteStream), Object(Swift_Transport_StreamBuffer), 0, 76) #3 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMimeEntity.php(532): Swift_Mime_SimpleMimeEntity->bodyToByteStream(Object(Swift_Transport_StreamBuffer)) #4 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMimeEntity.php(570): Swift_Mime_SimpleMimeEntity->toByteStream(Object(Swift_Transport_StreamBuffer)) #5 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMimeEntity.php(532): Swift_Mime_SimpleMimeEntity->bodyToByteStream(Object(Swift_Transport_StreamBuffer)) #6 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mime\SimpleMessage.php(601): Swift_Mime_SimpleMimeEntity->toByteStream(Object(Swift_Transport_StreamBuffer)) #7 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Message.php(162): Swift_Mime_SimpleMessage->toByteStream(Object(Swift_Transport_StreamBuffer)) #8 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(398): Swift_Message->toByteStream(Object(Swift_Transport_StreamBuffer)) #9 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(500): Swift_Transport_AbstractSmtpTransport->streamMessage(Object(Swift_Message)) #10 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(516): Swift_Transport_AbstractSmtpTransport->doMailTransaction(Object(Swift_Message), '[email protected]', Array, Array) #11 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(206): Swift_Transport_AbstractSmtpTransport->sendTo(Object(Swift_Message), '[email protected]', Array, Array) #12 F:\xampp\htdocs\fordones\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mailer.php(71): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array) #13 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(479): Swift_Mailer->send(Object(Swift_Message), Array) #14 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(259): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message)) #15 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailable.php(159): Illuminate\Mail\Mailer->send('emails.applicat...', Array, Object(Closure)) #16 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Support\Traits\Localizable.php(19): Illuminate\Mail\Mailable->Illuminate\Mail\{closure}() #17 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailable.php(160): Illuminate\Mail\Mailable->withLocale(NULL, Object(Closure)) #18 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(274): Illuminate\Mail\Mailable->send(Object(Illuminate\Mail\Mailer)) #19 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\Mailer.php(229): Illuminate\Mail\Mailer->sendMailable(Object(App\Mail\Member\Application\ApplicationMail)) #20 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Mail\PendingMail.php(124): Illuminate\Mail\Mailer->send(Object(App\Mail\Member\Application\ApplicationMail)) #21 F:\xampp\htdocs\fordones\app\Jobs\JobApplication.php(40): Illuminate\Mail\PendingMail->send(Object(App\Mail\Member\Application\ApplicationMail)) #22 [internal function]: App\Jobs\JobApplication->handle() #23 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array) #24 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #25 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #26 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\Container.php(572): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #27 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(94): Illuminate\Container\Container->call(Array) #28 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\JobApplication)) #29 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(104): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\JobApplication)) #30 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Bus\Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #31 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\CallQueuedHandler.php(49): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\JobApplication), false) #32 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Jobs\Job.php(83): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array) #33 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(327): Illuminate\Queue\Jobs\Job->fire() #34 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(277): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions)) #35 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Worker.php(230): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions)) #36 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(102): Illuminate\Queue\Worker->runNextJob('database', 'default', Object(Illuminate\Queue\WorkerOptions)) #37 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Queue\Console\WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default') #38 [internal function]: Illuminate\Queue\Console\WorkCommand->handle() #39 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(29): call_user_func_array(Array, Array) #40 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(87): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}() #41 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(31): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure)) #42 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Container\Container.php(572): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL) #43 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Console\Command.php(183): Illuminate\Container\Container->call(Array) #44 F:\xampp\htdocs\fordones\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #45 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Console\Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle)) #46 F:\xampp\htdocs\fordones\vendor\symfony\console\Application.php(886): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #47 F:\xampp\htdocs\fordones\vendor\symfony\console\Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #48 F:\xampp\htdocs\fordones\vendor\symfony\console\Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #49 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Console\Application.php(89): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #50 F:\xampp\htdocs\fordones\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #51 F:\xampp\htdocs\fordones\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #52 {main} "}

nero started a new conversation Email Not Sent Using Laravel Queues

I made a job application using the queue laravel feature. After I tried it the email was not sent.

The program code in the file App\Controller\ApplicationController.php: $data=array( 'from'=>config('mail.from.address'), 'name'=>$userCreator->name, 'userCreatorEmail'=>$userCreator->email, 'telp'=>$existing->phone, 'email'=>$recipients->email, // untuk peneriman multiple 'id'=>$vacancies->id, 'slug'=>$vacancies->slug, 'subject'=>trans('mail.Job application') .' '.ucwords($vacancies->title) .' '. HelpRandom::generateRandomString() .' '. trans('mail.in') .' '.config('app.name'), 'bodyMessage'=>$request->description, 'file'=>$public_path.$existing->resume, );

The program code in the file App\Mail\ApplicationMail.php:

namespace App\Mail; use Mail; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; use Illuminate\Contracts\Queue\ShouldQueue;

class ApplicationMail extends Mailable { use Queueable, SerializesModels;

public $data;


public function __construct($data=[])
{
    $this->data = $data;        
}
public function build()
{
    return $this->from($this->data['from'])
        ->subject($this->data['subject'])
        ->attach($this->data['file'])           
        ->view('emails.application.apply')
        ->with('data',$this->data);             
}

}

The program code in the file App\Jobs\JobAplication.php:

namespace App\Jobs; use Illuminate\Bus\Queueable; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Foundation\Bus\Dispatchable; use App\Mail\ApplicationMail; use Mail; class JobApplication implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $data;

public function __construct($data=[])
{
    $this->data = $data;
}

public function handle()
{

    Mail::to($data['email'])->send(new ApplicationMail($data));     
}

}

Status command line :

php artisan queue:work [2019-01-01 11:17:51][731] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][732] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][733] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][734] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][735] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][736] Processing: App\Jobs\JobApplication [2019-01-01 11:17:52][737] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][738] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][739] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][740] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][741] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][742] Processing: App\Jobs\JobApplication [2019-01-01 11:17:53][743] Processing: App\Jobs\JobApplication

21 Dec
6 months ago

nero started a new conversation How Do I Make A Queue Email Attachment Laravel?

How do I make a queue email attachment Laravel?

My code example:

Mail::send('emails.apply',$data,function($message)use ($data){ $message->attach($data['file']); $message->to($data['email']); $message->subject($data['subject']); $message->from($data['from']); });

16 Dec
6 months ago

nero started a new conversation How Does The Laravel Code Example Send Email To Many Recipients

How does the Laravel code example send email to many recipients. Recipient e-mail address data from the database

15 Jun
1 year ago

nero started a new conversation How Do I Create Multilingual URLs In Laravel 5?

How do I create multilingual URLs in laravel 5?

I have 2 languages. That is Indonesian and English

view/lang/id/routes.php:

return [
     'news' => 'berita',
];

view/lang/en/routes.php:

return [
     'news' => 'news',
];

routes/web.php Route::prefix('news')->group(function() { Route::get('', 'News\[email protected]')->name(''); Route::get('detail/{id}/{slug}', 'News\[email protected]')->name('news.detail'); });

app\Http\Middleware\Localization.php: public function handle($request, Closure $next) { if ( \Session::has('locale')) { \App::setLocale(\Session::get('locale'));

                // You also can set the Carbon locale
                Carbon::setLocale(\Session::get('locale'));
         }
        return $next($request);
    }

So the URL will be as follows: If Indonesian: www.domain.com/berita/

If English: www.domain.com/news/

30 May
1 year ago

nero left a reply on Please Help City_id For Jobs Table And Table Company

@lostdreamer_nl

city or work location is different from the city of the company. Examples eg mining companies. Company Address in City A while address work in City B

nero started a new conversation Please Help City_id For Jobs Table And Table Company

Request referrals and help:

I have a table:

cities table: id,name

companies table: id,city_id, name

jobs table: id,city_id,title, description

city_id in the companies table serves for the company's city data (company address). city_id in the jobs table works for city data work location.

How to write query builder if I want to display data like below? title, description, company_name, job_location, company_location

18 May
1 year ago

nero started a new conversation I Want To Ask Related News Category Updates In Multiple Select Form

I want to ask related news category updates in multiple select form.

News Table:
- id
- title
- news

Table Category:
- id
- name

Table CategoryNews:
- id
- news_id
- category_id

News Category: Legal, Sports, Social, Internet, Entertainment, Education

Sample case: Initially I save data eg news with the title "Knowing Fake News on the Internet" with the category of Social, Internet, and Education. Then I want to change the category of Social and Internet.

The question is: How to write a script to convert the category data into Social and Internet only. And Education Categories automatically delete at execution Update news data?

Here's my code snippet. This code has succeeded to add category data.

$data = $request->all();
foreach ($data['category'] as $i => $value) { 
    $jobe= CategoryNews::updateOrcreate(
        [ 
            'news_id' => $id,
            'category_id' => $data['category'][$i]
        ],
        [
        ]
    );
}

nero left a reply on Undefined Offset: 2

@lostdreamer_nl

What if we want to delete the data we have before? if you remove it in multiple select box?

17 May
1 year ago

nero left a reply on Undefined Offset: 2

@lostdreamer_nl

I've tried but it works. Data is double. Insert data can, but double data Update data can not.

nero started a new conversation Undefined Offset: 2

Initially I had 2 types of education. Then I want to add 1 education but the error message as follows:

"Undefined offset: 2"

Here's my code snippet:

        foreach($request->educatione as $key=>$cond){
        $ServEdu=JobEducation::updateOrCreate(
            [
               'id'=>$request->ho[$key]
            ],
            [
                'job_id' => $id,
                'education_id'=>$cond          
            ]
        ); 
    }

Anyone help to improve my code above?

16 May
1 year ago

nero started a new conversation How To Use The Correct UpdateOrcreate In Laravel?

How to use the correct updateOrcreate in Laravel?

I want to add and change data in the same code. I've been using updateOrcreate but the results are not as desirable.

The code can only change the data, but can not change the data.

My table:

jobs:

    id
    title
    deskription

educations:

    id
    name

job_educations:

    id
    job_id
    education_id

Here's my code snippet:

    public function update(Request $request, $id)
      {                
        $input = Input::all();
            for($i=0;$i<count($condition);$i++){
                JobEducation::updateOrCreate(
                    [
                            'job_id'=>$id, 
                     ],
                     [
                         'job_id'=>$id,                
                            'education_id' => $input ['education'][$i]                   
                    ]
             );
    }

My requirement: I want to change the existing data and add new data.

Can anyone fix my code?

nero left a reply on How Do I Change The Multi-line Data?

@N3

Yes, exactly. if necessary can add to education.

nero left a reply on How Do I Change The Multi-line Data?

Hello @Snapey Can you help me constrain above?

nero started a new conversation How Do I Change The Multi-line Data?

I have a simple table:

jobs: id title description

educations: id name

job_educations: id job_id education_id

Form edit.blade.php I have created. Next I want to create code in the controller to edit educational data.

My needs:

  • The data in the job_educations table is more multiple education.
  • I want to change educational data and add educational data in job_educations table. Here's the code snippet:

public function update(Request $request, $id) { $educations=$request->get('education'); foreach ($educations as $key => $education) { $data=[

            'education_id' => $education
        ];
        \DB::table('job_educations')->where('job_id', $id)->where('education_id',$key)->update($data);
}

How to fix the above code correct?

10 May
1 year ago

nero left a reply on Old Values ​​subcategory Does Not Work After Submit

I have an input form: Title, Description, Category and Sub Category and other fields.

I want to check validation for example title not yet filled. But other forms have been filled. The validation system has been successful.

Dynamically Select Category (parent) and select Sub Category (child) is working properly.

But the problem here is when click Submit Old Values ​​sub category does not work (empty). I hope the subcategory I have selected is empty after submitting. But the actual old values ​​sub category is empty

09 May
1 year ago

nero left a reply on Old Values ​​subcategory Does Not Work After Submit

@Cronix

Sorry different point. This one is a dynamic select option category (parent) and subcategory (child). If yesterday multiple select option

08 May
1 year ago

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

@Snapey

When I change the code of this section as per your code like the following: @if(in_array($education->translation_of,old('education',[])))

Still the following error message appears: "htmlspecialchars() expects parameter 1 to be string, array given (View:

07 May
1 year ago

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

                                            <select name="education[]" id="education" class="form-control sselecter  input-lg" multiple="true" data-placeholder="@lang('global.Select Level Education')"  required>
                                            @foreach ($educations as $education)                                                    
                                            <option value="{{ $education->translation_of}}"
                                                
                                                @if(in_array($education->translation_of,old('education')))    
                                                    selected="selected"
                                                @endif >{{ $education->name }}</option>
                                            @endforeach
                                            </select>

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

@Snapey

I've fixed the above error, but still an error like this: "in_array() expects parameter 2 to be array, null given (View:

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

@Snapey

I've tried the code from you. But still the following error message

"Parse error: syntax error, unexpected ':', expecting '('"

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

@Snapey

I do not understand all of your answers above.

please provide examples of writing code according to my code above

nero left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

@Snapey

If other fields are filled all does not appear error. But if only the contents of the education section just appeared error

06 May
1 year ago

nero left a reply on How To Store Multiple Select And Multi Row Data In Laravel 5?

@AhmadGomaa

translation_of is the primary key. I created this name in multi language

nero started a new conversation Htmlspecialchars() Expects Parameter 1 To Be String, Array Given

I have a form like this.

<select name="education[]" id="education" class="form-control sselecter  input-lg" multiple="true" data-placeholder="@lang('global.Select Level Education')" value="{{old('education') }}" required>
    @foreach ($educations as $education)                                                    
    <option value="{{ $education->translation_of}}"@if (old('education')==$education->translation_of)selected="selected"@endif> {{ $education->name }} </option>
    @endforeach
</select>

But when the contents of the data then Submit the following error message appears: "htmlspecialchars() expects parameter 1 to be string, array given (View:

nero started a new conversation How To Store Multiple Select And Multi Row Data In Laravel 5?

How to store multiple select and multi row data in laravel 5?

I have a table:

educations:
    - id
    - name

job_educations:
    - id
    - education_id

Controller:
    $educations = $request->input('education');
    foreach ($educations as $education) {
        if(!empty($education))
        {
                JobEducation::create([
                'job_id' => $jobID,
                    'education_id'   => $education
                ]);
        }
    }   



Blade:
    <form role="form" files="true"  enctype="multipart/form-data" method="POST" action="{{ 
        route('jobs.create') }}" novalidate>
    <select name="education[]" id="education" class="form-control sselecter select2-    
        hidden-accessible input-lg" multiple tabindex="-1" aria-hidden="true" data-
        placeholder="@lang('global.Select Level Education')" value="{{ old('education') }}" 
        required>
        @foreach ($educations as $education)
            <option value="{{ $education->translation_of}}"@if      
            (old('education')==$education->translation_of)selected="selected"@endif> {{ 
            $education->name }} </option>
        @endforeach
    </select>

Saya sudah mencoba code diatas tapi muncul pesan error berikut ini: "Invalid argument supplied for foreach()"

04 May
1 year ago

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@Vilfago Sorry after I check your program suggestion code has been successful. Thank you for your support. Good Job

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@Vilfago

Maximum salary validation must be greater than the minimum salary has been successful. However, when the maximal salary value is greater than the minimum salary the following message appears:

"The min salary must be a number."

As text conversion to numeric still has not worked

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@Vilfago

error message appears:

"Parse error: syntax error, unexpected ';', expecting ']'"

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@Vilfago

error message appears:

"Can't use method return value in write context"

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@Vilfago

The code you suggest works if numerical to numeric (Does not use conversions). But if text conversion to numeric does not work. How to validate system from text to numeric?

nero left a reply on How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

@somnathsah

How do I enter your code into my code that I wrote above?

nero started a new conversation How To Validate The Maximal Salary To Be Greater Than The Minimum Salary?

I have a table structure: min_salary(float); max_salary(float);

I have form input minimum salary and maximum salary with comma format:

Here's the code snippet for validation: $validatedData = $request->validate([ 'min_salary' => 'required', 'max_salary' => 'required', ]);

My question: How to validate the maximal salary to be greater than the minimum salary?

03 May
1 year ago

nero started a new conversation How To Convert From Salary

I have a pay input form.

How to convert from salary to 100123.12?

nero started a new conversation Old ('subcategory') Does Not Work

I have problems in dynamic categories and sub categories.

old ('subcategory') does not work.

Code Blade: Category: <option value="" data-type=""@if (old('category')=='' or old('category')=='')selected="selected"@endif> Category @foreach ($categories as $cat) <option value="{{ $cat->id}}"@if (old('category')==$cat->id)selected="selected"@endif> {{ $cat->name }} @endforeach

Sub Category:

Java Script: var $ = jQuery.noConflict(); $('#category').change(function() { $.get('categories/' + this.value + '/subcategories.json', function(subcategories) { var $subcategory = $('#subcategory');

        $subcategory.find('option').remove().end();

        $.each(subcategories, function(index, subcategory) {
           // $subcategory.append('<option value="' + subcategory.id + '">' + subcategory.name + '</option>');
            $subcategory.append($('<option/>').attr('value', subcategory.id).text(subcategory.name)); 
        });
    });
});

$(document).ready(function() {
    $(".category option[value='0']").attr("disabled","disabled");
    $(".subcategory option[value='0']").attr("disabled","disabled");
});

Router: Route::get('/jobs/categories/{code}/subcategories.json', function($code){ return \App\Category::where('active',1)->where('parent_id',$code)->get();

nero started a new conversation I Have Minimum Input Form Of Salary And Maximum Salary

I have minimum input form of salary and maximum salary.

How to make validation to maximize salary must be bigger than minimum salary?

following my code:

Validation:

  $validatedData = $request->validate([
    'min_salary' => 'required|',
    'max_salary' => 'required|',

]); v

31 Mar
1 year ago

nero left a reply on How Do I Authenticate User Tables And User_details Tables?

@franckysolo

I have two user tables:

users table: id, name, email, password

user_details table: user_id type address telp city

nero started a new conversation How Do I Authenticate User Tables And User_details Tables?

I am using laravel version 5.6. I have two user tables: users: -id -name -email -password

user_details: -user_id -type -address -telp -city

The question is:

  1. How to create database relation of users table and user_details table?
  2. How do I create user authentication with type = 'Admin' to get into admin page?
26 Mar
1 year ago

nero left a reply on After Login Process, Login Form Can Still Be Accessed. It Should Be Direct To Home.

Mode User.php: class User extends Authenticatable { use Notifiable;

protected $fillable = [
    'name', 'email', 'password','type',
];

protected $hidden = [
    'password', 'remember_token',
];

}

Middleware: CompanyLoginMiddleware.php: class CompanyLoginMiddleware {

public function handle($request, Closure $next)
{
        if(Auth::check() && Auth::user()->type==1)

    {
         return $next($request);
    }
        if(Auth::check() && Auth::user()->type==2)

    {
         return redirect('company/login');
    }       
    else{
        return redirect('company/login');
    }
}

}

CompanyLoginController.php: class CompanyLoginController extends Controller { use AuthenticatesUsers; protected $redirectTo = '/home';

public function __construct()
{
     $this->middleware('guest:companylogin', ['except' => ['logout']]);
}
public function showLoginForm()
{
  return view('company.auth.login');

}
public function login(Request $request)
{
  $this->validate($request, [
    'email'   => 'required|email',
    'password' => 'required|min:6'
  ]);

  if (Auth::guard('companylogin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)) {
    return redirect()->intended(route('company.dashboard'));
  }

return redirect()->back(); }

Kernel.php: protected $routeMiddleware = [ 'companylogin' => \App\Http\Middleware\CompanyLoginMiddleware::class,//Tambah Kayetanus ];

Handler.php: class Handler extends ExceptionHandler { protected $dontReport = [ // ];

/**
 * A list of the inputs that are never flashed for validation exceptions.
 *
 * @var array
 */
protected $dontFlash = [
    'password',
    'password_confirmation',
];

public function report(Exception $exception)
{
    parent::report($exception);
}

public function render($request, Exception $exception)
{

 if ($this->isHttpException($exception)) {
    switch ($exception->getStatusCode()) {

        // not authorized
        case '403':
            return redirect()->back();
            break;

        // not found
        case '404':
            return redirect()->back();
            break;

        // internal error
        case '500':
            return redirect()->back();
            break;

        default:
            return $this->renderHttpException($exception);
            break;
    }
} else {
    return parent::render($request, $exception);
}       

}   

protected function unauthenticated($request, AuthenticationException $exception)
{
    if ($request->expectsJson()) {
        return response()->json(['error' => 'Unauthenticated.'], 401);
    }

            $guard = array_get($exception->guards(), 0);
        switch ($guard) {
            case 'companylogin':
                $login = 'company.login';
            break;
            default:
                $login = 'login';
            break;
        }
    return redirect()->guest(route($login));
}

}

RedirectIfAuthenticated.php: class RedirectIfAuthenticated { public function handle($request, Closure $next, $guard = null) { /if (Auth::guard($guard)->check()) { return redirect('/homex'); } return $next($request);/

          switch ($guard) {
    case 'companylogin':
      if (Auth::guard($guard)->check()) 
      {

              // if (\Auth::user() && \Auth::user()->type == 1)
           if(Auth::check() && Auth::user()->type==1)
          {
                   return redirect()->route('company.dashboard');
          }
      }
      break;
    default:
      if (Auth::guard($guard)->check()) {
                      //if (\Auth::user() && \Auth::user()->type == 2)
               if(Auth::check() && Auth::user()->type==2)
            {
          return redirect('/');
                      }

      }
      break;
  }
  return $next($request);
}

}

nero left a reply on After Login Process, Login Form Can Still Be Accessed. It Should Be Direct To Home.

Still failing.

Login form can still be accessed when the user has been authenticated

25 Mar
1 year ago

nero started a new conversation After Login Process, Login Form Can Still Be Accessed. It Should Be Direct To Home.

I have 3 type user. User Member, User Company and Admin.

Middleware: CompanyMiddleware, AdminMiddleware

I have a problem at login Company. The case is Once the login form login process can still be accessed or still appear on the dashboard page. It should be direct to home.

That's what causes it? how to handle it?

I am using laravel 5.6

01 Sep
1 year ago

nero left a reply on Please How To Upgrade Laravel Version 5.4   To 5.5

Hello Hujjat,

By using composer update: Can i adjust to my finished project using laravel 5.4 ?? Is there any program script that should be adjusted? Or auto adjust?

nero started a new conversation Please How To Upgrade Laravel Version 5.4   To 5.5

Please How to upgrade laravel version 5.4 to 5.5

05 Oct
2 years ago

nero started a new conversation Adding User Type Field In Form Register User

I'm using 5.3 laravel In the users table I add a field type. The following structure: - id - type_id - name - email - password - remember_token - created_at -updated_at

And following table structure types: - id - type - created_at - updated_at

Questions to: How do I register form part of the implementation of the user, the controller and the model in laravel 5.3?

22 Jul
2 years ago

nero left a reply on The Result Is A Picture Can Not Appear In Laravel

Route::post('ajaximage', function(){ if(empty($FILES['file'])) { exit(); } else { /--------------------Start Pengolahan Gambar---------------/ $size = Input::file('file')->getSize(); // ukuran asli file $tmp_name=Input::file('file')->getPathName(); $image = Input::file('file'); // form input gambar //$file = Request::file('file'); $filename = time() . '.' . $image->getClientOriginalExtension(); // Ektensi file asli -----pakai /----start buat nama file-----/ $date=date('ymd'); $hours=date('His'); $kyt='KILO'; $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"; $acakx = ""; for($i=0; $i<12; $i++) $acakx.=$chars[mt_rand(0,strlen($chars)-1)]; $name_rand1=$date.$hours.$kyt.$acakx; $name_rand2 = rand(1000,100000)."-".$filename; $file_name=$name_rand1."content".$name_rand2; $finish_file_name = strtolower($file_name); /----end buat nama file-----/

    $dir_name = "uploads/event/content/"; // folder tempat upload file
    $path = public_path($dir_name.$finish_file_name); // lokasi penyimpanan gambar 
    $widthx=450; //lebar gambar
    $sizexx=GetimageSize($tmp_name); //Mengambil ukuran gambar yang asli
    $heightx=round($widthx*$sizexx[1]/$sizexx[0]); // rumus konversi mengecilkan gambar
    
    Image::make($image->getRealPath())->resize($widthx, $heightx)->save($path); // Membuat ulang gambar sesuai dengan ukuran baru
        

    //$destinationPath = public_path().'/uploads/event/content/';
    //$filename = $file->getClientOriginalName();
    //$file->move($destinationPath, $filename);
    echo url().'/uploads/event/content/'.$finish_file_name;
}

});