bobmyles

Experience

1,110

0 Best Reply Awards

  • Member Since 6 Months Ago
  • 7 Lessons Completed
  • 0 Favorites

5th July, 2017

bobmyles left a reply on Join Statement Using Query Builder • 1 month ago

I figured it out as below;

$content = DB::table('subscribed_services as a')
    ->join('scheduled_messages as b', 'a.id', '=', 'b.subscribed_services_id')
    ->join('subscription_services_msisdn as c', 'a.id', '=', 'c.subscribed_services_id')
    ->whereRaw('DATE(b.scheduled_at) = CURDATE()')
    ->whereRaw('DATE(c.sent_time) <> CURDATE()')
    ->selectRaw('b.message, c. phone_number, a.username, a.password')
    ->distinct()
    ->get();

bobmyles started a new conversation Join Statement Using Query Builder • 1 month ago

Hi there,

I have a Query builder statement below and I would want to introduce another condition to the query. However, I can not get this right.

This query works fine;

$content = DB::table('subscribed_services as a')
                ->join('scheduled_messages as b', 'a.id', '=', 'b.subscribed_services_id')
                ->join('subscription_services_msisdn as c', 'a.id', '=', 'c.subscribed_services_id')
                ->whereRaw('DATE(b.scheduled_at) = CURDATE()')
                ->selectRaw('b.message, c. phone_number, a.username, a.password')
                ->distinct()
                ->get();

I would want to introduce another where statement; this ->whereRaw('DATE(c.sent_time) != CURDATE()'). Meaning the query above should only pick values where subscription_services_msisdn.sent_time DATE(c.sent_time) IS NOT EQUAL to Current Date CURDATE().

Anyone lead me here. Regards.

4th July, 2017

bobmyles left a reply on Converting Join Sql Statement To Eloquent. • 1 month ago

Thank you tykus... Let try and convert it using query builder.

bobmyles started a new conversation Converting Join Sql Statement To Eloquent. • 1 month ago

I have three models.

  1. ScheduledMessage points to table scheduled_messages.
  2. SubscribedService points to table subscribed_services.
  3. SubscriptionServicesMsisdn points to table subscription_services_msisdn.

I have raw sql query that I would want to convert into eloquent but can not think of a way.

SQL Query:

SELECT DISTINCT 
  b.message, c. phone_number, a.username, a.password from subscribed_services a 
inner join 
  subscription_services_msisdn c on a.id = c.subscribed_services_id 
inner join 
 scheduled_messages b on a.id = b.subscribed_services_id where DATE(b.scheduled_at) = CURDATE()

Would someone please help convert to eloquent. Thank you.

27th April, 2017

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

This is how I was able to achieve this, well just in case some one else is struggling.

I changed my default disk on the file system to public i.e. (`app/config/filesystem.php)

Then created a symbolic link app/storage/app/public to app/public/storage

This enabled me to access all files on app/public/storage ....

To access the logos on the view I used img src="APP_URL/public/storage/logos/logo.png"

Thank you guys for the assistance .... About this and more here => https://laravel.com/docs/5.4/filesystem#the-public-disk

21st April, 2017

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

Below is the abs path to the image;

<span class="logo-lg"><img src="/var/www/html/airtime_top_up_portal/storage/app/public/logos/bobChild/logo.png" class="img-responsive" ></span>
    </a>

Is this what you need?

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

I have tried this but failed;

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

Hi... I tried php artisan storage:linkbut got;

I went though the doc as well.

[ErrorException] symlink(): No such file or directory

I am on ubuntu os ..

Kindly advice

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

Hi Robert, I changed the Default Filesystem Disk to use public ....

This created storage/app/public/logos/bobChild storage path..

The images are stored on the path storage/app/public/logos/bobChild/logo.png How do I create the symboilc link?

Kindly advice.

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

I tried this

<span class="logo-lg"><img src="Storage::local('app/logos/Demo/logo.jpg');" class="img-responsive" ></span>

this as well;

<span class="logo-lg"><img src="storage_path('app/logos/Abc/logo.jpg')" class="img-responsive" ></span>

but there was no display

bobmyles left a reply on How To Upload An Image And Display As Logo • 3 months ago

@edoc You mean this? <img src="storage_path('logos/Demo/logo.jpg')"

bobmyles started a new conversation How To Upload An Image And Display As Logo • 3 months ago

I am using Laravel 5.4. I am creating organizations; whose details include a logo.

The intention is when a user for the organization logs in, the logo is on the display.

I am able to upload and save the logo on storage/app/logos/organization_name/logo... eg storage/logos/Abc/logo.jpg

However, I am not able to pick and display the image/logo for an organization. I have gone through the docs https://laravel.com/docs/5.3/requests#retrieving-uploaded-files but still struggling.

Kindly someone save my day.

Image Upload and save code below: $org_image = $request->org_image;

        if ($org_image !== null) {
            $fileext = $org_image->getClientOriginalExtension(); //Get file extension
            $org_image->storeAs('logos/' . $organization_name, "logo.{$fileext}"); //save file 
     
         }

How do I fetch and display this on the view diffentiating by the organization name?

Regards.

29th March, 2017

bobmyles left a reply on Trait 'Illuminate\Database\Concerns\BuildsQueries' Not Found • 4 months ago

Sorry I can not explain why but here is the fix

FIX

1. I deleted /vendor with all it's files
2. composer install
3. It worked. 

I am not sure but I think git ignored /vendor on gitignore all along?

Regards.

bobmyles started a new conversation Trait 'Illuminate\Database\Concerns\BuildsQueries' Not Found • 4 months ago

Laravel Version: 5.4.* PHP Version: 7.0.17 Database Driver & Version: Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (x86_64) using readline 6.3 Description:

I am trying to login to my platform but getting this error, Trait 'Illuminate\Database\Concerns\BuildsQueries' not found

I have not done any changes on the file /vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:23 as from the logs the exception is; local.ERROR: Symfony\Component\Debug\Exception\FatalErrorException: Trait 'Illuminate\Database\Concerns\BuildsQueries' not found in /var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:23 Stack trace: #0 {main}

I can not interpret any further as that is the information I get from the logs.

Kindly someone advice.

Regards. Bob Mwenda.

Steps To Reproduce:

I tried submitting my login form; then got the error FatalErrorException in Builder.php line 23: Trait 'Illuminate\Database\Concerns\BuildsQueries' not found on the screen.

I can not figure out how to solve this.

9th February, 2017

bobmyles left a reply on How Do I Change The Default Register And Login Controllers In Laravel 5.3? • 6 months ago

So, when I get rid of use AuthenticatesUsers; on Login Controller, I get Method App\Http\Controllers\Auth\LoginController::login() does not exist

Does this mean I will have to create manual routes for the application?

Kindly advice.

bobmyles started a new conversation How Do I Change The Default Register And Login Controllers In Laravel 5.3? • 6 months ago

I would want to have this scenario that when a user signs up, an activation token is generated and sent to the email address specified.

On the users table, I have $table->boolean('is_activated')->default(0); that should be updated to 1 if the email link is clicked by the user. Hence the user is able to login as by the login controller below.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.