SupunSam

SupunSam

Project Coordinator at RRD

Member Since 6 Months Ago

Colombo

Experience Points
3,060
Total
Experience

1,940 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
1
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.

Level 1
3,060 XP
Feb
23
6 hours ago
Activity icon

Replied to Laravel Excel Export With HasOne Relationship

Hi, I reviewed your previous answer. I think there is a misunderstanding. My JobPreflight Modal contains a column called preflgiht. It has a binary value. So I'm running this query to retrieve all the jobs where in preflight column value is "1".

As per your previous answer, it searches for id value of "1".

Activity icon

Replied to MS SQL Error When Running A Laravel Seeder

Thank you for taking your time for this. Please see below:

 Illuminate\Database\QueryException  : SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'. (SQL: describe profiles)

  at C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
  > 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
    669| 

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'.")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  2   PDOStatement::execute()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  3   Illuminate\Database\Connection::Illuminate\Database\{closure}("describe profiles", [])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:658

  4   Illuminate\Database\Connection::runQueryCallback("describe profiles", [], Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:625

  5   Illuminate\Database\Connection::run("describe profiles", [], Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:334

  6   Illuminate\Database\Connection::select("describe profiles")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php:349

  7   Illuminate\Database\DatabaseManager::__call("select")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:239

  8   Illuminate\Support\Facades\Facade::__callStatic("select")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\haruncpi\laravel-id-generator\src\IdGenerator.php:12

  9   Haruncpi\LaravelIdGenerator\IdGenerator::getFieldType("profiles", "id")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\haruncpi\laravel-id-generator\src\IdGenerator.php:50

  10  Haruncpi\LaravelIdGenerator\IdGenerator::generate(["profiles", "PF"])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\app\Profile.php:22

  11  App\Profile::App\{closure}(Object(App\Profile))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:347

  12  Illuminate\Events\Dispatcher::Illuminate\Events\{closure}("eloquent.creating: App\Profile")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:196

  13  Illuminate\Events\Dispatcher::dispatch("eloquent.creating: App\Profile")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:169

  14  Illuminate\Events\Dispatcher::until("eloquent.creating: App\Profile", Object(App\Profile))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasEvents.php:188

  15  Illuminate\Database\Eloquent\Model::fireModelEvent("creating")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:787

  16  Illuminate\Database\Eloquent\Model::performInsert(Object(Illuminate\Database\Eloquent\Builder))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:667

  17  Illuminate\Database\Eloquent\Model::save()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\HasOneOrMany.php:252

  18  Illuminate\Database\Eloquent\Relations\HasOneOrMany::save(Object(App\Profile))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\app\User.php:33

  19  App\User::App\{closure}(Object(App\User))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:347

  20  Illuminate\Events\Dispatcher::Illuminate\Events\{closure}("eloquent.created: App\User")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:196

  21  Illuminate\Events\Dispatcher::dispatch("eloquent.created: App\User")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasEvents.php:188

  22  Illuminate\Database\Eloquent\Model::fireModelEvent("created")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:825

  23  Illuminate\Database\Eloquent\Model::performInsert(Object(Illuminate\Database\Eloquent\Builder))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:667

  24  Illuminate\Database\Eloquent\Model::save()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:749

  25  Illuminate\Database\Eloquent\Builder::Illuminate\Database\Eloquent\{closure}(Object(App\User))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\helpers.php:424

  26  tap(Object(App\User), Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php:750

  27  Illuminate\Database\Eloquent\Builder::create(["111111", "SuperAdmin", "OSL", "y$X75D2B3UbEqrKos4DOfL.e7ig1PAHS/Jp90qAIx5Hk.mD3nm1PA3O"])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:23

  28  Illuminate\Database\Eloquent\Model::forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), "create")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1618

  29  Illuminate\Database\Eloquent\Model::__call("create")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php:1630

  30  Illuminate\Database\Eloquent\Model::__callStatic("create")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\database\seeds\UsersTableSeeder.php:26

  31  UsersTableSeeder::run()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  32  call_user_func_array([])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  33  Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\helpers.php:522

  34  value(Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:90

  35  Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:34

  36  Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\Container.php:591

  37  Illuminate\Container\Container::call()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Seeder.php:124

  38  Illuminate\Database\Seeder::__invoke()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Seeder.php:44

  39  Illuminate\Database\Seeder::call("UsersTableSeeder")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\database\seeds\DatabaseSeeder.php:15

  40  DatabaseSeeder::run()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  41  call_user_func_array([])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  42  Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\helpers.php:522

  43  value(Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:90

  44  Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:34

  45  Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\Container.php:591

  46  Illuminate\Container\Container::call()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Seeder.php:124

  47  Illuminate\Database\Seeder::__invoke()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Console\Seeds\SeedCommand.php:63

  48  Illuminate\Database\Console\Seeds\SeedCommand::Illuminate\Database\Console\Seeds\{closure}()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\GuardsAttributes.php:122

  49  Illuminate\Database\Eloquent\Model::unguarded(Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Console\Seeds\SeedCommand.php:64

  50  Illuminate\Database\Console\Seeds\SeedCommand::handle()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  51  call_user_func_array([])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

  52  Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Support\helpers.php:522

  53  value(Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:90

  54  Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:34

  55  Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Container\Container.php:591

  56  Illuminate\Container\Container::call()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Console\Command.php:202

  57  Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\symfony\console\Command\Command.php:255

  58  Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Console\Command.php:189

  59  Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\symfony\console\Application.php:1012

  60  Symfony\Component\Console\Application::doRunCommand(Object(Illuminate\Database\Console\Seeds\SeedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\symfony\console\Application.php:272

  61  Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\symfony\console\Application.php:148

  62  Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Console\Application.php:90

  63  Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:131

  64  Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\artisan:37

Feb
21
2 days ago
Activity icon

Started a new Conversation MS SQL Error When Running A Laravel Seeder

I recently changed my db from mysql to SQL Server.

I was able to run the migrations however I am unable to run Seeders.

Illuminate\Database\QueryException  : SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'. (SQL: describe profiles)

  at C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:665
    661|         // If an exception occurs when attempting to run a query, we'll format the error
    662|         // message to include the bindings with SQL, which will make this exception a
    663|         // lot more helpful to the developer instead of just the database's errors.
    664|         catch (Exception $e) {
  > 665|             throw new QueryException(
    666|                 $query, $this->prepareBindings($bindings), $e
    667|             );
    668|         }
    669| 

  Exception trace:

  1   PDOException::("SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Could not find stored procedure 'describe'.")
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  2   PDOStatement::execute()
      C:\Users\Supun Samarakoon\Desktop\Laravel Projects\RRD Projects\FPOne\vendor\laravel\framework\src\Illuminate\Database\Connection.php:331

  Please use the argument -v to see more details.

Seeder

$superadminRole = Role::where('name', 'superadmin')->first();
        $adminRole = Role::where('name', 'admin')->first();
        $leadRole = Role::where('name', 'lead')->first();
        $userRole = Role::where('name', 'user')->first();

        $superadmin = User::create([
            'id' => '232323',
            'username' => 'SuperAdmin',
            'site' => 'GSS',
            'password' => bcrypt('superadmin')
        ]);

        $superadmin->roles()->attach($superadminRole);
        $superadmin->roles()->attach($adminRole);
        $superadmin->roles()->attach($leadRole);
        $superadmin->roles()->attach($userRole);

        $user->roles()->attach($userRole);

Can anyone help me ?

Activity icon

Replied to Laravel Excel Export With HasOne Relationship

These are my relationships:

Job

public function job()
    {
        return $this->hasOne(Job::class, 'id', 'job_id');
    }

Preflight

public function jobPreflight()
    {
        return $this->hasOne(JobPreflight::class);
    }
Activity icon

Replied to Laravel Excel Export With HasOne Relationship

I understand what you are saying @bobbybouwmann :-). I intended something to happen but this is not the way. Kindly help me to make this work.

Activity icon

Replied to Laravel Excel Export With HasOne Relationship

I want to export all data from the JobPreflight model alongside with some data from the Job Model. JobPreflight model has a column called preflight and I'm trying to get where the boolean value is 1.

I found something that relates to Laravel Excel. But unable to get it right. I am using the "collection" method here. but in order to get data from relationships, I might have to use a "query" instead of a collection.

public function collection()
    {
        $usersite = Auth::user()->site;

            return JobPreflight::wherePreflight('1')
                ->whereIn('status', ['Awaiting Comp', 'In Progress', 'On Hold', 'Cancelled'])
                ->wheremfg_site($usersite)
                ->with('job:id,job_key,type,job_no,')
                ->get();
        
    }

I tried changing from collection to query. but it did not work. I am really bad with DB queries. maybe that's why.

Activity icon

Replied to Laravel Excel Export With HasOne Relationship

Hi @bobbybouwmann..

Thank you very much for your valuable suggestion. I have one problem. I use this same code to get the data for my data table. That's why I used it for export as well.

Feb
20
3 days ago
Activity icon

Started a new Conversation Laravel Excel Export With HasOne Relationship

Hi All,

I am trying to export database data to excel using the following code in my export file:

return JobPreflight::wherePreflight('1')
                ->whereIn('status', ['Awaiting Comp', 'Cancelled'])
                ->wheremfg_site($usersite)
                ->with('job:id,job_key,type,job_no,due_out')
                ->get();

However, I only get the data from the Preflight table. Surprisingly this exact same code is working for my view when I create my data table.

Why I am not getting data from my hasone relationship.

Feb
11
1 week ago
Activity icon

Replied to Authenticate Username And Password From A Web Service ?

Hi @sti3bas. Thank you very much. I was able to crack this with your directions. I used as follows:

$xml = simplexml_load_string($response->getBody());

Thank you very much for this my friend. Thanks

Activity icon

Replied to Authenticate Username And Password From A Web Service ?

@sti3bas. Thank you very much. I was able to get the response. Somehow I am unable to get the xml from there.

Call to undefined method GuzzleHttp\Psr7\Response::xml()

However, the following is the response when I dd it:

GuzzleHttp\Psr7\Response {#359 ▼
  -reasonPhrase: "OK"
  -statusCode: 200
  -headers: array:7 [▶]
  -headerNames: array:7 [▶]
  -protocol: "1.1"
  -stream: GuzzleHttp\Psr7\Stream {#347 ▶}
}
Activity icon

Replied to Authenticate Username And Password From A Web Service ?

Thank you very much @sti3bas. I will test this and reply back. This is what I was looking for. I had no idea where to do this. Thank you. Do I need to save this URL in my ENV for protection?

Activity icon

Started a new Conversation Authenticate Username And Password From A Web Service ?

Hi All,

I am using default laravel auth to authenticate my users. However now I need to use a web service to authenticate users. It provides a URL and I need to send username password via this URL and if it will return me an XML response.

Web Service URL:

gossodev1.test.com/SSO.ASMX/AuthenticateUserCredential_Details?UserName=string&Password=string&Domain=string

Web Service response for correct username & password also a domain field:

<?xml version="1.0" encoding="utf-8"?>
<SSO_Details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://TESTGO/webservices/">
    <STATUS>1</STATUS>
    <EMPID />
    <NAME>Supun Samarakoon</NAME>
    <PEOPLESOFTID>112233</PEOPLESOFTID>
    <EMAILID>[email protected]</EMAILID>
    <WINDOWSLOGINID>rr112233</WINDOWSLOGINID>
    <DOMAIN>as</DOMAIN>
</SSO_Details>

If credentials wrong it will return this:

<?xml version="1.0" encoding="utf-8"?>
<SSO_Details xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://TESTGO/webservices/">
    <STATUS>0</STATUS>
    <MESSAGE>The user name or password is incorrect.
</MESSAGE>
</SSO_Details>

And I need to check my users table for this user as well. For example, if the user passed this again it should check my database users table for user id. And if that succeeds only then the user will be authenticated.

What can I do to integrate this with my laravel app.

Feb
07
2 weeks ago
Activity icon

Replied to Route Type For Eloquent Replicate ?

Hi @sinnbeck. Sorry, I mistakenly put that. I used POST and Its working. Thank you for your help.

Activity icon

Awarded Best Reply on Route Type For Eloquent Replicate ?

Got it working. In my ajax URL, there was an additional part /activity/.


$("#dupl_btn").click(function() {
        $.ajax({
            type: "POST",
            url: "/jobDuplicate/" + job_id,
            success: function(data) {
                $("#duplicateModal").modal("hide");
                Toast.fire({
                    type: "success",
                    title:
                        "Job " + $(".jcId").html() + " Duplicated Succussfully."
                });
                $("#dailyJobsTable")
                    .DataTable()
                    .ajax.reload();
            }
        });
    });

Also, I needed to change my controller as well to the following:

$job = Job::find($id);
        $newJob = $job->replicate();
        $newJob->save();
Activity icon

Replied to Route Type For Eloquent Replicate ?

Got it working. In my ajax URL, there was an additional part /activity/.


$("#dupl_btn").click(function() {
        $.ajax({
            type: "POST",
            url: "/jobDuplicate/" + job_id,
            success: function(data) {
                $("#duplicateModal").modal("hide");
                Toast.fire({
                    type: "success",
                    title:
                        "Job " + $(".jcId").html() + " Duplicated Succussfully."
                });
                $("#dailyJobsTable")
                    .DataTable()
                    .ajax.reload();
            }
        });
    });

Also, I needed to change my controller as well to the following:

$job = Job::find($id);
        $newJob = $job->replicate();
        $newJob->save();
Activity icon

Replied to Route Type For Eloquent Replicate ?

Thank you for your reply. I tried PATCH at first. But it returned me the following error:

PATCH http://fpone.homestead/activity/jobDuplicate/JB00000001 404 (Not Found)
Activity icon

Started a new Conversation Route Type For Eloquent Replicate ?

I am trying to use replicate in my controller. However, I am unable to find a correct route type for this. Can anyone help me? Code as follows :

Controller

public function jobDuplicate($id)
    {
        Job::find($id)->replicate()->save();
    }

JS

$("#dupl_btn").click(function() {
        $.ajax({
            type: "GET",
            url: "/activity/jobDuplicate/" + job_id,
            success: function(data) {
                $("#duplicateModal").modal("hide");
                Toast.fire({
                    type: "success",
                    title:
                        "Job " + $(".jcId").html() + " Duplicated Succussfully."
                });
                $("#dailyJobsTable")
                    .DataTable()
                    .ajax.reload();
            }
        });
    });

Route

Route::get('/jobDuplicate/{job_id}', '[email protected]')->name('jobDuplicate');
Activity icon

Awarded Best Reply on Relation Id Return Null In Seeder

Hi @sinnbeck.

While I thanking you for the suggestion I was able to find the issue. I am missing primary in my migration. since this is a custom primary key.

 $table->string('id', 8)->primary();

I only had to change my migrations and set public $incrementing = false; in my models.

Thank you very much.

Feb
06
2 weeks ago
Activity icon

Replied to Relation Id Return Null In Seeder

Hi @sinnbeck.

While I thanking you for the suggestion I was able to find the issue. I am missing primary in my migration. since this is a custom primary key.

 $table->string('id', 8)->primary();

I only had to change my migrations and set public $incrementing = false; in my models.

Thank you very much.

Activity icon

Replied to Relation Id Return Null In Seeder

Yes..

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`fponeprime`.`profiles`, CONSTRAINT `profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) (SQL:
insert into `profiles` (`user_id`, `id`, `updated_at`, `created_at`) values (0, PF000001, 2020-02-06 20:50:40, 2020-02-06 20:50:40))
Activity icon

Replied to Relation Id Return Null In Seeder

Hi @sinnbeck

Thank you for your suggestion. I tried your fix. But still giving me the same error.

$user = User::create([
            'id' => 'rr000004',
            'username' => 'User',
            'emp_id' => '444444',
            'site' => 'FPP',
            'password' => bcrypt('user'),
        ]);

User::each(function ($user) {
            Profile::create([
                'user_id' => (string) $user->id,
            ]);
        });
Activity icon

Started a new Conversation Relation Id Return Null In Seeder

Hi All,

I'm trying to run the seeder but it's giving me the following error:

I can see that user_id return null. But cannot understand why. Because user info is saved in the table.

Error Message

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`fponeprime`.`profiles`, CONSTRAINT `profiles_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) (SQL:
insert into `profiles` (`user_id`, `id`, `updated_at`, `created_at`) values (0, PF000001, 2020-02-06 20:25:22, 2020-02-06 20:25:22))

User Seeder

$user = User::create([
            'username' => 'User',
            'emp_id' => '444444',
            'site' => 'FPP',
            'password' => bcrypt('user'),
        ]);

User::each(function ($user) {
            Profile::create([
                'user_id' => $user->id,
            ]);
        });

User Migration

public function up()
    {
        Schema::create('users', function (Blueprint $table) {

            $table->string('id', 8)->unique();
            $table->string('username', 25)->unique();
            $table->string('emp_id', 6)->unique();
            $table->string('site', 3)->index();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
            $table->timestamp('deleted_at')->nullable();
        });
    }

Profile Migration

public function up()
    {
        Schema::create('profiles', function (Blueprint $table) {

            $table->string('id', 8)->unique();
            $table->string('user_id', 8)->unique();
            $table->string('first_name', 25)->nullable();
            $table->string('last_name', 25)->nullable();
            $table->timestamps();
            $table->timestamp('deleted_at')->nullable();

            $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
        });
    }

User Model Relationship

public function profile()
    {
        return $this->hasOne(Profile::class);
    }

Profile Model Relationship

public function user()
    {
        return $this->belongsTo(User::class);
    }

What could be the error here ??

Feb
05
2 weeks ago
Activity icon

Replied to Validate A New Value Generated In Controller ?

Hi @alanholmes.

Thank you very much exactly what I was hoping for. Thank you very much my friend.

Activity icon

Started a new Conversation Validate A New Value Generated In Controller ?

Hi All,

I am getting two form requests inputs and creating new value for saving into database. As follows:

$job->job_id = $request->input('job_no') . $request->input('cyc_no');

However, since this job_id is not coming from the form request, my Request Validation file is unable to validate this.

This must be a unique value. I am getting SQL error while trying to save this.

Feb
01
3 weeks ago
Activity icon

Awarded Best Reply on Pass Data From Ajax Call To Controller

I was using the data function incorrectly in my ajax request. It should be as below. Silly me.

ajax: {
                url: "mainActivity",
                type: "GET",
                data: function(data) {
                    // URI Shortner
                    for (var i = 0, len = data.columns.length; i < len; i++) {
                        if (!data.columns[i].search.value)
                            delete data.columns[i].search;
                        if (data.columns[i].searchable === true)
                            delete data.columns[i].searchable;
                        if (data.columns[i].orderable === true)
                            delete data.columns[i].orderable;
                        if (data.columns[i].data === data.columns[i].name)
                            delete data.columns[i].name;
                    }
                    delete data.search.regex;

                    // Date Range Info
                    data.from_date = $("#from_date").val();
                    data.to_date = $("#to_date").val();
                }
            },
Activity icon

Replied to Pass Data From Ajax Call To Controller

I was using the data function incorrectly in my ajax request. It should be as below. Silly me.

ajax: {
                url: "mainActivity",
                type: "GET",
                data: function(data) {
                    // URI Shortner
                    for (var i = 0, len = data.columns.length; i < len; i++) {
                        if (!data.columns[i].search.value)
                            delete data.columns[i].search;
                        if (data.columns[i].searchable === true)
                            delete data.columns[i].searchable;
                        if (data.columns[i].orderable === true)
                            delete data.columns[i].orderable;
                        if (data.columns[i].data === data.columns[i].name)
                            delete data.columns[i].name;
                    }
                    delete data.search.regex;

                    // Date Range Info
                    data.from_date = $("#from_date").val();
                    data.to_date = $("#to_date").val();
                }
            },
Jan
30
3 weeks ago
Activity icon

Started a new Conversation Pass Data From Ajax Call To Controller

I am trying to pass 2 dates to the controller to filter data table by custom date range. My problem is I am unable to pass any data from JS to the controller. It always returns null

View

<div class="row input-daterange">
                <div class="col-md-4">
                    <input type="text" name="from_date" id="from_date" class="form-control datepicker-activity" placeholder="From Date" readonly />
                </div>
                <div class="col-md-4">
                    <input type="text" name="to_date" id="to_date" class="form-control datepicker-activity" placeholder="To Date" readonly />
                </div>
                <div class="col-md-4">
                    <button type="button" name="filter" id="filter" class="btn btn-primary">Filter</button>
                    <button type="button" name="refresh" id="refresh" class="btn btn-default">Refresh</button>
                </div>
            </div>

        </div>
        <!-- Card-Body -->
        <div class="card-body">

            <table id="mainJobsTable" class="table table-bordered table-hover JobsTable" width="100%">
                <thead>
                    <tr>
                        <!-- 0 -->
                        <th>ID</th>
                        <!-- 1 -->
                        <th>Action</th>
                        <!-- 2 -->
                        <th>JobID</th>

My JS

    load_data();

    // DataTable
    function load_data(from_date = "", to_date = "") {
        $("#mainJobsTable").DataTable({
            processing: true,
            serverSide: true,
            ajax: {
                url: "mainActivity",
                type: "GET",

                data: function(data) {
                    for (var i = 0, len = data.columns.length; i < len; i++) {
                        if (!data.columns[i].search.value)
                            delete data.columns[i].search;
                        if (data.columns[i].searchable === true)
                            delete data.columns[i].searchable;
                        if (data.columns[i].orderable === true)
                            delete data.columns[i].orderable;
                        if (data.columns[i].data === data.columns[i].name)
                            delete data.columns[i].name;
                    }
                    delete data.search.regex;
                },
                function(d) {
                    d.from_date = $(input[(name = from_date)]).val();
                    d.to_date = $(input[(name = to_date)]).val();
                }
            },

            headers: {
                "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
            },

            dom:
                "<'row'<'col'l>" /* Length changing input control */ +
                "<'col'B>" /* Buttons */ +
                "<'col'f>>" /* Filtering Input */ +
                "<'row'<'col'tr>>" /* The Table! + Processing Display Element*/ +
                "<'row'<'col'i>" /* Table Information Summary */ +
                "<'col'p>>" /* Pagination Control*/,

            order: [[18, "asc"]],

            columns: [
                /* 0 */ {
                    data: "id",
                    name: "id",
                    visible: false
                },
                /* 1 */ {
                    data: "action",
                    name: "action",
                    orderable: false,
                    searchable: false
                },
                /* 2 */ {
                    data: "job_id",
                    name: "job_id"
                },
                /* 3 */ {
                    data: "type",
                    name: "type"
                },    load_data();

    // DataTable
    function load_data(from_date = "", to_date = "") {
        $("#mainJobsTable").DataTable({
            processing: true,
            serverSide: true,
            ajax: {
                url: "mainActivity",
                type: "GET",

                data: function(data) {
                    for (var i = 0, len = data.columns.length; i < len; i++) {
                        if (!data.columns[i].search.value)
                            delete data.columns[i].search;
                        if (data.columns[i].searchable === true)
                            delete data.columns[i].searchable;
                        if (data.columns[i].orderable === true)
                            delete data.columns[i].orderable;
                        if (data.columns[i].data === data.columns[i].name)
                            delete data.columns[i].name;
                    }
                    delete data.search.regex;
                },
                function(d) {
                    d.from_date = $(input[(name = from_date)]).val();
                    d.to_date = $(input[(name = to_date)]).val();
                }
            },

            headers: {
                "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
            },

            dom:
                "<'row'<'col'l>" /* Length changing input control */ +
                "<'col'B>" /* Buttons */ +
                "<'col'f>>" /* Filtering Input */ +
                "<'row'<'col'tr>>" /* The Table! + Processing Display Element*/ +
                "<'row'<'col'i>" /* Table Information Summary */ +
                "<'col'p>>" /* Pagination Control*/,

            order: [[18, "asc"]],

            columns: [
                /* 0 */ {
                    data: "id",
                    name: "id",
                    visible: false
                },
                /* 1 */ {
                    data: "action",
                    name: "action",
                    orderable: false,
                    searchable: false
                },
                /* 2 */ {
                    data: "job_id",
                    name: "job_id"
                },
                /* 3 */ {
                    data: "type",
                    name: "type"
                },

 rowGroup: {
                dataSrc: "due_date"
            }
        });
    }


$("#filter").click(function() {
        var from_date = $("#from_date").val();
        var to_date = $("#to_date").val();

        console.log(from_date, to_date);

        if (from_date != "" && to_date != "") {
            $("#mainJobsTable")
                .DataTable()
                .destroy();
            load_data(from_date, to_date);
        } else {
            alert("Both Date is required");
        }
    });

My Controller

public function mainActivity(Request $request)
    {

        $usersite = Auth::user()->site;

        // dd($request->from_date);

        if (request()->ajax()) {

            if (!empty($request->from_date)) {
                $jobs = Job::wheremfg_site($usersite)->whereStatus('Completed')->whereBetween('completed_at', [$request->get(from_date), $request->geta(to_date)])->get();
            } else {
                $jobs = Job::wheremfg_site($usersite)->whereStatus('Completed')->get();
            }

            return DataTables::of($jobs)
                ->addColumn('action', function ($jobs) {
                    $button = '<div class="btn-group btn-group-xs">';
                    $button .= '<a href="/activity/' . $jobs->id . '/edit" class="btn btn-primary btn-xs"><i class="fa fa-edit fa-fw"></i>&nbsp;Edit</a>';
                    $button .= '<button type="button" name="deleteButton" id="' . $jobs->id . '" data-jobcycid="' . $jobs->job_no . ' | ' . $jobs->cyc_no . '" class="btn btn-danger btn-xs deleteButton"><i class="fas fa-trash-alt"></i>&nbsp;Delete</button>';
                    $button .= '</div>';
                    return $button;
                })

               return datatables()->of($jobs)->make(true);

                })

My problem is I cannot pass from_date variable from JS to Controller.

This is a very long code. Hence kindly apolagize fro the typo and other mistakes I had to do to make it short.

Jan
27
3 weeks ago
Activity icon

Replied to How To Filter Retrieved Data From Relational Tables

@bobbybouwmann . Yes. I figured that out later. silly me. :-). Thank you for your help.

Jan
25
4 weeks ago
Activity icon

Replied to Pass Data From Controller To Modal

Hi @ahmeddabak. Thank you very much. It worked.

Activity icon

Replied to Pass Data From Controller To Modal

@ahmeddabak Thank you for the response.

I am getting the following response

<div class="form-check">checked<label>user</label></div>
Activity icon

Started a new Conversation Pass Data From Controller To Modal

Hi All,

I am trying to pass my user role information to a modal.

Modal:

<!-- Edit User Model Box -->
<div id="editUserModal" class="modal fade" role="dialog">
<div class="modal-dialog modal-md">
<div class="modal-content bg-default">
<div class="modal-header bg-success">
<h4 class="modal-title">Edit User Data</h4>
</div>

<form class="form-horizontal" id="editUser" data-parsley-validate>
@method('PUT')
@csrf

<div class="modal-body">

<div class="row align-items-center">

<div class="col">

<div class="form-group">
    <div class="col-md">
        <label for="editUsername">Update User</label>
        <input type="text" class="form-control" id="editUsername" value="" data-parsley-required-message="Username Cannot be empty"
            placeholder="Enter UserName" autocomplete="off" required>
    </div>
</div>
<div class="form-group">
    <div class="col-md">
        <label for="editEmpid">Employee ID</label>
        <input type="text" class="form-control" id="editEmpid" value="" data-parsley-required-message="Employee ID Cannot be empty"
            placeholder="Enter Employee ID" autocomplete="off" required>
    </div>
</div>

<div class="form-group">
    <div class="col-md">
        <label for="editSite">Site</label>
        <input type="text" class="form-control" id="editSite" value="" data-parsley-required-message="User Site Cannot be empty"
            placeholder="Enter disignated Site(eg:OSL,OFC..)" autocomplete="off" required>
    </div>
</div>

</div>

<div class="col" id="rolesec">


</div>

</div>

</div>

<div class="modal-footer">
<!--Hidden Inputs -->
<button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button>
<a type="submit" id="edit_user_btn" name="edit_user_btn" value="submit" href="{{route('superadmin.userEditCancel')}}"
class="btn btn-success">Update User</a>
</div>
</form>

</div>
</div>
</div>
<!-- /.Edit User Model Box -->

Controller:

public function edit(Request $request, $id)
    {

        if (Gate::denies('manage-users')) {
            Alert::toast('You dont have permissions to access User Manager.', 'error');
            return redirect(route('dashboard'));
        }

        if (Auth::user()->id == $id) {
            Alert::toast('You are not allowed to edit yourself.', 'error');
            return redirect()->route('superadmin.users.index');
        }

        $user = User::find($id);
        $roles = Role::all();


        foreach ($roles as $role) {
            $modalrole = '<div class="form-check">';
            $modalrole .= '<input type="checkbox" name="roles[]" value="' . $role->id . '"' . $user->hasAnyRole($role->name) ? 'checked' : "" . '>';
            $modalrole .= '<label>' . $role->name . '</label>';
            $modalrole .= '</div>';
            return $modalrole;
        };
        return;
    }

JS:

// Edit User Button Action
    $(document).on("click", ".editUser_btn", function() {
        // Delete User Modal
        $("#editUserModal").modal("show");
        user_id = sanitizeHTML($(this).attr("id"));

        // Show Roles

        $.ajax({
            url: "users/" + user_id + "/edit/",
            type: "GET",
            dataType: "html"
        }).done(function(response) {
            $("#editUserModal")
                .find("#rolesec")
                .html(response);
        });
    });

I am unable to get this right: What am I doing wrong here ?

Jan
21
1 month ago
Activity icon

Replied to How To Filter Retrieved Data From Relational Tables

Still an error. :(

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'where clause' (SQL: select * from `job_records` where `status` = In Progress and `job_records`.`deleted_at` is null)
Activity icon

Replied to How To Filter Retrieved Data From Relational Tables

Hi @bobbybouwmann. Extremely sorry. I will explain. I have 2 Models. "Job" and "JobRecord". These two have hasOne relationship.

status is a column from job model. I can retrieve all data with hasOne relationship. But unable to filter by status column.

Activity icon

Replied to How To Filter Retrieved Data From Relational Tables

Hi @bobbybouwmann.

Thank you very much for your reply. However, it seems this query searches through the JobRecord Data Model. this filter is on the relation. Which is the Job data modal.

It gives me this error:

Call to undefined relationship [job:job_id,status,mfg_site,total_pges,due_out] on model [App\JobRecord].
Jan
20
1 month ago
Activity icon

Started a new Conversation How To Filter Retrieved Data From Relational Tables

Hi All,

I am retrieving data from a relational data table from the database as follows:

$job_records = JobRecord::with('job:job_id,status,mfg_site,total_pges,due_out')->get();

The above is working fine. But it's giving me all the data from the table. I want to retrieve the data, based on some column values. status column has a value of "In Progress". and I want to filter the mg_site columns as well.

How can I do this ?

Jan
16
1 month ago
Activity icon

Replied to How To Check The Password Before Log In

Hi @fylzero. Thank you very much for this awesome suggestion. It must be the middleware. Worked perfectly. Thank you very much.

Activity icon

Replied to How To Check The Password Before Log In

Hi @singhwithlaravel. Thank you very much for your suggestion. I tried your method and it worked for me. However, I chose to go with the middleware option provided by @fylzero. Anyway, thank you very much for your input and help. Very much appreciated.

Activity icon

Replied to Connect Laravel With SAML IDP

Hi @skauk. Thank you very much for this information. I was clueless even how to approach this. But I will definitely look into this and keep you posted if it works for me.

Activity icon

Replied to How To Check The Password Before Log In

Shall I use Login Controller then ?

Activity icon

Replied to How To Check The Password Before Log In

@singhwithlaravel. As of now, I do not use any package. Only default laravel Auth.

Activity icon

Started a new Conversation How To Check The Password Before Log In

I am adding users with a default password. Now I am trying to prompt the user if he has submitted the default password he will be redirected to a Password change page so he can add his own password.

From where can I check the password before log in?

Jan
15
1 month ago
Activity icon

Started a new Conversation Connect Laravel With SAML IDP

Hi All,

I have created an App using the default laravel Auth. However now I need to replace that with an SSO service.

How can I do this? I've already looked into https://github.com/aacotroneo/laravel-saml2.

But as per my understanding, it will help you turn your app into a service provider. I just need to replace my default authentication system with this SAML IDP.

Can anyone help me with this?

Jan
06
1 month ago
Activity icon

Replied to Laravel Excel Filtered Excel Download For Different Routes

Hi @nakov.

Thank you very much for your pointers. I was able to get this done by your thought process. Thank you very much my friend.

Jan
05
1 month ago
Activity icon

Replied to Laravel Excel Filtered Excel Download For Different Routes

Hi @nakov, Thank you for your advice.

I used your method as it is but it was doing the same filter for both routes. Then I added an else if condition and now it gives me an error.

Controller

    public function jobsExport($currentRoute)
    {

        $currentRoute = Route::current()->getName();

        return Excel::download(new JobsExport($currentRoute), 'Jobs-' . Carbon::now() . '.xlsx', \Maatwebsite\Excel\Excel::XLSX);
        Alert::toast('Jobs Exported into Excel', 'info');
    }

Exports

private $currentRoute;

    public function __construct($currentRoute)
    {
        $this->currentRoute = $currentRoute;
    }

    public function collection()
    {

        if ($this->currentRoute == 'activity') {
            return Job::whereStatus('In Progress')->get();
        } elseif ($this->currentRoute == 'mainActivity') {
            return Job::whereStatus('Completed')->get();
        }

    }

Wondering what went wrong. According to the log file, it is a:

[2020-01-05 18:24:05] local.ERROR: Too few arguments to function App\Http\Controllers\JobController::jobsExport(), 0 passed and exactly 1 expected {"userId":2,"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Too few arguments to function App\Http\Controllers\JobController::jobsExport(), 0 passed and exactly 1 expected at /home/vagrant/FPOne/app/Http/Controllers/Activity/JobController.php:437) [stacktrace]

Activity icon

Started a new Conversation Laravel Excel Filtered Excel Download For Different Routes

Hi All,

I am using Laravel Excel from Maatwebsite for my application. Everything is working fine however now I came across a requirement of downloading a differently filtered excel for different routes. I've tried to provide different excel when the request is coming from a different route. But it is not working.

Exports File>colloection

public function collection()
    {

        if (\Route::current()->getName() == 'activity') {
            return Job::whereStatus('In Progress')->get();
        } elseif (\Route::current()->getName() == 'mainActivity') {
            return Job::whereStatus('Completed')->get();
        }
    }

Is this possible? Or do I have to create different Exports files for different requests ?

Dec
25
1 month ago
Activity icon

Replied to Host Laravel On Windows Server 2012 R2

Thanks, @tray2. Your inputs have helped me a lot.

Activity icon

Replied to Host Laravel On Windows Server 2012 R2

Hi @tray2.

Yeah. I can do that. So without the composer, I only need those 3 applications you have mentioned.

Apache2 mysql php 7.3

I have already set up my application with IIS. But it doesn't seem to be working very well. Routing and some performance issues are there.

Can I use Xampp on Server 2012 R2?

Activity icon

Replied to Host Laravel On Windows Server 2012 R2

Hi @tray2,

Thank you very much for your reply. I don't have physical access. Only network access. And I am unable to connect this to the Internet since this server is on an internal network.

Can I run laravel without the composer?

I can download this software from a system with internet access and transfer them to the server. However, will it work? I read that the composer is mandatory.

Activity icon

Started a new Conversation Host Laravel On Windows Server 2012 R2

Hi All,

I am trying to set up my laravel application on an internal server that doesn't have any outside connection to internet.

Since this server does not have internet access how can I download Composer, laravel etc. is there any method to set this up without IIS.

Nov
22
3 months ago
Activity icon

Replied to How To Integrate SSO With Default Laravel Authentication System

Hi @jaytee. is there any tutorial on how to do this. I already have an SSO service. Which was provided by a third party? I just need to integrate this into my application.