<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Berkay Kaya - Medium]]></title>
        <description><![CDATA[Berkay Kaya Blog - Medium]]></description>
        <link>https://medium.com/berkay-kaya?source=rss----dfd0337a4e3a---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Berkay Kaya - Medium</title>
            <link>https://medium.com/berkay-kaya?source=rss----dfd0337a4e3a---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:14:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/berkay-kaya" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Serving Uploaded Images With Laravel 5]]></title>
            <link>https://medium.com/berkay-kaya/serving-uploaded-images-with-laravel-5-1712f223c567?source=rss----dfd0337a4e3a---4</link>
            <guid isPermaLink="false">https://medium.com/p/1712f223c567</guid>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Berkay Kaya]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 22:48:26 GMT</pubDate>
            <atom:updated>2018-02-24T18:15:28.080Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s say you have a website with image upload functionality. It’s a good practice to save the uploaded files into your application’s storage directory which can be accessed via storage_path() helper method.</p><p>When uploading an image, you may need to store different resolutions of the image in each resolution’s directory. I am not going to explain in detail on how to resize your images but <a href="http://image.intervention.io/"><strong>Intervention</strong></a> library handles this job very easily.</p><p>When saving your images to your storage directory, you can define file path’s like below.</p><pre>$originalPath = storage_path(&#39;/images/original/file.jpg&#39;); $thumbnailPath = storage_path(&#39;/images/thumb/file.jpg&#39;);</pre><p>Since users won’t have access to your storage directory, there are 2 ways to serve these images.</p><h4>Using Routes</h4><p>With this method, you simply return the uploaded file’s path by querying it’s filename, in our example it is <strong>file.jpg</strong>.</p><pre>Route::get(&#39;images/{filename}&#39;, function ($filename) { return Image::make(storage_path(&#39;/images/original/&#39; .$filename))-&gt;response(); }); // for thumbnails Route::get(&#39;images/thumb/{filename}&#39;, function ($filename) { return Image::make(storage_path(&#39;/images/thumb/&#39; .$filename))-&gt;response(); });</pre><h4>Symbolic Links</h4><p>You can simply define a symbolic link from your storage directory to your public directory as follows.</p><pre>ln -s /path/to/laravel/storage/images /path/to/laravel/public/images</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1712f223c567" width="1" height="1" alt=""><hr><p><a href="https://medium.com/berkay-kaya/serving-uploaded-images-with-laravel-5-1712f223c567">Serving Uploaded Images With Laravel 5</a> was originally published in <a href="https://medium.com/berkay-kaya">Berkay Kaya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OneSignal Web Push Notifications for Laravel]]></title>
            <link>https://medium.com/berkay-kaya/onesignal-web-push-notifications-for-laravel-8de35851a6a4?source=rss----dfd0337a4e3a---4</link>
            <guid isPermaLink="false">https://medium.com/p/8de35851a6a4</guid>
            <category><![CDATA[pushweb]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[push-notification]]></category>
            <dc:creator><![CDATA[Berkay Kaya]]></dc:creator>
            <pubDate>Tue, 31 Oct 2017 22:46:31 GMT</pubDate>
            <atom:updated>2016-05-07T12:11:29.628Z</atom:updated>
            <content:encoded><![CDATA[<p>Push notifications for the web are becoming much popular these days, especially when it has become heavily used by Facebook and WhatsApp Web. In terms of notifying the user about a message, comment, etc. they are pretty useful.</p><p>In one of my Android applications, I used <a href="https://onesignal.com/">OneSignal</a> and I was quite happy with it. Then I decided to create a package that I can use OneSignal for my web projects.</p><p>You may download the package from <a href="https://packagist.org/packages/berkayk/onesignal-laravel">packagist</a> and this is the <a href="https://github.com/berkayk/laravel-onesignal">GitHub</a> link.</p><p>It’s a simple service including many helper methods. With this package, you can easily</p><ul><li>send notification to all users</li><li>target a specific segment</li><li>target a specific user</li><li>send a custom notification with custom parameters</li></ul><p>I am planning to extend this package with traits and additional helper methods later on.</p><h3>Installation</h3><blockquote><em>Before you start installing this package, please complete your OneSignal setup at </em><a href="https://onesignal.com/"><em>https://onesignal.com</em></a><em> and finish all the steps that is necessary to obtain an application id and REST API Keys.</em></blockquote><p>First, you’ll need to require the package with Composer:</p><pre>composer require berkayk/onesignal-laravel</pre><p>Aftwards, run composer update from your command line.</p><p>Then, update config/app.php by adding an entry for the service provider.</p><pre>&#39;providers&#39; =&gt; [ // ... Berkayk\OneSignal\OneSignalServiceProvider::class ];</pre><p>Then, register class alias by adding an entry in aliases section</p><pre>&#39;aliases&#39; =&gt; [ // ... &#39;OneSignal&#39; =&gt; Berkayk\OneSignal\OneSignalFacade::class ];</pre><p>Finally, from the command line, run</p><pre>php artisan vendor:publish</pre><p>to publish the default configuration file. This will publish a configuration file named onesignal.php which includes your OneSignal authorization keys.</p><h3>Configuration</h3><p>You need to fill in onesignal.php file that is found in your applications config directory. <br> app_id is your <em>OneSignal App ID</em> and rest_api_key is your <em>REST API Key</em>.</p><h4>Sending a Notification To All Users</h4><p>You can easily send a message to all registered users with the command</p><pre>OneSignal::sendNotificationToAll(&quot;Some Message&quot;, $url = null, $data = null);</pre><blockquote><em>$url and $data fields are optional. If you provide a $url parameter, users will be redirecting to that url.</em></blockquote><h4>Sending a Notification To A Specific User</h4><p>After storing a user’s tokens in a table, you can simply send a message with</p><pre>OneSignal::sendNotificationToUser(&quot;Some Message&quot;, $userId, $url = null, $data = null);</pre><p>$userId is the user’s unique id where he/she is registered for notifications. Read <a href="https://documentation.onesignal.com/docs/website-sdk-api#getUserId">https://documentation.onesignal.com/docs/website-sdk-api#getUserId</a> for additional details.</p><h4>Sending a Notification To Segment</h4><p>You can simply send a notification to a specific segment with</p><pre>OneSignal::sendNotificationToSegment(&quot;Some Message&quot;, $segment, $url = null, $data = null);</pre><h4>Sending a Custom Notification</h4><p>You can send a custom message with</p><pre>OneSignal::sendNotificationCustom($parameters);</pre><p>The example below will send a delayed message to a user at his/her timezone at 12:25PM.</p><pre>$userId = &quot;4bc5da02-1722-4fee-943d-c8b5ccd507a2&quot;; <br>$params = []; <br>$params[&#39;include_player_ids&#39;] = array($userId); <br>$contents = [ <br>   &quot;en&quot; =&gt; &quot;Some English Message&quot;, <br>   &quot;tr&quot; =&gt; &quot;Some Turkish Message&quot;<br>]; <br>$params[&#39;contents&#39;] = $contents; <br>$params[&#39;delayed_option&#39;] = &quot;timezone&quot;; // Will deliver on user&#39;s timezone <br>$params[&#39;delivery_time_of_day&#39;] = &quot;12:25PM&quot;; // Delivery time</pre><p>For additional documentation, you may refer to <a href="https://documentation.onesignal.com/docs/notifications-create-notification">https://documentation.onesignal.com/docs/notifications-create-notification</a></p><p>I really hope that this package helps you in your projects. Thanks for reading.</p><p><em>Originally published at </em><a href="http://berkaykaya.com/blog/2016/05/07/onesignal-webpush-notifications-for-laravel/"><em>berkaykaya.com</em></a><em> on May 7, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8de35851a6a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/berkay-kaya/onesignal-web-push-notifications-for-laravel-8de35851a6a4">OneSignal Web Push Notifications for Laravel</a> was originally published in <a href="https://medium.com/berkay-kaya">Berkay Kaya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>